From 8a999dee1d9bb4a4cda301c573e1321af8522b47 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Fri, 6 Apr 2018 12:00:48 +0200 Subject: [PATCH] Disable auto-indenting on read-only buffers (fixes issue #102). For some mind-boggling reason, gtksourceview's "smart" indenting is able to modify a read-only buffer, so this commit disables indenting along editing. --- src/ide/why3ide.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ide/why3ide.ml b/src/ide/why3ide.ml index 30c61b704..789daf06d 100644 --- a/src/ide/why3ide.ml +++ b/src/ide/why3ide.ml @@ -520,7 +520,8 @@ let () = *) Hstr.iter (fun _ (_,source_view,_,_) -> - source_view#set_editable gconfig.allow_source_editing) + source_view#set_editable gconfig.allow_source_editing; + source_view#set_auto_indent gconfig.allow_source_editing) source_view_table; send_session_config_to_server () in @@ -815,7 +816,7 @@ let create_source_view = ~packing:scrolled_source_view#add () in let source_view = GSourceView2.source_view - ~auto_indent:true + ~auto_indent:gconfig.allow_source_editing ~insert_spaces_instead_of_tabs:true ~tab_width:2 ~show_line_numbers:true ~right_margin_position:80 ~show_right_margin:true -- GitLab