Fixes#1911.
The bugfix is backported in my qt5-webengine-debug package, and
QUTE_QTBUG54419_PATCHED can be set to force qutebrowser to use
createWindow.
This changes the message so it resembles the default choices=... one,
and also changes the argument to "filters" because that sounds nicer as
a metavar.
On windows, only one process can open a file in write mode at once. We
didn't close the handle we got (self._oshandle) before _cleanup, which
means that we had the file open the whole time, which means that the
external editor couldn't write back the changes.
This patch closes the file while the external editor is running and only
opens it once the editor is closed. We re-opened the file anyway, so
this shouldn't be a huge change. Additionally, tempfile.NamedTemporaryFile
is used instead of mkstemp, as we don't have to deal with os-level file
handles that way.
This makes commands like `:open web.archive.org/web/{url}` possible.
This commit also adds a no_replace_variables command register argument
that stops the replacement from happening, which is important for
commands like `:bind` and `:spawn` that take a command as an argument.
unix_filename_rubout deletes to the previous slash or whitespace,
unlike the previously implemented backwards-kill-word which treats and
non-alphanumeric character as a boundary.
To illustrate, given the text 'foo/bar.baz', unix_filename_rubout will
delete 'bar.baz' while backwards-kill-word will delete only 'baz'.
See #1710.
This restores the previous behavior of `unix-word-rubout` as
`backward-kill-word`, which is closer to the naming used in readline.
It is bound to <Alt-Backspace> by default, though <Ctrl-Backspace> will
also work due to a builtin binding.
Resolves#1698.
Per one of the diff comments on #1597:
> I used to use a tuple for constant things, but nowadays I'd actually
> prefer a list as a tuple is something more heterogeneous (i.e. it
> makes sense to have a `(x, y)` point as a tuple, but a list of points
> would be a list).
> At some point I should probably change it to a list everywhere 😉
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
Why does this matter? In my vimrc I have this:
" When using dwb <C-e>; assume markdown, and don't store in viminfo since these are
" temporary files
autocmd BufRead,BufNewFile /home/martin/.cache/dwb/edit* setlocal ft=markdown viminfo=
I would like to do the same with qutebrowser, but this is not possible with a
file name like '/tmp/tmpSJsgSG4'
KeyConfig needs this feature, because it can fix some deprecated commands
during __init__ and emit its dirty-signal, but that happens before the saveable
is added.
Before, we always loaded the default session (if it existed) and then deleted
it. This was surprising as the default session was deleted even when another
session was loaded.
Now we don't delete it at all, and save the session to load in the state file.
See #523.
The former approach (always reading the whole history from disk) was rather
inefficient, and we had performance problems e.g. when marking text in Qt
documentation.
We already attempted this in c5a2039da4, but
having the directories as module attributes means they'll be created on start
(rather than when they're actually used), and it'd also be impossible to change
them after init for some reason in the future.
To still have a nice short API, we simply change the attributes to functions.
Closes#12.
See #499.
See #11.
This adds PyYAML as a new dependency.
It adds the following new commands:
:session-delete <name>
Delete a session.
:session-load <name>
Load a session.
:session-save [<name>]
Save a session.
:wq [<name>]
Save open pages and quit.
And the following new settings:
general -> save-session:
Whether to always save the open pages.
Previously we showed self.text in the __repr__ of MinimalLineEdit. This however
is a bad idea, because it exposes passwords to the debug log when the currently
focused widget is logged.