SF.net SVN: geany:[4788] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Mar 25 23:00:59 UTC 2010


Revision: 4788
          http://geany.svn.sourceforge.net/geany/?rev=4788&view=rev
Author:   eht16
Date:     2010-03-25 23:00:59 +0000 (Thu, 25 Mar 2010)

Log Message:
-----------
Fix cursor positioning when toggling comments (patch by Thomas Martitz, thanks).

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-03-25 22:45:30 UTC (rev 4787)
+++ trunk/ChangeLog	2010-03-25 23:00:59 UTC (rev 4788)
@@ -1,3 +1,10 @@
+2010-03-25  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/editor.c:
+   Fix cursor positioning when toggling comments
+   (patch by Thomas Martitz, thanks).
+
+
 2010-03-25  Peter Scholtens  <peter(dot)scholtens(at)xs4all(dot)nl>
 
  * src/keybindings.[hc]:

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2010-03-25 22:45:30 UTC (rev 4787)
+++ trunk/src/editor.c	2010-03-25 23:00:59 UTC (rev 4788)
@@ -2944,20 +2944,26 @@
 			gint eol_len = editor_get_eol_char_len(editor);
 			if (count_uncommented > 0)
 			{
-				sci_set_selection_start(editor->sci, sel_start - co_len - eol_len);
-				sci_set_selection_end(editor->sci, sel_end - co_len - eol_len);
+				sci_set_selection_start(editor->sci, sel_start - co_len + eol_len);
+				sci_set_selection_end(editor->sci, sel_end - co_len + eol_len);
 			}
-			else
+			else if (count_commented > 0)
 			{
-				sci_set_selection_start(editor->sci, sel_start + co_len + eol_len);
-				sci_set_selection_end(editor->sci, sel_end + co_len + eol_len);
+				sci_set_selection_start(editor->sci, sel_start + co_len - eol_len);
+				sci_set_selection_end(editor->sci, sel_end + co_len - eol_len);
 			}
 		}
 	}
 	else if (count_uncommented > 0)
 	{
-		sci_set_current_position(editor->sci, sel_start - co_len, TRUE);
+		gint eol_len = single_line ? 0: editor_get_eol_char_len(editor);
+		sci_set_current_position(editor->sci, sel_start - co_len + eol_len, TRUE);
 	}
+	else if (count_commented > 0)
+	{
+		gint eol_len = single_line ? 0: editor_get_eol_char_len(editor);
+		sci_set_current_position(editor->sci, sel_start + co_len - eol_len, TRUE);
+	}
 }
 
 


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