Fix hang with multiple spaces in URL completion

This commit is contained in:
Florian Bruhin 2016-09-04 20:19:16 +02:00
parent 64b3980685
commit faa052ad6f
3 changed files with 19 additions and 1 deletions

View File

@ -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)
-------------------

View File

@ -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

View File

@ -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