Replace the setting ui.show-keyhints with ui.keyhint-blacklist, which
is a list of globs for keychains that shouldn't be hinted. This allows
users to prevent showing keyhints for keychains they already know.
keyhint-blacklist='*' is equivalent to show-keyhints=False.
Resolves#1515.
If a user knows the keychain and can type it quickly, we shouldn't
annoy them with a popup. Only show the keyhint if the user doesn't
complete their keychain in 500ms.
The isVisible() check in the tests is somewhat invalid now because it
is never immediately visible and I don't want to add a delay to unit
tests. I added a check that text() is not set for one test that was
only checking isVisible().
Addresses part of #1515.
The check `key.startswith('<') and key.endswith('>') is repeated many
times in code to check for a special key. Replace all these with a call
to the same function.
Currently, the keyhint window is shown even if the keystring matches no
possible bindings. This causes an empty keyhint window to hang around
after entering hinting mode.
Instead, the window is now hidden if no bindings match the current
keystring.
Resolves#1507.
This means:
- An annotation like (int, str) is now typing.Union[int, str].
- utils.typing got expanded so it acts like the real typing.py, with
issubclass() working properly with typing.Union and __union_params__
being set.
- A literal string doesn't exist anymore as annotation, instead
@cmdutils.argument now has a 'choices' argument which can be used like
@cmdutils.argument('arg', choices=['val1', 'val2']).
- Argument validating/converting is now entirely handled by
argparser.type_conv instead of relying on python's argparse, i.e.
type/choices is now not passed to argparse anymore.
Previously, negative bottom padding was used (probably to compensate
for a trailing <br>). With the table format, this is no longer
necessary and causes the last line to be drawn too low.
Don't show special keys in the keyhint window as these currently cannot
be part of keychains.
Use a rounded border on the top-right corner and square on the rest.
From code review:
- escape all strings used in the keyhint html
- read the prefix color each time the hint is shown
- use show/hide instead of setVisible
- clean up pylint/flake8 errors
- use CssColor instead of QssColor for keyhint.fg.suffix
- add some padding to the keyhint popup
When the current keystring is a partial match for one or more bindings,
show the possible bindings in a small overlay.
The overlay is partially transparent by default, but the background
color is configurable as ui->keystring.bg.
Before we used a {'nargs': '*'} annotation for the respective argument
to tell qutebrowser it's optional for the commandline. Now we instead
use a star_args_optional argument for @cmdutils.register as a first step
towards freeing up argument annotations for PEP 484.
See #637.
Under some circumstances I can't reproduce (switching/turning off
monitors?) it seems it's possible that SessionManager.save gets called
with last_window=True, without on_last_window_closed being called.
This might be to one of the Qt screen management bugs fixed in Qt 5.6,
which would explain why I can't reproduce it.
Instead of crashing, let's log the error and not save the session.
There are a lot of problems and flakiness with using a real clipboard.
Instead we now have a :debug-set-fake-clipboard command to set a text, and use
logging when getting the contents.
Fixes#1285.
I tried to set my editor to `termite -e "vim -f {}"`, termite being a
pretty cool and light terminal I use within my i3wm Arch linux box.
So when I open my editor I want it to launch a terminal with Vim inside
instead of GVim for various reasons.
The validation rejected this at first because it was looking for '{}'
inside ['foo', 'bar', 'baz {}'], essentially. So I need it to look
inside the sub-strings, not just the list.
Then after validation I need to perform the '{}' replacement inside the
sub-string too, not just replacing the whole string.
This patch attempts to fix an issue where an error occuring in
misc/guiprocess or the editor process crashing would delete the
temporary file thus making it impossible to recover changes not commited
to the form field from the editor.
This hopefully helps with a crash on Windows which happens from time to time
during some multi-window tabs.feature tests:
Traceback (most recent call last):
File "...\mainwindow\mainwindow.py", line 446, in closeEvent
self._do_close()
File "...\mainwindow\mainwindow.py", line 405, in _do_close
objreg.get('session-manager').save_last_window_session()
File "...\misc\sessions.py", line 247, in save_last_window_session
self._last_window_session = self._save_all()
File "...\misc\sessions.py", line 183, in _save_all
win_data['geometry'] = bytes(main_window.saveGeometry())
RuntimeError: wrapped C/C++ object of type MainWindow has been deleted
If we don't do that, we can get this:
--- Logging error ---
Traceback (most recent call last):
File ".../python3.5/logging/__init__.py", line 984, in emit
self.flush()
File ".../python3.5/logging/__init__.py", line 964, in flush
self.stream.flush()
RuntimeError: reentrant call inside <_io.BufferedWriter name='<stderr>'>
Call stack:
[...]
File ".../qutebrowser/app.py", line 122, in qt_mainloop
return qApp.exec_()
File ".../qutebrowser/utils/objreg.py", line 118, in on_destroyed
log.destroy.debug("schedule removal: {}".format(name))
File ".../python3.5/logging/__init__.py", line 1267, in debug
self._log(DEBUG, msg, args, **kwargs)
File ".../python3.5/logging/__init__.py", line 1415, in _log
self.handle(record)
File ".../python3.5/logging/__init__.py", line 1425, in handle
self.callHandlers(record)
File ".../python3.5/logging/__init__.py", line 1487, in callHandlers
hdlr.handle(record)
File ".../python3.5/logging/__init__.py", line 855, in handle
self.emit(record)
File ".../python3.5/logging/__init__.py", line 984, in emit
self.flush()
File ".../python3.5/logging/__init__.py", line 964, in flush
self.stream.flush()
File ".../qutebrowser/misc/crashsignal.py", line 365, in interrupt
log.destroy.info("Do the same again to forcefully quit.")
Message: 'Do the same again to forcefully quit.'
Arguments: ()
For some reason this fails during teardown on OS X!?
File "/Users/buildbot/buildbot/slave/osx/build/qutebrowser/misc/ipc.py", line 357, in update_atime
path = self._server.fullServerName()
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/unittest/mock.py", line 895, in __call__
_mock_self._mock_check_sig(*args, **kwargs)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/unittest/mock.py", line 107, in checksig
sig.bind(*args, **kwargs)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 2652, in bind
return args[0]._bind(args[1:], kwargs)
File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 2537, in _bind
param = next(parameters)
File "/Users/buildbot/buildbot/slave/osx/build/.tox/py34/bin/../lib/python3.4/_collections_abc.py", line 512, in __iter__
for key in self._mapping:
File "/Users/buildbot/buildbot/slave/osx/build/.tox/py34/lib/python3.4/collections/__init__.py", line 91, in __iter__
curr = root.next