diff options
-rw-r--r-- | src/sc_editor.c | 11 | ||||
-rw-r--r-- | src/sc_editor.h | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c index 2936cf3..1b1bb04 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -66,6 +66,15 @@ void sc_editor_set_background(SCEditor *e, double r, double g, double b) } +void sc_editor_remove_cursor(SCEditor *e) +{ + e->cursor_frame = NULL; + e->cursor_line = 0; + e->cursor_pos = 0; + e->selection = NULL; +} + + /* (Re-)run the entire rendering pipeline. * NB "full" means "full". All frame, line and box handles will become * invalid. The cursor position will be unset. */ @@ -1087,7 +1096,7 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, switch ( event->keyval ) { case GDK_KEY_Escape : - e->selection = NULL; + sc_editor_remove_cursor(e); sc_editor_redraw(e); claim = 1; break; diff --git a/src/sc_editor.h b/src/sc_editor.h index b9f1c19..6e6011e 100644 --- a/src/sc_editor.h +++ b/src/sc_editor.h @@ -1,7 +1,7 @@ /* * sc_editor.h * - * Copyright © 2014 Thomas White <taw@bitwiz.org.uk> + * Copyright © 2014-2015 Thomas White <taw@bitwiz.org.uk> * * This file is part of Colloquium. * @@ -165,5 +165,6 @@ extern void sc_editor_set_top_frame_editable(SCEditor *e, extern void sc_editor_set_callbacks(SCEditor *e, SCCallbackList *cbl); extern void insert_scblock(SCBlock *scblock, SCEditor *e); extern void sc_editor_delete_selected_frame(SCEditor *e); +extern void sc_editor_remove_cursor(SCEditor *e); #endif /* SC_EDITOR_H */ |