diff options
author | Thomas White <taw@bitwiz.me.uk> | 2018-03-28 14:51:54 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2018-03-28 14:51:54 +0200 |
commit | 6cb58d80203fab0f58e8e0863d6c17f9fbaf6ea3 (patch) | |
tree | 885751258cb330b25abca7a8c5a412d7a41c1e45 /src/sc_editor.c | |
parent | 80717944576ff3fec50b037480c9dd8295b1b1b3 (diff) |
Rearrange editability checks when inserting text
Makes "insert into non-text paragraph" work again
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r-- | src/sc_editor.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c index 7b58c8f..06e7688 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -769,11 +769,6 @@ static void insert_text(char *t, SCEditor *e) { Paragraph *para; - if ( !position_editable(e->cursor_frame, e->cpos) ) { - fprintf(stderr, "Position not editable\n"); - return; - } - if ( e->sel_active ) { do_backspace(e->cursor_frame, e); } @@ -796,6 +791,12 @@ static void insert_text(char *t, SCEditor *e) size_t off; /* Yes. The "easy" case */ + + if ( !position_editable(e->cursor_frame, e->cpos) ) { + fprintf(stderr, "Position not editable\n"); + return; + } + off = pos_trail_to_offset(para, e->cpos.pos, e->cpos.trail); insert_text_in_paragraph(para, off, t); wrap_paragraph(para, NULL, |