diff --git a/doc/install.asciidoc b/doc/install.asciidoc index 1e1920196..d6194530a 100644 --- a/doc/install.asciidoc +++ b/doc/install.asciidoc @@ -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. + diff --git a/qutebrowser/completion/completer.py b/qutebrowser/completion/completer.py index 408660c3a..06be1de17 100644 --- a/qutebrowser/completion/completer.py +++ b/qutebrowser/completion/completer.py @@ -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])) diff --git a/tests/unit/completion/test_completer.py b/tests/unit/completion/test_completer.py index 5a012c634..4f43ab03d 100644 --- a/tests/unit/completion/test_completer.py +++ b/tests/unit/completion/test_completer.py @@ -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 |', 'command', '', ['']), + (':bindalias foo|', 'command', 'foo', ['']), + (':bindalias | foo', None, '', []), ]) 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: