[geany/geany] ffde79: reflow: Don't split right before a whitespace

Colomban Wendling git-noreply at xxxxx
Mon Jan 4 21:21:19 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 04 Jan 2016 21:21:19 UTC
Commit:      ffde79e8ef1d91dc7de3c793c34373e33e5cc9a1
             https://github.com/geany/geany/commit/ffde79e8ef1d91dc7de3c793c34373e33e5cc9a1

Log Message:
-----------
reflow: Don't split right before a whitespace

Avoid splitting lines right before a whitespace when reflowing (e.g.
in case of several consecutive ones) not to move whitespaces at the
start of the next line, which, while they will be removed later on,
can lead to incorrect reflow width and even fully empty lines.
Prefer leave trailing spaces then, which is less of a problem.


Modified Paths:
--------------
    src/keybindings.c

Modified: src/keybindings.c
6 lines changed, 5 insertions(+), 1 deletions(-)
===================================================================
@@ -2244,7 +2244,11 @@ static gint split_line(GeanyEditor *editor, gint column)
 				}
 			}
 		}
-		if (!found)
+		/* don't split right before a space */
+		while (pos + 1 <= lend && sci_get_char_at(sci, pos + 1) == GDK_space)
+			pos++;
+
+		if (!found || pos >= lend)
 			break;
 
 		sci_insert_text(sci, pos + 1, editor_get_eol_char(editor));



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list