This commit is contained in:
Jan Knížek 2026-01-07 16:38:15 -08:00 committed by GitHub
commit f093244657
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 38 additions and 1 deletions

View File

@ -507,3 +507,29 @@ with the newest dependencies.
Alternatively, you can update your local copy of the code (e.g. by pulling the
git repo, or extracting a new version) and the virtualenv should automatically
use the updated versions. However, dependencies won't be updated that way.
Ad blocking
------------
Blocking ads in qutebrowser can be done in two ways; host-based or rules-based blocking.
Host-based blocking works by preventing a list of urls from loading
and can be turned on with a single option
(see documentation of settings for `content.blocking`).
More advanced rule based blocking uses Brave's adblocking library via
a python library `adblock`, which is an optional dependency of
qutebrowser.
Some linux distributions ship this library in official repositories,
but in general you can only get it by installing
a library `adblock` via pip, e.g. run:
`pip3 install adblock`
By default, this library is used if found and
the host-based blocking servers as a fallback.
If not, make sure blocking is on by having
`content.blocking.enabled` set to `true` and
settings `content.blocking.method` set to `auto`,
see documentation for other options.

View File

@ -90,7 +90,12 @@ class Completer(QObject):
log.completion.debug('Starting command completion')
return miscmodels.command
try:
cmd = objects.commands[before_cursor[0]]
cmdname = before_cursor[0]
if before_cursor[0] in config.cache['aliases']:
cmdname = config.cache['aliases'][before_cursor[0]].split(
maxsplit=1)[0]
cmd = objects.commands[cmdname]
except KeyError:
log.completion.debug("No completion for unknown command: {}"
.format(before_cursor[0]))

View File

@ -189,12 +189,18 @@ def _set_cmd_prompt(cmd, txt):
(':config-cycle option |', 'value', '', ['option']),
(':config-cycle option one |', 'value', '', ['option', 'one']),
(':config-cycle option one two |', 'value', '', ['option', 'one', 'two']),
(':openalias |', 'url', '', []),
(':bindalias |', None, '', []),
(':bindalias <c-x> |', 'command', '', ['<c-x>']),
(':bindalias <c-x> foo|', 'command', 'foo', ['<c-x>']),
(':bindalias <c-x>| foo', None, '<c-x>', []),
])
def test_update_completion(txt, kind, pattern, pos_args, status_command_stub,
completer_obj, completion_widget_stub, config_stub,
key_config_stub):
"""Test setting the completion widget's model based on command text."""
# this test uses | as a placeholder for the current cursor position
config_stub.val.aliases = {"bindalias": "bind", "openalias": "open -t"}
_set_cmd_prompt(status_command_stub, txt)
completer_obj.schedule_completion_update()
if kind is None: