Commit Graph

318 Commits

Author SHA1 Message Date
Florian Bruhin
bf4e968c67 Add new completion -> auto-open option.
Closes #557.
2015-06-27 19:55:04 +02:00
Florian Bruhin
c64d9520ff Fix lint.
Thanks to @Carpetsmoker for spotting this in #705.
2015-06-18 08:10:14 +02:00
Florian Bruhin
dfe98d1053 completion: Fix initial _cursor_part value.
Fixes #749.
2015-06-16 13:22:55 +02:00
Florian Bruhin
a545b919f7 Do history loading after qutebrowser has started. 2015-06-16 07:06:56 +02:00
Florian Bruhin
f17131f6c2 Change Qt links to point to qt.io. 2015-06-12 16:59:33 +02:00
Antoni Boucher
57a72a7120 Refactored bookmark removal to use a command. 2015-06-07 19:36:19 -04:00
Antoni Boucher
cf4b89efe3 Merge remote-tracking branch 'upstream/master' 2015-06-07 14:38:17 -04:00
Florian Bruhin
622938e3d3 Fix completion performance with shrink=True.
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.
2015-06-05 07:16:33 +02:00
Antoni Boucher
8b14145a4d Fixed style. 2015-06-03 19:31:31 -04:00
Antoni Boucher
f1874ff44f Added possibility to remove bookmarks and quickmarks. 2015-06-01 20:00:21 -04:00
Antoni Boucher
5085844550 Added highlighting for completion in name column. 2015-06-01 17:55:09 -04:00
Antoni Boucher
e92c493b07 Fixed bug making the application crash. 2015-05-30 12:37:21 -04:00
Antoni Boucher
cbc4ec6531 Added filter bookmarks by name as well as url. 2015-05-28 19:55:29 -04:00
Antoni Boucher
ece32e930c Added bookmarks command. 2015-05-24 19:18:40 -04:00
Antoni Boucher
0ee7e40e69 Fixed broken quickmarks completion. 2015-05-23 15:57:52 -04:00
Antoni Boucher
2c0c2e220e Fixed style issue. 2015-05-21 19:38:30 -04:00
Antoni Boucher
28caf45707 First version of bookmarks. 2015-05-21 18:17:22 -04:00
Florian Bruhin
8eb483d66b Set Qt.ItemNeverHasChildren for leaf model items.
This allows Qt to do some optimizations.
2015-05-18 21:35:14 +02:00
Florian Bruhin
f85ba8645f Handle a missing session folder at some places. 2015-04-13 08:38:12 +02:00
Florian Bruhin
e24b06cdf9 Refactor and fix split commands in CommandRunner.
- 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.
2015-04-13 07:38:25 +02:00
Florian Bruhin
2876ba5cfa Pass a parent to global QObjects. 2015-04-06 00:10:37 +02:00
Florian Bruhin
a504bd1436 Don't quote completions for maxsplit-commands.
Fixes #564.
Obsoletes #313 and #453.
2015-04-03 19:03:30 +02:00
Florian Bruhin
214347497a Fix handling of first :completion-item-prev call.
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.
2015-04-02 07:41:56 +02:00
Florian Bruhin
37ab5296a7 Adjust URL completion when quickmarks are changed.
Fixes #590.
2015-04-02 07:40:00 +02:00
Florian Bruhin
068e1c14b6 Don't display internal sessions in completion. 2015-04-01 22:32:41 +02:00
Florian Bruhin
8ebac8d38c Various spelling fixes. 2015-03-31 21:11:47 +02:00
Florian Bruhin
94bc10405a Merge branch 'histcomplete' 2015-03-17 06:16:26 +01:00
Florian Bruhin
59bbca9b40 Fix updating of existing items in hist-completion.
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.
2015-03-16 09:20:09 +01:00
Florian Bruhin
3df5e13c65 Fix exception in filtermodel if model has no items. 2015-03-16 07:42:21 +01:00
Florian Bruhin
503060881a Compare history items based on QUrl. 2015-03-16 07:42:10 +01:00
Florian Bruhin
693ea0c312 Cleanup 2015-03-16 07:10:06 +01:00
Florian Bruhin
553d8cf986 Also save the QUrl in a HistoryEntry.
We also use QUrl::toDisplayString for the completion so things like spaces or
umlauts are decoded properly.
2015-03-16 07:03:30 +01:00
Florian Bruhin
001bf982e5 Alternate row colors in completion. 2015-03-15 23:16:57 +01:00
Florian Bruhin
d266665955 Fix adding of URLs to history 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.
2015-03-15 21:16:45 +01:00
Florian Bruhin
9512a52d21 completion: Don't unnecessarily expand all items.
Instead of calling expandAll() and iterating through all items, we can just
force the top-level items to be expanded.
2015-03-14 22:51:53 +01:00
Florian Bruhin
cdbb118238 Also measure the time it takes to set the pattern. 2015-03-14 13:35:32 +01:00
Florian Bruhin
70cd8e74eb Measure time it takes to init URL completion. 2015-03-14 13:32:47 +01:00
Florian Bruhin
833830d5e9 Limit the count of history items in the completion. 2015-03-13 19:50:08 +01:00
Florian Bruhin
96da7d9fe6 Fix lint. 2015-03-13 16:26:27 +01:00
Florian Bruhin
74892ac8e4 Initialize completions lazily and only once.
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.
2015-03-13 16:25:13 +01:00
Florian Bruhin
389feab1df Make sure args are not int in new_item().
Otherwise we would construct a QStandardItem with the
QStandardItem(int rows, int columns = 1) constructor, which will most likely
not do what we want.
2015-03-12 15:35:53 +01:00
Florian Bruhin
dbd121a079 Set data of existing item. 2015-03-12 15:34:32 +01:00
Florian Bruhin
97dd86735a Improve types of history model values.
- 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.
2015-03-12 15:34:32 +01:00
Florian Bruhin
8023b1456d Make it possible to configure the timestamp format. 2015-03-12 15:25:39 +01:00
Florian Bruhin
7a28b6c821 Fix lint. 2015-03-12 14:55:54 +01:00
Jimmy
1efe18ecc6 Prevent duplicates in history completion.
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.
2015-03-12 20:15:03 +13:00
Florian Bruhin
0b975db4dd Refactor how completions are organized. 2015-03-11 23:07:58 +01:00
Florian Bruhin
34b24aafa8 Fix lint 2015-03-11 22:22:49 +01:00
Florian Bruhin
fe4f32606d Use CompletionFilterModel's sort implementation. 2015-03-11 21:50:16 +01:00
Jimmy
834832e3ba Web history changed signal now emits the new entry.
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.
2015-03-11 21:50:16 +01:00
Jimmy
59948a038c Add new UrlCompletion model which includes web history and quickmarks.
I went to some effort to avoid duplipcating code which which leads to some
arguably ugly class method calling.
2015-03-11 21:50:16 +01:00
Jimmy
f6a7ef3985 Add url history completion for open.
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.
2015-03-11 21:50:16 +01:00
Florian Bruhin
0f5391c4fa Scroll completion to top when showing it.
See #531.
2015-03-11 07:50:51 +01:00
Florian Bruhin
1b879faf84 completion: Highlight text case-insensitively.
See #531.
2015-03-11 07:50:45 +01:00
Florian Bruhin
5b4f6d39c2 Add a dumb sorting option to CompletionFilterModel.
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.
2015-03-11 07:50:33 +01:00
Florian Bruhin
3d5012ccca Rename 'Allowed' header for value completions. 2015-02-19 07:10:40 +01:00
Florian Bruhin
8f1d81a644 Add session support.
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.
2015-02-16 20:26:09 +01:00
Florian Bruhin
66ec4f0599 Resize completion when it's shown, and only then.
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.
2015-01-28 22:16:22 +01:00
Peter Vilim
c30978be2f Add quotes for empty default value 2015-01-19 13:17:17 -06:00
Florian Bruhin
a32f1e6180 Make it possible to deprecate commands.
See #448.
2015-01-15 22:29:00 +01:00
Peter Vilim
14afb3ef14 show-default-value: update heading 2015-01-08 12:52:21 -06:00
Peter Vilim
eba4b58a7c Show default config value in completion 2015-01-07 18:16:59 -06:00
Florian Bruhin
450d1ab70d Update copyright years 2015-01-03 15:51:31 +01:00
Florian Bruhin
b703028411 Clean up and temporarily disable alias completion.
Fixes #358.
2014-12-28 22:08:38 +01:00
Florian Bruhin
be2c67aa19 Don't filter completion parts if there's only one.
This fixes a regression (completion not showing with :) introduced in
b1501a691d.
2014-12-27 22:50:28 +01:00
Florian Bruhin
b1501a691d Ignore empty parts when calculating cursor part.
Fixes #389.
2014-12-26 16:57:08 +01:00
Florian Bruhin
512d7c4448 Simplify config exception tree and handling.
Also make sure we catch all config-related errors in all related places.
Fixes #324.
2014-12-17 11:17:18 +01:00
Florian Bruhin
06ec1a3885 Big file tree reorganisation.
Closes #255.
Should make a lot more sense now ;)
2014-12-13 17:28:50 +01:00