aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2015-08-24 18:42:35 +0200
committerThomas White <taw@bitwiz.org.uk>2015-08-24 18:44:25 +0200
commit9ec77a6ba0427897f591e6c3c7431b115a2e7b22 (patch)
tree7ddb8bcad7c5f333d69a515c2c0de1f04b22281b /src
parent5826c1d685f513a1364a9e49ad61ccef752a7e0b (diff)
Escape gets rid of cursor in narrative window
Diffstat (limited to 'src')
-rw-r--r--src/sc_editor.c11
-rw-r--r--src/sc_editor.h3
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 */