From 55382df297e287bb46793bdcfa19aafe04c0cc14 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Sat, 1 Jun 2019 11:49:21 +0100 Subject: [PATCH] Comment out copied contents opening `Tools->Configuration Files` Discourage the user from overriding system settings unnecessarily. --- src/ui_utils.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ui_utils.c b/src/ui_utils.c index 92a0d3565..1463c7696 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -36,6 +36,7 @@ #include "filetypes.h" #include "geanymenubuttonaction.h" #include "keyfile.h" +#include "keybindings.h" #include "main.h" #include "msgwindow.h" #include "prefs.h" @@ -2096,6 +2097,7 @@ static void on_config_file_clicked(GtkWidget *widget, gpointer user_data) gchar *global_file; gchar *base_name = NULL; gchar *global_content = NULL; + GeanyDocument *doc = NULL; /* get the path inside app->configdir - can contain subdirectories */ if (g_str_has_prefix(file_name, app->configdir)) @@ -2115,8 +2117,17 @@ static void on_config_file_clicked(GtkWidget *widget, gpointer user_data) if (g_file_test(global_file, G_FILE_TEST_EXISTS)) g_file_get_contents(global_file, &global_content, NULL, NULL); - document_new_file(utf8_filename, ft, global_content); - + doc = document_new_file(utf8_filename, ft, global_content); + if (global_content) + { + sci_select_all(doc->editor->sci); + keybindings_send_command(GEANY_KEY_GROUP_FORMAT, + GEANY_KEYS_FORMAT_COMMENTLINETOGGLE); + sci_set_current_line(doc->editor->sci, 0); + document_set_text_changed(doc, FALSE); + sci_empty_undo_buffer(doc->editor->sci); + ui_document_show_hide(doc); /* update the document menu */ + } utils_free_pointers(4, utf8_filename, base_name, global_file, global_content, NULL); } } -- 2.11.4.GIT