[geany/geany-plugins] f98814: addons/markdown: Clear the markers when the selection is modified

gkatev git-noreply at xxxxx
Sun Oct 8 12:59:34 UTC 2017


Branch:      refs/heads/master
Author:      gkatev <george_kate at hotmail.com>
Committer:   gkatev <george_kate at hotmail.com>
Date:        Sun, 08 Oct 2017 12:59:34 UTC
Commit:      f98814a5705974eddbb3637f3a1cba6c2c73849d
             https://github.com/geany/geany-plugins/commit/f98814a5705974eddbb3637f3a1cba6c2c73849d

Log Message:
-----------
addons/markdown: Clear the markers when the selection is modified

Added a hook to clear the markers when the current selection is
changed (eg. text was deleted, replaced etc). This will only take
effect if 'single click deselect' is enabled in the preferences.


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
14 lines changed, 14 insertions(+), 0 deletions(-)
===================================================================
@@ -171,6 +171,20 @@ 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();
+	}
+}
+
 
 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).


More information about the Plugins-Commits mailing list