Repository: qutebrowser/qutebrowser

Issue:
(Option to) suppress hiding hints in rapid mode
Right now if I start typing one hint in rapid mode, the next completion will end up disappearing as I'm typing the current one, which throws me off if I'm trying to read in advance to see what the next one would be.

(Option to) suppress hiding hints in rapid mode
Right now if I start typing one hint in rapid mode, the next completion will end up disappearing as I'm typing the current one, which throws me off if I'm trying to read in advance to see what the next one would be.



Discussion:
Note that this applies only to the `word` mode, and maybe `letter`, but in `number` it is intentional to hide the other hints as you type, because in numeric mode writing works as filter.

This is probably something I've caused sometime in winter... I'll take a look.

Actually, in number mode writing the numbers and letters are separate, so for consistency we can suppress hiding the hints while typing the _hint string_.

Note that this applies only to the `word` mode, and maybe `letter`, but in `number` it is intentional to hide the other hints as you type, because in numeric mode writing works as filter.

This is probably something I've caused sometime in winter... I'll take a look.

Actually, in number mode writing the numbers and letters are separate, so for consistency we can suppress hiding the hints while typing the _hint string_.


Resolving patch:
diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py
--- a/qutebrowser/browser/hints.py
+++ b/qutebrowser/browser/hints.py
@@ -764,8 +764,11 @@ def handle_partial_key(self, keystr):
                         # hidden element which matches again -> show it
                         self._show_elem(elem.label)
                 else:
-                    # element doesn't match anymore -> hide it
-                    self._hide_elem(elem.label)
+                    # element doesn't match anymore -> hide it, unless in rapid
+                    # mode and hide-unmatched-rapid-hints is false (see #1799)
+                    if (not self._context.rapid or
+                            config.get('hints', 'hide-unmatched-rapid-hints')):
+                        self._hide_elem(elem.label)
             except webelem.Error:
                 pass
 
diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py
--- a/qutebrowser/config/configdata.py
+++ b/qutebrowser/config/configdata.py
@@ -956,6 +956,10 @@ def data(readonly=False):
                  )), 'python'),
              "Which implementation to use to find elements to hint."),
 
+            ('hide-unmatched-rapid-hints',
+             SettingValue(typ.Bool(), 'true'),
+             "Controls hiding unmatched hints in rapid mode."),
+
             readonly=readonly
         )),
 


Test patch:
diff --git a/tests/manual/hints/hide_unmatched_rapid_hints.html b/tests/manual/hints/hide_unmatched_rapid_hints.html
new file mode 100644
--- /dev/null
+++ b/tests/manual/hints/hide_unmatched_rapid_hints.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta charset="utf-8">
+        <title>Hide unmatched rapid hints</title>
+    </head>
+    <body>
+        <p>When <code>hints -> hide-unmatched-rapid-hints</code> is set to true (default), rapid hints behave like normal hints, i.e. unmatched hints will be hidden as you type. Setting the option to false will disable hiding in rapid mode, which is sometimes useful (see <a href="https://github.com/The-Compiler/qutebrowser/issues/1799">#1799</a>).</p>
+        <p>Note that when hinting in number mode, the <code>hints -> hide-unmatched-rapid-hints</code> option affects typing the hint string (number), but not the filter (letters).</p>
+        <p>Here is couple of invalid links to test the behaviour:</p>
+        <p><a href="#foo">one</a></p>
+        <p><a href="#foo">two</a></p>
+        <p><a href="#foo">three</a></p>
+        <p><a href="#foo">four</a></p>
+        <p><a href="#foo">five</a></p>
+        <p><a href="#foo">six</a></p>
+        <p><a href="#foo">seven</a></p>
+        <p><a href="#foo">eight</a></p>
+        <p><a href="#foo">nine</a></p>
+        <p><a href="#foo">ten</a></p>
+        <p><a href="#foo">eleven</a></p>
+        <p><a href="#foo">twelve</a></p>
+        <p><a href="#foo">thirteen</a></p>
+    </body>
+</html>