SF.net SVN: geany:[4231] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Sep 24 11:27:03 UTC 2009


Revision: 4231
          http://geany.svn.sourceforge.net/geany/?rev=4231&view=rev
Author:   ntrel
Date:     2009-09-24 11:26:59 +0000 (Thu, 24 Sep 2009)

Log Message:
-----------
Apply patch from Lex Trotman to make 'Reflow block/lines(s)'
keybinding use line breaking column when enabled.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/THANKS
    trunk/src/keybindings.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-09-22 17:53:07 UTC (rev 4230)
+++ trunk/ChangeLog	2009-09-24 11:26:59 UTC (rev 4231)
@@ -1,3 +1,10 @@
+2009-09-24  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/keybindings.c, THANKS:
+   Apply patch from Lex Trotman to make 'Reflow block/lines(s)'
+   keybinding use line breaking column when enabled.
+
+
 2009-09-22  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * doc/geany.txt, doc/geany.html:

Modified: trunk/THANKS
===================================================================
--- trunk/THANKS	2009-09-22 17:53:07 UTC (rev 4230)
+++ trunk/THANKS	2009-09-24 11:26:59 UTC (rev 4231)
@@ -68,6 +68,7 @@
 Eugene Arshinov <earshinov(at)gmail(dot)com> - Reload color schemes, split lines KB patches, and more
 Jon Strait <jstrait(at)moonloop(dot)net> - Markdown filetype patch
 Forgeot Eric <eforgeot(at)yahoo(dot)fr> - Txt2Tags filetype patch
+Lex Trotman <elextr<at>gmail<dot>com> - Build commands configuration improvements, and more
 
 Translators:
 ------------

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2009-09-22 17:53:07 UTC (rev 4230)
+++ trunk/src/keybindings.c	2009-09-24 11:26:59 UTC (rev 4231)
@@ -2058,14 +2058,10 @@
 }
 
 
-static void split_lines(GeanyEditor *editor)
+static void split_lines(GeanyEditor *editor, gint column)
 {
 	gint start, indent, linescount, i;
 
-	/* do nothing if long line marker is disabled */
-	if (editor_prefs.long_line_type == 2)
-		return;
-
 	start = sci_get_line_from_position(editor->sci,
 		sci_get_selection_start(editor->sci));
 
@@ -2079,8 +2075,7 @@
 	/*
 	 * If this line is short enough, just return
 	 */
-	if (editor_prefs.long_line_column >
-		sci_get_line_end_position(editor->sci, start) -
+	if (column > sci_get_line_end_position(editor->sci, start) -
 		sci_get_position_from_line(editor->sci, start))
 	{
 		return;
@@ -2110,8 +2105,7 @@
 	sci_target_from_selection(editor->sci);
 	linescount = sci_get_line_count(editor->sci);
 	sci_lines_split(editor->sci,
-		(editor_prefs.long_line_column - indent) *
-		sci_text_width(editor->sci, STYLE_DEFAULT, " "));
+		(column - indent) *	sci_text_width(editor->sci, STYLE_DEFAULT, " "));
 	linescount = sci_get_line_count(editor->sci) - linescount;
 
 	/* Fix indentation. */
@@ -2124,7 +2118,24 @@
 {
 	ScintillaObject *sci = editor->sci;
 	gboolean sel;
+	gint column = -1;
 
+	if (editor->line_breaking)
+	{
+		/* use line break column if enabled */
+		column = editor_prefs.line_break_column;
+	}
+	else if (editor_prefs.long_line_type != 2)
+	{
+		/* use long line if enabled */
+		column = editor_prefs.long_line_column;
+	}
+	else
+	{
+		/* do nothing if no column is defined */
+		utils_beep();
+		return;
+	}
 	sci_start_undo_action(sci);
 	sel = sci_has_selection(sci);
 	if (!sel)
@@ -2142,9 +2153,10 @@
 			sci_set_selection_end(sci, pos);
 		}
 	}
-	split_lines(editor);
+	split_lines(editor, column);
 	if (!sel)
 		sci_set_anchor(sci, -1);
+
 	sci_end_undo_action(sci);
 }
 


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