From 9ec77a6ba0427897f591e6c3c7431b115a2e7b22 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 24 Aug 2015 18:42:35 +0200 Subject: Escape gets rid of cursor in narrative window --- src/sc_editor.c | 11 ++++++++++- src/sc_editor.h | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') 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 + * Copyright © 2014-2015 Thomas White * * 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 */ -- cgit v1.2.3