SF.net SVN: geany: [941] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Sat Oct 28 16:25:22 UTC 2006


Revision: 941
          http://svn.sourceforge.net/geany/?rev=941&view=rev
Author:   ntrel
Date:     2006-10-28 09:25:17 -0700 (Sat, 28 Oct 2006)

Log Message:
-----------
Add temporary fix for sci infinite loop in Document::GetColumn(int)
when current pos is beyond document end (can occur when removing
blocks of selected lines especially brace sections near end of
file).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/ui_utils.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-10-28 14:58:48 UTC (rev 940)
+++ trunk/ChangeLog	2006-10-28 16:25:17 UTC (rev 941)
@@ -1,3 +1,12 @@
+2006-10-28  Nick Treleaven  <nick.treleaven at btinternet.com>
+
+ * src/ui_utils.c:
+   Add temporary fix for sci infinite loop in Document::GetColumn(int)
+   when current pos is beyond document end (can occur when removing
+   blocks of selected lines especially brace sections near end of
+   file).
+
+
 2006-10-28  Enrico Tröger  <enrico.troeger at uvena.de>
 
  * doc/geany.docbook:

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2006-10-28 14:58:48 UTC (rev 940)
+++ trunk/src/ui_utils.c	2006-10-28 16:25:17 UTC (rev 941)
@@ -87,8 +87,15 @@
 
 		if (pos == -1) pos = sci_get_current_position(doc_list[idx].sci);
 		line = sci_get_line_from_position(doc_list[idx].sci, pos);
-		col = sci_get_col_from_position(doc_list[idx].sci, pos);
 
+	   // Add temporary fix for sci infinite loop in Document::GetColumn(int)
+	   // when current pos is beyond document end (can occur when removing
+	   // blocks of selected lines especially esp. brace sections near end of file).
+		if (pos <= sci_get_length(doc_list[idx].sci))
+			col = sci_get_col_from_position(doc_list[idx].sci, pos);
+		else
+			col = 0;
+
 		text = g_strdup_printf(_("%c  line: % 4d column: % 3d  selection: % 4d   %s      mode: %s%s      cur. function: %s      encoding: %s %s     filetype: %s"),
 			(doc_list[idx].changed) ? 42 : 32,
 			(line + 1), (col + 1),


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



More information about the Commits mailing list