Browse Source

TextView::on_key_press_event workaround: another fix for dead keys

merge-requests/365/head
eidheim 10 years ago
parent
commit
febf786cd2
  1. 5
      src/source.cc
  2. 2
      src/source.h

5
src/source.cc

@ -1058,7 +1058,8 @@ bool Source::View::on_key_press_event(GdkEventKey* key) {
return true; return true;
} }
previous_keyval=last_keyval; if(last_keyval<GDK_KEY_Shift_L || last_keyval>GDK_KEY_Hyper_R)
previous_non_modifier_keyval=last_keyval;
last_keyval=key->keyval; last_keyval=key->keyval;
if(get_buffer()->get_has_selection()) if(get_buffer()->get_has_selection())
@ -1290,7 +1291,7 @@ bool Source::View::on_key_press_event_basic(GdkEventKey* key) {
//Note: valgrind reports issues on TextView::on_key_press_event as well //Note: valgrind reports issues on TextView::on_key_press_event as well
auto unicode=gdk_keyval_to_unicode(key->keyval); 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_keyval<GDK_KEY_dead_grave || previous_keyval>GDK_KEY_dead_greek)) { (previous_non_modifier_keyval<GDK_KEY_dead_grave || previous_non_modifier_keyval>GDK_KEY_dead_greek)) {
if(get_buffer()->get_has_selection()) { if(get_buffer()->get_has_selection()) {
Gtk::TextIter selection_start, selection_end; Gtk::TextIter selection_start, selection_end;
get_buffer()->get_selection_bounds(selection_start, selection_end); get_buffer()->get_selection_bounds(selection_start, selection_end);

2
src/source.h

@ -154,7 +154,7 @@ namespace Source {
bool spellcheck_all=false; bool spellcheck_all=false;
std::unique_ptr<SelectionDialog> spellcheck_suggestions_dialog; std::unique_ptr<SelectionDialog> spellcheck_suggestions_dialog;
guint previous_keyval=0; guint previous_non_modifier_keyval=0;
guint last_keyval=0; guint last_keyval=0;
private: private:
GtkSourceSearchContext *search_context; GtkSourceSearchContext *search_context;

Loading…
Cancel
Save