Vulture exposed the following dead code:
- AppendLineParse was only used for reading the history text file, which is now
a sql database (and the import code for the old text file is simpler and does
not need a complex line parser)
- async_read_done is no longer used as importing the history text file is
synchronous (and should only happen once)
- config._init_key_config is unused as it was moved to keyconf.init
This was a performance optimization that shouldn't be needed with the new SQL
history backend. This also removes support for the LIMIT feature from SqlTable
as it only existed to support web-history-max-items.
The new function-based completion API introduced a circular import:
config -> keyconf -> miscmodels -> config.
config only depended on keyconf so it could initialize it as part of
config.init. This can be resolved by moving this to keyconf.init and
initializing keyconf as part of app.init.
The new completion API no longer needs either of these. Instead of
referencing an enum member, cmdutils.argument.completion now points to
a function that returnsthe desired completion model.
This vastly simplifies the addition of new completion types. Previously
it was necessary to define the new model as well as editing usertypes
and completion.models.instances. Now it is only necessary to define a
single function under completion.models.
This is the next step of Completion Model/View Revamping (#74).
There was a circular import from
config -> keyconf -> miscmodels -> config.
This is resolved by scoping config's keyconf import to the one function
that uses it.
This continues the spirit of my previous PR and allows formatting tab
titles to designate when private mode is enabled. I didn't even realize
that tab title-format was a separate thing from window-title-format
(yes, it's in the name.. silly craftyguy), until now.
With per-domain settings, having a getter for a setting gets really complicated,
as there isn't one true value for a setting.
The only reason we needed those getters is to save away the default values for
some settings where we were unsure what the defaults are.
- For font setters, we can get the defaults from QFont, like QtWeb{Kit,Engine}
do.
- For font sizes, we hardcode the defaults QtWeb{Kit,Engine} hardcodes too.
- For maximum-page-in-cache, we hardcode 0, just like QtWebKit.
- For default-encoding, we hardcode iso-8559-1, like QtWeb{Kit,Engine}
- For offline-storage-default-quota, we hardcode 5MB, like QtWebKit
- For offline-web-application-cache-quota, we hardcode MAXINT as default value,
but we still keep the empty value in the config. It means "no quota"
internally in QtWebKit, but it's a too confusing value to have in the config.
- For object-cache-capacities it's a bit more complicated (the defaults are
calculated based on disk space), but let's just get rid of the setting
altogether in the next commit (see #1751).
Closes#2639.
Turns out QWebEngineSettings.globalSettings() only sets things on the default
profile. We now get everything from the default profile settings, but set it on
both the default and the private profile.
Fixes#2638
(cherry picked from commit b11a4388cd10b6ff2fd917fca689ebdc50d581ae)
This allows users to change the size of the favicon independently from
the size of the font/tab, in order to adjust the balance between
favicons and text. The drawing code is also adjusted to place the icon
relative to the text center, rather than the text top.
Works as expected even for values of 0.0 (which is equivalent to hiding
the favicon completely).
Closes#2549.
Before, we just returned the same data for both, but then we'll run into
same-origin restrictions as qute:history and qute:history/data are not the same
host.
Problem: I like to edit `~/.config/qutebrowser/qutebrowser.conf`
manually with Vim. This works great, except that the current format is a
bit of a pain to deal with:
[section-name]
# section description
#
# [ Description of all the options]
actual options
So if I want to know the description or what the default value is, I
need to scroll up and back down.
Solution: change the order of the comments to:
# section description
[section-name]
# Option description
option = value
# Option description two
optiontwo = value
# Hello, world!
[section-two]
...
Which is much more convenient (and also what almost any other program
does).
(This patch changes much less code than it looks in the diff; I just
de-looped and moved `_str_option_desc` below `_str_items` as that makes
more sense since it gets called by `_str_items`).
- adds new `general` -> `default-open-dispatcher` setting (string)
- if set, will be used instead of QDesktopServices.openUrl (xdg-open backend)
- fixes the 'download handlers' part of issue #841
- note that this is only relevent to the `:download-open` command and other
methods of opening downloaded files from qutebrowser
Chooses the next value from the provided list of values (string-wise
comparison). Technically, the 'option!' syntax for toggling bools is now
redundant, but a translation from 'option!' to '--cycle option false
true' is kept for backwards compatibility.
The '--cycle' flag could also be technically optionally, since the only
thing that depends on it is preserving the error message for specifying
multiple values. (But I think it's best to keep it explicit, as a
principle-of-least-surprise thing)
Note: The business logic of picking the next value and setting it was
moved out to a separate function to avoid tripping pylint's
too-many-branches detector.
Fixes#47
Between v0.8.4 and now, the default keybinding for Ctrl-PgDown changed:
- ('tab-focus', ['J', '<Ctrl-PgDown>']),
+ ('tab-next', ['J', '<Ctrl-PgDown>']),
The existing keybinding was lower-cased in the config, but _is_new
didn't lowercase the new one, causing a conflict to show up.
Fixes#1835
See #1958
Supersedes #1986
Created configuration configdata.
Load and use template defined on configdata.
TODO: ability to conserve information between restart
TODO: ability to update title on configuration change
Done so far:
Two new commands pin/unpin, both accept a index to help the organization
(maybe this should be more a flag and not exactly two commands)
Crtl+p to pin, Crtl+O to unpin (not sure which should a good default
shortcut)
If user tries to close a pinned tab it's asked to confirm
If user tries to open a URL in a pinned tab it receives a message with a
information that the tab is pinned and ignore the openurl command
Preserve the pinned information across restart if session is activated
Missing:
Visual indication of the tab being pinned
Tab appearance being distinct over other tabs
Make pinned tabs to be the firsts on the tab bar
This is not ready, but it would be good to get some feedback earlier
There is no reason I guess to do this with an environment variable. On
top of that, introducing a settings also documents the netrc feature
itself (Closes #1975?).
The note was out of place in keys.conf as it's not about keyinput. Since
we have a top-level documentation for commands now, let's keep the info
in once place. People will look there anyway for the documentation of
commands they want to bind.
If the clipboard contains "-a" then "open {clipboard}" will fail because
-a gets parsed as an option. "open -- {clipboard}" doesn't do that. See
some comments in #1791.
Fixes#1060.
In the process of adding this, I also decided to rewrite
mainwindow.get_window() for clarity (and also because flake8 was warning
about complexity).
Also adds some tests to the new-instance-target mechanism, in particular
a specific test for the issue in question.
Implement `completion-item-focus next-category` and
`completion-item-focus prev-category` to jump through completions by
category rather than by item.
Resolves#1567.
I usually use my browser with a one-window-per-workspace flow. If I
click on a URL anywhere, I personally would prefer it to go to the
browser instance that's on the same workspace.
To this end, the easiest way to accomplish this is to simply track when
windows are made visible and register them as the last visible object.
(To get finer control for when you have multiple windows on the same
workspace, focus changes also update the last visible object - the
implication being here that focusing something also means you're looking
at it)
Not all users may like this behavior, so I consider it strictly optional.
Returning a defaultdict made the caller's code look confusing, as it
wasn't clear why there wouldn't be a Keyerror in some cases. Instead,
let the caller explicitly use `get`.
Various code (like src2asciidoc.py) relies on all @cmdutils.register
decorators being called when qutebrowser.app is imported.
Moving the keyconf import to _init_key_config broke that assumption, as
keyconf isn't imported anywhere anymore - which caused :bind and :unbind
to vanish from the generated documentation.
In the long run we should perhaps use venusian:
http://docs.pylonsproject.org/projects/venusian/
But for now, this is the easiest solution.
This adds the ability to open new tabs in the last-focused window
instead, which fixes#1801.
Right now the only other option is probably not that useful for human
users but it's required to make tests behave deterministically and
consistently. (But with #881 on the roadmap, I would implement this as
another choice)
To this end, also make the test framework set this option to preserve
the invariant against which existing tests are written: that spawning a
new window would effectively also focus it.
This was currently almost completely broken, yet nobody complained. The
new behavior (in the previous commit) makes this always hide the mouse
cursor, even when an input field has focus.
Since the only two easy options to implement are "never hide" and
"always hide", combined with the fact that both are sort of useless to
an end-user, just remove the option until somebody wants it back.
Changed the description for the 'hints/auto-follow-timeout', 'input/timeout' and 'input/partial-timeout' settings to specify that the time should be given in milliseconds
Completion.empty existed to fill a slot in the old Command.completions
interface if the first positional arg had no completions but the second
did, as is the case for the `bind` command. Now that
`Command.completions` is replaced by `Command.get_pos_arg_info`, this
is no longer needed.
Changes :yank's flag arguments to a positional "what" argument
specifying the object to be yanked. Including "selection" as a
possibility allows for the replacement of :yank-selected with
:yank selection.
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.
This was originally added in #868, but since then we changed the default
binding for gt (for :buffers).
It also accidentally shadowed the T binding which should be bound to
:tab-focus. See #1753.
This only affects drawing hints, JS is still used if possible to
actually click them.
It seems like for many people, the JS implementation was a lot slower
than the Python one...
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 😉
- Use the whole home row
- Produce easier chords
- 2-key chords alternate hands first (f[aoeui][dhtns])
- This is indeed a poor patch for easier chords as it should work on
every home-row, but there are not that much homerows around.
This makes it possible to switch to an alternative implementation if
there are weird issues like #1568. Some users might also prefer the
slightly better performance over more accurate hints.
Both set mode=None, then later checked if mode == 'None' and set it to
'normal'.
This reduces the function complexity just enough that pylint will stop
complaining.
Load all special keystrings (e.g. <ctrl-a>) into memory as lowercase,
and automatically lowercase any special keystring given to bind/unbind.
This prevents <ctrl-a> and <Ctrl-A> from being treated differently.
Resolves#816.
Also resolves#1544 (dupe).
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.
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.
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.
The <command> arg is now optional. If omitted, :bind prints the current
binding as a message. If --mode is given, the binding for that mode is
printed.