[geany/geany] bfd558: Merge pull request #852 from b4n/reflow-hang
Colomban Wendling
git-noreply at xxxxx
Mon Jan 18 02:40:56 UTC 2016
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Mon, 18 Jan 2016 02:40:56 UTC
Commit: bfd5587f4fa15dc36fd6f42a1b68e26d3681328e
https://github.com/geany/geany/commit/bfd5587f4fa15dc36fd6f42a1b68e26d3681328e
Log Message:
-----------
Merge pull request #852 from b4n/reflow-hang
Fix hang in reflow command (and small improvements around)
Modified Paths:
--------------
src/keybindings.c
Modified: src/keybindings.c
16 lines changed, 9 insertions(+), 7 deletions(-)
===================================================================
@@ -2221,7 +2221,7 @@ static gint split_line(GeanyEditor *editor, gint column)
gint pos;
/* don't split on a trailing space of a line */
- if (sci_get_char_at(sci, lend - 1) == GDK_space)
+ if (sci_get_char_at(sci, lend - 1) == ' ')
lend--;
/* detect when the line is short enough and no more splitting is needed */
@@ -2232,7 +2232,7 @@ static gint split_line(GeanyEditor *editor, gint column)
found = FALSE;
for (pos = edge - 1; pos > lstart; pos--)
{
- if (sci_get_char_at(sci, pos) == GDK_space)
+ if (sci_get_char_at(sci, pos) == ' ')
{
found = TRUE;
break;
@@ -2242,19 +2242,21 @@ static gint split_line(GeanyEditor *editor, gint column)
{
for (pos = edge; pos < lend; pos++)
{
- if (sci_get_char_at(sci, pos) == GDK_space)
+ if (sci_get_char_at(sci, pos) == ' ')
{
found = TRUE;
break;
}
}
}
- if (!found)
+ /* don't split right before a space */
+ while (pos + 1 <= lend && sci_get_char_at(sci, pos + 1) == ' ')
+ pos++;
+
+ if (!found || pos >= lend)
break;
- sci_set_current_position(sci, pos + 1, FALSE);
- sci_cancel(sci); /* don't select from completion list */
- sci_send_command(sci, SCI_NEWLINE);
+ sci_insert_text(sci, pos + 1, editor_get_eol_char(editor));
line++;
}
return line - start_line;
--------------
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