summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Dywan <christian@twotoasts.de>2018-08-19 11:54:24 +0200
committerGitHub <noreply@github.com>2018-08-19 11:54:24 +0200
commitbf948274fbaf3bca6bce457de634477d6dbbc157 (patch)
treed69b1583d799c73fd01d13af1267ba0feccc3cd6
parent154568268bdb887303c02fc8b41830c954d72ea4 (diff)
downloadmidori-git-bf948274fbaf3bca6bce457de634477d6dbbc157.tar.gz
Update key in insert/ delete signal (#11)
This way, shortcuts and clipboard interactions are considered in addition to typing directly via the keyboard.
-rw-r--r--core/urlbar.vala23
1 files changed, 14 insertions, 9 deletions
diff --git a/core/urlbar.vala b/core/urlbar.vala
index 69f0b562..8cba903a 100644
--- a/core/urlbar.vala
+++ b/core/urlbar.vala
@@ -76,6 +76,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);
}
@@ -163,9 +169,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 {
@@ -179,13 +191,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) {