Added option to auto reload files changed on disk (#1246)
When option is enabled geany automatically reloads files which have changed on disk but have no changes in the buffer. When the option is disabled (default) geany shows the reload dialog as before. Tested @vfaronov
This commit is contained in:
parent
2d9f97debd
commit
75a69aad93
@ -2598,6 +2598,11 @@ gio_unsafe_save_backup Make a backup when using GIO unsafe file f
|
||||
keep_edit_history_on_reload Whether to maintain the edit history when true immediately
|
||||
reloading a file, and allow the operation
|
||||
to be reverted.
|
||||
reload_clean_doc_on_file_change Whether to automatically reload documents false immediately
|
||||
that have no changes but which have changed
|
||||
on disk.
|
||||
If unsaved changes exist then the user is
|
||||
prompted to reload manually.
|
||||
**Filetype related**
|
||||
extract_filetype_regex Regex to extract filetype name from file See below. immediately
|
||||
via capture group one.
|
||||
|
@ -3609,6 +3609,12 @@ static void enable_key_intercept(GeanyDocument *doc, GtkWidget *bar)
|
||||
|
||||
static void monitor_reload_file(GeanyDocument *doc)
|
||||
{
|
||||
if (! doc->changed && file_prefs.reload_clean_doc_on_file_change)
|
||||
{
|
||||
document_reload_force(doc, doc->encoding);
|
||||
return;
|
||||
}
|
||||
|
||||
gchar *base_name = g_path_get_basename(doc->file_name);
|
||||
|
||||
/* show this message only once */
|
||||
|
@ -66,6 +66,7 @@ typedef struct GeanyFilePrefs
|
||||
gboolean tab_close_switch_to_mru;
|
||||
gboolean keep_edit_history_on_reload; /* Keep undo stack upon, and allow undoing of, document reloading. */
|
||||
gboolean show_keep_edit_history_on_reload_msg; /* whether to show the message introducing the above feature */
|
||||
gboolean reload_clean_doc_on_file_change;
|
||||
}
|
||||
GeanyFilePrefs;
|
||||
|
||||
|
@ -246,6 +246,8 @@ static void init_pref_groups(void)
|
||||
"keep_edit_history_on_reload", TRUE);
|
||||
stash_group_add_boolean(group, &file_prefs.show_keep_edit_history_on_reload_msg,
|
||||
"show_keep_edit_history_on_reload_msg", TRUE);
|
||||
stash_group_add_boolean(group, &file_prefs.reload_clean_doc_on_file_change,
|
||||
"reload_clean_doc_on_file_change", FALSE);
|
||||
/* for backwards-compatibility */
|
||||
stash_group_add_integer(group, &editor_prefs.indentation->hard_tab_width,
|
||||
"indent_hard_tab_width", 8);
|
||||
|
Loading…
x
Reference in New Issue
Block a user