From faa052ad6f2b04afcf5bc8bb3d1481c8f74a5d6d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 4 Sep 2016 20:19:16 +0200 Subject: [PATCH] Fix hang with multiple spaces in URL completion --- CHANGELOG.asciidoc | 1 + qutebrowser/completion/models/sortfilter.py | 2 +- tests/end2end/features/completion.feature | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index b0f50f395..53298cc4f 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -141,6 +141,7 @@ Fixed - Various small issues with the command completion - The tabbar now displays correctly with the Adwaita Qt theme - The default `sk` keybinding now sets the commandline to `:bind` correctly +- Fixed hang when using multiple spaces in a row with the URL completion v0.8.3 (unreleased) ------------------- diff --git a/qutebrowser/completion/models/sortfilter.py b/qutebrowser/completion/models/sortfilter.py index 56905bbec..c5b0596b1 100644 --- a/qutebrowser/completion/models/sortfilter.py +++ b/qutebrowser/completion/models/sortfilter.py @@ -69,7 +69,7 @@ class CompletionFilterModel(QSortFilterProxyModel): with debug.log_time(log.completion, 'Setting filter pattern'): self.pattern = val val = re.escape(val) - val = val.replace(r'\ ', r'.*') + val = val.replace(r'\ +', r'.*') self.pattern_re = re.compile(val, re.IGNORECASE) self.invalidate() sortcol = 0 diff --git a/tests/end2end/features/completion.feature b/tests/end2end/features/completion.feature index f3a343585..18f2141d8 100644 --- a/tests/end2end/features/completion.feature +++ b/tests/end2end/features/completion.feature @@ -5,3 +5,20 @@ Feature: Command bar completion When I run :set-cmd-text -s :open And I run :completion-item-focus next Then no crash should happen + + Scenario: Hang with many spaces in completion (#1919) + # Generate some history data + When I open data/numbers/1.txt + And I open data/numbers/2.txt + And I open data/numbers/3.txt + And I open data/numbers/4.txt + And I open data/numbers/5.txt + And I open data/numbers/6.txt + And I open data/numbers/7.txt + And I open data/numbers/8.txt + And I open data/numbers/9.txt + And I open data/numbers/10.txt + And I run :set-cmd-text :open a b + # Make sure qutebrowser doesn't hang + And I run :message-info "Still alive!" + Then the message "Still alive!" should be shown