Branch: refs/heads/master Author: Frank Lanitz frank@frank.uvena.de Committer: GitHub noreply@github.com Date: Tue, 10 Oct 2017 08:12:07 UTC Commit: 0cdd61a3628e10a7bbceaac19cdfe8ad1d84b57e https://github.com/geany/geany-plugins/commit/0cdd61a3628e10a7bbceaac19cdfe8...
Log Message: ----------- Merge pull request #614 from gkatev/master
addons/markword: Deselect when the selection changes
Modified Paths: -------------- addons/src/addons.c addons/src/ao_markword.c addons/src/ao_markword.h
Modified: addons/src/addons.c 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -178,6 +178,8 @@ gboolean ao_editor_notify_cb(GObject *object, GeanyEditor *editor, SCNotification *nt, gpointer data) { ao_bookmark_list_update_marker(ao_info->bookmarklist, editor, nt); + + ao_mark_editor_notify(ao_info->markword, editor, nt);
return FALSE; }
Modified: addons/src/ao_markword.c 25 lines changed, 25 insertions(+), 0 deletions(-) =================================================================== @@ -171,6 +171,31 @@ static gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton * return FALSE; }
+void ao_mark_editor_notify(AoMarkWord *mw, GeanyEditor *editor, SCNotification *nt) +{ + // If something is about to be deleted and there is selected text clear the markers + if(nt->nmhdr.code == SCN_MODIFIED && + ((nt->modificationType & SC_MOD_BEFOREDELETE) == SC_MOD_BEFOREDELETE) && + sci_has_selection(editor->sci)) + { + AoMarkWordPrivate *priv = AO_MARKWORD_GET_PRIVATE(mw); + + if(priv->enable_markword && priv->enable_single_click_deselect) + clear_marker(); + } + + // In single click deselect mode, clear the markers when the cursor moves + else if(nt->nmhdr.code == SCN_UPDATEUI && + nt->updated == SC_UPDATE_SELECTION && + !sci_has_selection(editor->sci)) + { + AoMarkWordPrivate *priv = AO_MARKWORD_GET_PRIVATE(mw); + + if(priv->enable_markword && priv->enable_single_click_deselect) + clear_marker(); + } +} +
void ao_mark_document_new(AoMarkWord *mw, GeanyDocument *document) {
Modified: addons/src/ao_markword.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -44,6 +44,8 @@ AoMarkWord* ao_mark_word_new (gboolean enable, gboolean single_click_deselect void ao_mark_document_new (AoMarkWord *mw, GeanyDocument *document); void ao_mark_document_open (AoMarkWord *mw, GeanyDocument *document); void ao_mark_document_close (AoMarkWord *mw, GeanyDocument *document); +void ao_mark_editor_notify (AoMarkWord *mw, GeanyEditor *editor, + SCNotification *nt);
G_END_DECLS
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org