[geany/geany-plugins] dbf478: Add editor_indicator_clear() and perform a rescan/clear on 'check while typing' toggle

Enrico Tröger git-noreply at geany.org
Thu Nov 1 11:27:03 UTC 2012


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Thu, 01 Nov 2012 11:27:03 UTC
Commit:      dbf478f33562330f564a50c116f438959e159502
             https://github.com/geany/geany-plugins/commit/dbf478f33562330f564a50c116f438959e159502

Log Message:
-----------
Add editor_indicator_clear() and perform a rescan/clear on 'check while typing' toggle

As requested in #3495051.


Modified Paths:
--------------
    spellcheck/src/gui.c

Modified: spellcheck/src/gui.c
26 files changed, 24 insertions(+), 2 deletions(-)
===================================================================
@@ -61,6 +61,14 @@
 static gboolean sc_ignore_callback = FALSE;
 
 
+static void perform_check(GeanyDocument *doc);
+
+
+static void clear_spellcheck_error_markers(GeanyDocument *doc)
+{
+	editor_indicator_clear(doc->editor, GEANY_INDICATOR_ERROR);
+}
+
 
 static void print_typing_changed_message(void)
 {
@@ -73,13 +81,27 @@ static void print_typing_changed_message(void)
 
 static void toolbar_item_toggled_cb(GtkToggleToolButton *button, gpointer user_data)
 {
+	gboolean check_while_typing_changed, check_while_typing;
+
 	if (sc_ignore_callback)
 		return;
 
-	sc_info->check_while_typing = gtk_toggle_tool_button_get_active(button);
+	check_while_typing = gtk_toggle_tool_button_get_active(button);
+	check_while_typing_changed = check_while_typing != sc_info->check_while_typing;
+	sc_info->check_while_typing = check_while_typing;
 
 	print_typing_changed_message();
 
+	/* force a rescan of the document if 'check while typing' has been turned on and clean
+	 * errors if it has been turned off */
+	if (check_while_typing_changed)
+	{
+		GeanyDocument *doc = document_get_current();
+		if (sc_info->check_while_typing)
+			perform_check(doc);
+		else
+			clear_spellcheck_error_markers(doc);
+	}
 }
 
 
@@ -232,7 +254,7 @@ static GtkWidget *init_editor_submenu(void)
 
 static void perform_check(GeanyDocument *doc)
 {
-	editor_indicator_clear(doc->editor, GEANY_INDICATOR_ERROR);
+	clear_spellcheck_error_markers(doc);
 
 	if (sc_info->use_msgwin)
 	{



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).


More information about the Plugins-Commits mailing list