summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Dywan <christian@twotoasts.de>2018-11-15 09:21:17 +0100
committerGitHub <noreply@github.com>2018-11-15 09:21:17 +0100
commitb286e21c25f76e2380603039463ddea5e698ab15 (patch)
tree17b634cb6b9ca84aaf89b0c7d5e3ce64104678e8
parentcea30772bd380022fae37bc918a14401031496d7 (diff)
downloadmidori-git-b286e21c25f76e2380603039463ddea5e698ab15.tar.gz
Always set key regardless of location guess (#169)
`location` is set based on the guessing the difference between search terms and a domain or local path. The mistake here was only setting `key` if it's unset. Fixes: #162
-rw-r--r--core/suggestion-row.vala2
-rw-r--r--core/urlbar.vala16
2 files changed, 7 insertions, 11 deletions
diff --git a/core/suggestion-row.vala b/core/suggestion-row.vala
index 0f427c3c..e8027cde 100644
--- a/core/suggestion-row.vala
+++ b/core/suggestion-row.vala
@@ -42,7 +42,7 @@ namespace Midori {
}
});
notify["key"].connect ((pspec) => {
- if (key != null) {
+ if (location == null) {
var suggestion = (SuggestionItem)item;
item.uri = CoreSettings.get_default ().uri_for_search (key, suggestion.search);
icon.icon_name = "edit-find-symbolic";
diff --git a/core/urlbar.vala b/core/urlbar.vala
index 20f2db23..b7b0aae4 100644
--- a/core/urlbar.vala
+++ b/core/urlbar.vala
@@ -165,18 +165,14 @@ namespace Midori {
void update_key (string text) {
location = magic_uri (text);
- if (location == null) {
- try {
- key = text;
- regex = new Regex ("(%s)".printf (Regex.escape_string (key)),
- RegexCompileFlags.CASELESS);
- } catch (RegexError error) {
- debug ("Failed to create regex: %s", error.message);
- }
- } else {
+ try {
+ key = text;
+ regex = new Regex ("(%s)".printf (Regex.escape_string (key)),
+ RegexCompileFlags.CASELESS);
+ } catch (RegexError error) {
regex = null;
+ debug ("Failed to create regex: %s", error.message);
}
-
}
string? magic_uri (string text) {