Fixes#919.
There were two issues here:
- CompletionWidget didn't delete the old model when setting a new one. This
means filterAcceptsRow was called for models which aren't even used anymore.
- setChild was used instead of appendRow for the BaseCompletionModel, which
caused Qt to call filterAcceptsRow once for every item of the completion
model instead of only once.
Having a light Qt theme but a dark qutebrowser theme, one can see an
ugly white border around the completion widget which is some relict from
the underlying Qt widget QTreeView. As qutebrowser has its own theming
settings for the mainwindow, it should hide the Qt theme as far as
possible.
If :completion-item-del was invoked with no item selected (e.g. directly after
pressing 'o'), there was a crash because the currentIndex was invalid.
/cc @antoyo (but I believe one of my changes on top of yours caused this)
Before, the completion was shrinked every time any item was removed/added to
the completion (rowsRemoved/rowsInserted signals), which was >3000 times when
completing history.
Also, the signals got connected multiple times if setting the same model, which
made the situation worse.
Fixes#734.
- split() now returns a ParseResult namedtuple with (cmd, args, cmdline)
arguments instead of only returning cmdline and setting self._cmd/self._args.
- Handling of split commands (;;) is now done in a separate parse_all()
function instead of run() to make testing easier.
See #615.
Before, the first item was unconditionally selected when none was selected
before. With :completion-item-prev (e.g. Shift-Tab), it makes more sense to
select the *last* one.
Before we limited the history items we could simply call WebHistory's
historyContains before iterating through all items in the history completion.
Now however it's possible an item is in the real WebHistory, but not actually
in the completion - so we always have to check the whole completion.
Before, the item_added signal was emitted *after* an item was added, which
means the on_history_item_added slot always assumed the item already is in the
history.
Before, we initialized the completions once for every window spawned, which was
a waste of CPU-time and RAM.
Now we only initialize them once, when the user uses the completion for the
first time.
Otherwise we would construct a QStandardItem with the
QStandardItem(int rows, int columns = 1) constructor, which will most likely
not do what we want.
- HistoryItem.atime now always should be an int/float.
- The data for the sort role should also be an int, not a string.
A float would also work, but maybe be slower for no real benefit.
Two things here. One is to use `WebHistory._new_history` only as a to-save
queue, so we now add entries to `_old_urls` when they are first created and
can now no longer iterate of `_new_history` in `__iter__()`.
Second is to stop blindly tacking new history entries on the end of the
history completion model. It does involve iterating over the model to find the
existing entry but we only do that if we know the duplicate is there, which is
fast to check.
This also ads another point of mutation to the history completion model which
may prove problematic if it leads to more segfaults.
Each new HistoryEntry is emitted after being added to the global history
store. Current members of the HistoryEntry are `url` and `atime`. `title`
should be coming soon.
Adds a basic completion model implementation around the global browser
history and registers that for the open command.
Modifies WebHistory to add an __iter__ method and to use a dict instead of a
set to store an entire HistoryEntry for each archived item instead of just the
URL. Brief tests showed that the lookup time for set and dict are very
similar. They are at least on the same order of magnitude. Testing membership
of a list on the other hand, as was the case before a set was used, was four
orders of magnitude slower on my machine.
This makes it possible to use Qt's QSortFilterProxyModel::lessThan option for
completions where it doesn't make sense to priorize matches starting with the
entered string, e.g. for URLs. In return, we get a *much* better performance
(several seconds when opening the completion).
See #531.
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.
Before this, we always resized the completion when the mainwindow was resized.
If the statusbar is hidden during the resize (ui -> hide-statusbar is true), we
got an invalid calculated QRect for the completion, causing the update to be
not applied at all - so the completion showed up incorrectly.
With this change, another resize is done when the completion is shown - at this
point it's certain the statusbar is visible. Also we only update it while it's
shown - it doesn't make sense to always adjust its size when it's hidden
anyways.