From a0b401672129de037e831967fae23a0a0009bb42 Mon Sep 17 00:00:00 2001 From: eidheim Date: Wed, 23 Mar 2016 13:18:52 +0100 Subject: [PATCH] TextView::on_key_press_event workaround fix for dead keys --- src/source.cc | 4 +++- src/source.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/source.cc b/src/source.cc index 5eab55b..c4c6c5c 100644 --- a/src/source.cc +++ b/src/source.cc @@ -1058,6 +1058,7 @@ bool Source::View::on_key_press_event(GdkEventKey* key) { return true; } + previous_keyval=last_keyval; last_keyval=key->keyval; if(get_buffer()->get_has_selection()) @@ -1288,7 +1289,8 @@ bool Source::View::on_key_press_event_basic(GdkEventKey* key) { //Have only experienced this on OS X //Note: valgrind reports issues on TextView::on_key_press_event as well auto unicode=gdk_keyval_to_unicode(key->keyval); - if((key->state&(GDK_CONTROL_MASK|GDK_META_MASK))==0 && unicode>=32 && unicode!=127) { + if((key->state&(GDK_CONTROL_MASK|GDK_META_MASK))==0 && unicode>=32 && unicode!=127 && + (previous_keyvalGDK_KEY_dead_greek)) { if(get_buffer()->get_has_selection()) { Gtk::TextIter selection_start, selection_end; get_buffer()->get_selection_bounds(selection_start, selection_end); diff --git a/src/source.h b/src/source.h index 1e0a3b0..93c8adb 100644 --- a/src/source.h +++ b/src/source.h @@ -154,6 +154,7 @@ namespace Source { bool spellcheck_all=false; std::unique_ptr spellcheck_suggestions_dialog; + guint previous_keyval=0; guint last_keyval=0; private: GtkSourceSearchContext *search_context;