SF.net SVN: geany-plugins:[1407] trunk/geany-plugins/spellcheck

eht16 at users.sourceforge.net eht16 at xxxxx
Tue May 25 20:01:45 UTC 2010


Revision: 1407
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1407&view=rev
Author:   eht16
Date:     2010-05-25 20:01:45 +0000 (Tue, 25 May 2010)

Log Message:
-----------
Fix broken checks when the selected text is only on one line.

Modified Paths:
--------------
    trunk/geany-plugins/spellcheck/ChangeLog
    trunk/geany-plugins/spellcheck/src/speller.c

Modified: trunk/geany-plugins/spellcheck/ChangeLog
===================================================================
--- trunk/geany-plugins/spellcheck/ChangeLog	2010-05-25 19:44:08 UTC (rev 1406)
+++ trunk/geany-plugins/spellcheck/ChangeLog	2010-05-25 20:01:45 UTC (rev 1407)
@@ -1,3 +1,9 @@
+2010-05-25  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/speller.c:
+   Fix broken checks when the selected text is only on one line.
+
+
 2010-01-01  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/*.c, src/*.h:

Modified: trunk/geany-plugins/spellcheck/src/speller.c
===================================================================
--- trunk/geany-plugins/spellcheck/src/speller.c	2010-05-25 19:44:08 UTC (rev 1406)
+++ trunk/geany-plugins/spellcheck/src/speller.c	2010-05-25 20:01:45 UTC (rev 1407)
@@ -196,16 +196,25 @@
 	}
 	g_free(dict_string);
 
-	for (i = first_line; i < last_line; i++)
+	if (first_line == last_line)
 	{
-		line = sci_get_line(doc->editor->sci, i);
+		line = sci_get_selection_contents(doc->editor->sci);
+		suggestions_found += sc_speller_process_line(doc, first_line, line);
+		g_free(line);
+	}
+	else
+	{
+		for (i = first_line; i < last_line; i++)
+		{
+			line = sci_get_line(doc->editor->sci, i);
 
-		suggestions_found += sc_speller_process_line(doc, i, line);
+			suggestions_found += sc_speller_process_line(doc, i, line);
 
-		/* process other GTK events to keep the GUI being responsive */
-		while (g_main_context_iteration(NULL, FALSE));
+			/* process other GTK events to keep the GUI being responsive */
+			while (g_main_context_iteration(NULL, FALSE));
 
-		g_free(line);
+			g_free(line);
+		}
 	}
 	if (suggestions_found == 0 && sc_info->use_msgwin)
 		msgwin_msg_add(COLOR_BLUE, -1, NULL, _("The checked text is spelled correctly."));


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list