aboutsummaryrefslogtreecommitdiffhomepage
path: root/ide/preferences.ml
diff options
context:
space:
mode:
authorGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2016-07-18 02:24:42 +0200
committerGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2016-07-26 20:43:15 +0200
commite3faeb71580f85394042028499bbc9573efc23cb (patch)
tree266fcba2782bda74910aacb5714979bdc68a2bec /ide/preferences.ml
parent1ca19082cf506c304b3c7945e72c0238f2aa9d1a (diff)
Adding a flag in CoqIDE to configure UNIX/Windows line ending.
Fixes both bugs #4924 and #4437.
Diffstat (limited to 'ide/preferences.ml')
-rw-r--r--ide/preferences.ml27
1 files changed, 26 insertions, 1 deletions
diff --git a/ide/preferences.ml b/ide/preferences.ml
index 3a33bbb1d..3241a962d 100644
--- a/ide/preferences.ml
+++ b/ide/preferences.ml
@@ -121,6 +121,18 @@ let inputenc_of_string s =
else if s = "LOCALE" then Elocale
else Emanual s)
+type line_ending = [ `DEFAULT | `WINDOWS | `UNIX ]
+
+let line_end_of_string = function
+| "unix" -> `UNIX
+| "windows" -> `WINDOWS
+| _ -> `DEFAULT
+
+let line_end_to_string = function
+| `UNIX -> "unix"
+| `WINDOWS -> "windows"
+| `DEFAULT -> "default"
+
let use_default_doc_url = "(automatic)"
module Repr =
@@ -381,6 +393,10 @@ let stop_before =
let reset_on_tab_switch =
new preference ~name:["reset_on_tab_switch"] ~init:false ~repr:Repr.(bool)
+let line_ending =
+ let repr = Repr.custom line_end_to_string line_end_of_string in
+ new preference ~name:["line_ending"] ~init:`DEFAULT ~repr
+
let vertical_tabs =
new preference ~name:["vertical_tabs"] ~init:false ~repr:Repr.(bool)
@@ -818,6 +834,15 @@ let configure ?(apply=(fun () -> ())) () =
(string_of_inputenc encoding#get)
in
+ let line_ending =
+ combo
+ "EOL character"
+ ~f:(fun s -> line_ending#set (line_end_of_string s))
+ ~new_allowed:false
+ ["unix"; "windows"; "default"]
+ (line_end_to_string line_ending#get)
+ in
+
let source_style =
combo "Highlighting style:"
~f:source_style#set ~new_allowed:false
@@ -973,7 +998,7 @@ let configure ?(apply=(fun () -> ())) () =
Section("Files", Some `DIRECTORY,
[global_auto_revert;global_auto_revert_delay;
auto_save; auto_save_delay; (* auto_save_name*)
- encodings;
+ encodings; line_ending;
]);
Section("Project", Some (`STOCK "gtk-page-setup"),
[project_file_name;read_project;