When a redirect occurs, the item is saved in history with a -r suffix
now. When opening qutebrowser that's picked up and the item is hidden
from completion.
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.
When showing the currently bound key in the misc column for command
completion, if the command has multiple bindings, show special bindings
(e.g. <ctrl-a>) after non-special bindings.
- Add a space after the comman for multiple binding suggestions.
- Use defaultdict(list) instead of defaultdict(lambda: [])
- Move the pylint comment back to the top of the class
Adds a title to the HistoryEntry class and includes it in the serialization
stuff. Not currently set from anywhere.
Not sure if anything more needs to be done to support non-ascii characters.
Everything works fine for me with unicode chars in url and title but
everything in my stack is utf-8.
The CompletionItemDelegate gets reused by Qt for various items in the
completion. Every time _get_textdoc() was called we created a new
QTextDocument, but since it has a long-living parent set (the delegate)
the old one was never actually garbage collected.
We now explicitly delete the old QTextDocument as it's not needed
anymore by either Qt or Python.
See #1476.
All commands will be offered as completions for the <command> argument
of :bind.
Due to the way completers parse the command line, the following
bind --mode caret j
will throw off completions as 'caret' is treated as a positional arg in
terms of the argument count for completions.
In the above example, completion will be triggered for 'j' and no
completions will be given for the actual command.
bind --mode=caret j will complete correctly, though completions are not
filtered by the given mode.
I attempted an approach to filter the commands based on the mode but it
ended up being messy and flaky.
This worked fine with Python 3.5 but causes a circular import which is
hard to break with Python 3.4.
The original solution was to do @pyqtSlot(object), but that doesn't work
with PyQt 5.6 anymore...
Allows to use ctrl+d to close tabs from the buffer completion widget
when they are selected. Respects current tab settings like whether you
can close the last tab in a window.
Had to change the `rebuild()` method to use `setData()` when possible
because the selection was being lost if the whole model was being rebuilt.
Current problems are:
1) When opening a new window while you already the tab completion open on
one window a category is added for the new window but new rows in
that category aren't picked up. Interesting if you open a third
window then close the second window the completion display is now
correct... I can see that the model is being updated correctly but I
am not sure why that isn't propagating to the view. Not sure whether
it is worth looking into (further) either.
2) Bit of duplication of code, it iterates over the window registry
twice. Could put everything in one loop but then that would be
dependant on the current behaviour of the `tab_closed` signal being
called with the relevant `tabbed_browser` still existing but with the
`shutting_down` flag set.
3) I'm still using just the one `rebuild()` method and removing items from
the end then calling `setData` on everything rather than having special
`on_tab/window_closed` methods (or partial functions) that delete the
actual corresponding item. Because if I did that I would also have to
special case tab moves etc.
`buffer` takes either a tab index or a string and focuses the specified
tab. The index can be of the form [0-9]+ which will switch to the
relevant tab in the current window or [0-9]+/[0-9]+ (that is
win_id/index) which will focus the specified window before switching
tabs. If a string is passed the list of open tabs across all windows is
sorted based on title and url (just like in the completion widget) and
the top result is selected.
WebHistory now has a clear() method which is also a command
(history-clear) which clears the qutebrowser history using the new
lineparser clear() method and emits a cleared signal.
The completion model urlmodel connects to the WebHistory.cleared signal
and clears its history category completion list.
I am adding this as a temporary fix before #58 or #1051 get implemented.