diff options
author | Christian Dywan <christian@twotoasts.de> | 2018-08-12 21:50:03 +0200 |
---|---|---|
committer | Christian Dywan <christian@twotoasts.de> | 2018-08-12 21:50:03 +0200 |
commit | 6081f8f81b9872a085538371d2bc849012c0a133 (patch) | |
tree | 8ab5e79dadcd414eea88c4d8a3f09ad9518cabd9 | |
parent | a47795769ffa59adb78055f0e128544211ab52c5 (diff) | |
download | midori-git-insert-delete-completion.tar.gz |
Update key in insert/ delete signalinsert-delete-completion
This way, shortcuts and clipboard interactions are considered
in addition to typing directly via the keyboard.
-rw-r--r-- | core/urlbar.vala | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/core/urlbar.vala b/core/urlbar.vala index 48bef498..74a6f05a 100644 --- a/core/urlbar.vala +++ b/core/urlbar.vala @@ -68,6 +68,12 @@ namespace Midori { uri = suggestion.item.uri; }); + insert_text.connect_after ((new_text, new_position, ref position) => { + update_key (text); + }); + delete_text.connect_after ((start_pos, end_pos) => { + update_key (text); + }); icon_press.connect (icon_pressed); } @@ -155,9 +161,15 @@ namespace Midori { return false; } - // Interpret input - bool entry_handled_key_press = base.key_press_event (event); + // No completion on control characters + unichar character = Gdk.keyval_to_unicode (event.keyval); + if (character != 0 && event.is_modifier == 0) { + complete (); + } + return base.key_press_event (event); + } + void update_key (string text) { location = magic_uri (text); if (location == null) { try { @@ -171,13 +183,6 @@ namespace Midori { regex = null; } - // No completion on control characters - unichar character = Gdk.keyval_to_unicode (event.keyval); - if (character != 0 && event.is_modifier == 0) { - complete (); - } - - return entry_handled_key_press; } string? magic_uri (string text) { |