From db0a67766dba9b81ff4c780c212ec1dff9bb448c Mon Sep 17 00:00:00 2001
From: Florian Bruhin
Date: Tue, 7 Jun 2016 15:13:30 +0200
Subject: [PATCH] Ignore hints -> scatter for number hints
See https://github.com/The-Compiler/qutebrowser/issues/308#issuecomment-167091450
---
CHANGELOG.asciidoc | 1 +
qutebrowser/browser/hints.py | 2 +-
qutebrowser/config/configdata.py | 2 +-
tests/end2end/data/hints/issue1186.html | 2 +-
tests/end2end/data/hints/number.html | 2 +-
tests/end2end/features/hints.feature | 9 ++++++++-
6 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 384d51796..50fd684e7 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -65,6 +65,7 @@ Changed
- Number hints are now kept filtered after following a hint in rapid mode.
- Number hints are now renumbered after filtering
- Number hints can now be filtered with multiple space-separated search terms
+- `hints -> scatter` is now ignored for number hints
Fixed
-----
diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py
index 0cbf951cf..4d5ca242c 100644
--- a/qutebrowser/browser/hints.py
+++ b/qutebrowser/browser/hints.py
@@ -223,7 +223,7 @@ class HintManager(QObject):
else:
chars = config.get('hints', 'chars')
min_chars = config.get('hints', 'min-chars')
- if config.get('hints', 'scatter'):
+ if config.get('hints', 'scatter') and hint_mode != 'number':
return self._hint_scattered(min_chars, chars, elems)
else:
return self._hint_linear(min_chars, chars, elems)
diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py
index 0e24f368f..7016bee00 100644
--- a/qutebrowser/config/configdata.py
+++ b/qutebrowser/config/configdata.py
@@ -898,7 +898,7 @@ def data(readonly=False):
('scatter',
SettingValue(typ.Bool(), 'true'),
"Whether to scatter hint key chains (like Vimium) or not (like "
- "dwb)."),
+ "dwb). Ignored for number hints."),
('uppercase',
SettingValue(typ.Bool(), 'false'),
diff --git a/tests/end2end/data/hints/issue1186.html b/tests/end2end/data/hints/issue1186.html
index adf4fe155..29411b987 100644
--- a/tests/end2end/data/hints/issue1186.html
+++ b/tests/end2end/data/hints/issue1186.html
@@ -10,7 +10,7 @@
- This requires setting hints -> mode to number, and hints -> scatter to false.
+ This requires setting hints -> mode to number.
diff --git a/tests/end2end/data/hints/number.html b/tests/end2end/data/hints/number.html
index 3b4cda756..47b9d27b1 100644
--- a/tests/end2end/data/hints/number.html
+++ b/tests/end2end/data/hints/number.html
@@ -6,7 +6,7 @@
- This page contains various links to test numbered hints. This requires setting hints -> mode to number, and hints -> scatter to false.
+ This page contains various links to test numbered hints. This requires setting hints -> mode to number.
diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature
index 5f0ac15c3..1099aea00 100644
--- a/tests/end2end/features/hints.feature
+++ b/tests/end2end/features/hints.feature
@@ -193,7 +193,6 @@ Feature: Using hints
Scenario: Keeping hints filter when using backspace
When I open data/hints/issue1186.html
And I set hints -> mode to number
- And I set hints -> scatter to false
And I run :hint all
And I press the key "x"
And I press the key "0"
@@ -210,3 +209,11 @@ Feature: Using hints
And I run :hint all
And I press the keys "ten pos"
Then data/numbers/11.txt should be loaded
+
+ Scenario: Scattering is ignored with number hints
+ When I open data/hints/number.html
+ And I set hints -> mode to number
+ And I set hints -> scatter to true
+ And I run :hint all
+ And I run :follow-hint 00
+ Then data/numbers/1.txt should be loaded