OK, the actual problem seem to be that as is the autoindent triggered by
newline (expected) will autoindent wider than the original (line start) one,
and start messing up everything.
```diff
diff --git a/src/keybindings.c b/src/keybindings.c
index 8913c57..4da0dba 100644
--- a/src/keybindings.c
+++ b/src/keybindings.c
@@ -2247,6 +2249,11 @@ static gint split_line(GeanyEditor *editor, gint column)
if (!found)
break;
+ /* don't split on trailing spaces, which would mess up with
auto-indent
+ * and possibly lead to infinite loop */
+ while (pos + 1 < lend && sci_get_char_at(sci, pos + 1) ==
GDK_space)
+ pos ++;
+
sci_set_current_position(sci, pos + 1, FALSE);
sci_cancel(sci); /* don't select from completion list */
sci_send_command(sci, SCI_NEWLINE);
```
Fixes the lock and some unexpected behavior, but the behavior is probably not
great as it'll split very early because of all the spaces. Maybe we'd like to
trim repeated spaces, but that might also be unwanted… not sure. What do you
think?
Also the reflow code has weird behavior regarding tabs, maybe we should also
allow splitting on tabs (or even `g_ascii_isspace()`)?
---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/848#issuecomment-168727853