Skip to content

Commit

Permalink
Enable new Scintilla "Change History"
Browse files Browse the repository at this point in the history
Makes Geany feel a litttle bit more modern.

Can be enabled/disabled via Prefs. Default is to show the
change history in the markers margin.

Note: Scintilla tracks only its own change history and is not connected
to any VCS, unlike the git-changebar plugin. Also, change history is
lost when the document is closed and re-opened.
  • Loading branch information
kugel- committed Sep 27, 2023
1 parent 4e4b3ed commit e4feb5c
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
63 changes: 63 additions & 0 deletions data/geany.glade
Original file line number Diff line number Diff line change
Expand Up @@ -4294,6 +4294,69 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="left-padding">12</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="check_change_history_markers">
<property name="label" translatable="yes">Show in markers margin</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="check_change_history_indicators">
<property name="label" translatable="yes">Show as underline indicators</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label252">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Change History&lt;/b&gt;</property>
<property name="use-markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="position">3</property>
Expand Down
9 changes: 9 additions & 0 deletions src/editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -5205,6 +5205,15 @@ void editor_apply_update_prefs(GeanyEditor *editor)
/* virtual space */
SSM(sci, SCI_SETVIRTUALSPACEOPTIONS, editor_prefs.show_virtual_space, 0);

/* Change history */
guint change_history_mask;
change_history_mask = SC_CHANGE_HISTORY_DISABLED;
if (editor_prefs.change_history_markers)
change_history_mask |= SC_CHANGE_HISTORY_ENABLED|SC_CHANGE_HISTORY_MARKERS;
if (editor_prefs.change_history_indicators)
change_history_mask |= SC_CHANGE_HISTORY_ENABLED|SC_CHANGE_HISTORY_INDICATORS;
SSM(sci, SCI_SETCHANGEHISTORY, change_history_mask, 0);

/* caret Y policy */
caret_y_policy = CARET_EVEN;
if (editor_prefs.scroll_lines_around_cursor > 0)
Expand Down
2 changes: 2 additions & 0 deletions src/editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ typedef struct GeanyEditorPrefs
gint scroll_lines_around_cursor;
gint ime_interaction; /* input method editor's candidate window behaviour */
gboolean show_line_endings_only_when_differ;
gboolean change_history_markers;
gboolean change_history_indicators;
}
GeanyEditorPrefs;

Expand Down
4 changes: 4 additions & 0 deletions src/keyfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ static void init_pref_groups(void)
"radio_virtualspace_selection", GEANY_VIRTUAL_SPACE_SELECTION,
"radio_virtualspace_always", GEANY_VIRTUAL_SPACE_ALWAYS,
NULL);
stash_group_add_toggle_button(group, &editor_prefs.change_history_markers,
"change_history_markers", TRUE, "check_change_history_markers");
stash_group_add_toggle_button(group, &editor_prefs.change_history_indicators,
"change_history_indicators", FALSE, "check_change_history_indicators");
stash_group_add_toggle_button(group, &editor_prefs.autocomplete_doc_words,
"autocomplete_doc_words", FALSE, "check_autocomplete_doc_words");
stash_group_add_toggle_button(group, &editor_prefs.completion_drops_rest_of_word,
Expand Down

0 comments on commit e4feb5c

Please sign in to comment.