diff options
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r-- | src/sc_editor.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c index 065c76b..36ea899 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -748,9 +748,16 @@ static void do_backspace(struct frame *fr, SCEditor *e) show_edit_pos(p1); show_edit_pos(p2); - delete_text_from_frame(e->cursor_frame, p1, p2, wrapw); + if ( position_editable(e->cursor_frame, p1) + && position_editable(e->cursor_frame, p2) ) + { - e->cpos = p2; + delete_text_from_frame(e->cursor_frame, p1, p2, wrapw); + e->cpos = p2; + + } else { + fprintf(stderr, "Deleting not editable.\n"); + } } else { @@ -770,13 +777,8 @@ static void insert_text(char *t, SCEditor *e) { Paragraph *para; - if ( e->cursor_frame == NULL ) { - fprintf(stderr, "Inserting text into no frame.\n"); - return; - } - - if ( e->cpos.para >= e->cursor_frame->n_paras ) { - fprintf(stderr, "Cursor paragraph number is too high!\n"); + if ( !position_editable(e->cursor_frame, e->cpos) ) { + fprintf(stderr, "Position not editable\n"); return; } |