diff options
author | Thomas White <taw@bitwiz.org.uk> | 2017-01-10 22:15:54 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2017-01-10 22:15:54 +0100 |
commit | ae695b7c2fc41b34a6737b12532541b32801feef (patch) | |
tree | e615e659d0a354e292514ed67a6e237b8ed6abc4 /src/sc_editor.c | |
parent | 97266236e846fedb021a37c3a418d5b79ffed6bc (diff) |
Split paragraphs on enter
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r-- | src/sc_editor.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c index 1cb1761..83bb90b 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -641,6 +641,17 @@ static void insert_text(char *t, SCEditor *e) return; } + + if ( strcmp(t, "\n") == 0 ) { + split_paragraph_at_cursor(e); + if ( e->flow ) update_size(e); + cursor_moveh(e->cursor_frame, &e->cursor_para, + &e->cursor_pos, &e->cursor_trail, +1); + check_cursor_visible(e); + sc_editor_redraw(e); + return; + } + para = e->cursor_frame->paras[e->cursor_para]; /* Is this paragraph even a text one? */ |