From 827de1743d328b50778ea9b52bc5401a5c44419a Mon Sep 17 00:00:00 2001 From: Jan Verbeek Date: Thu, 4 Aug 2016 13:21:19 +0200 Subject: [PATCH] Document no_replace_variables, misc fixes Add no_replace_variables to the asciidoc, improve its description in the decorator, remove now unnecessary argument parsing in set-cmd-text --- doc/help/commands.asciidoc | 4 ++++ qutebrowser/commands/command.py | 2 +- qutebrowser/mainwindow/statusbar/command.py | 3 --- scripts/dev/src2asciidoc.py | 4 +++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index 9835f1a3f..cbb81235d 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -111,6 +111,7 @@ Bind a key to a command. ==== note * This command does not split arguments after the last argument and handles quotes literally. * With this command, +;;+ is interpreted literally instead of splitting off a second command. +* This command does not replace variables like +\{url\}+. [[bookmark-add]] === bookmark-add @@ -412,6 +413,7 @@ Execute a command after some time. ==== note * This command does not split arguments after the last argument and handles quotes literally. * With this command, +;;+ is interpreted literally instead of splitting off a second command. +* This command does not replace variables like +\{url\}+. [[messages]] === messages @@ -579,6 +581,7 @@ Repeat a given command. ==== note * This command does not split arguments after the last argument and handles quotes literally. * With this command, +;;+ is interpreted literally instead of splitting off a second command. +* This command does not replace variables like +\{url\}+. [[report]] === report @@ -714,6 +717,7 @@ Note the `{url}` and `{url:pretty}` variables might be useful here. `{url}` gets ==== note * This command does not split arguments after the last argument and handles quotes literally. +* This command does not replace variables like +\{url\}+. [[stop]] === stop diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py index c06afe646..e49c497af 100644 --- a/qutebrowser/commands/command.py +++ b/qutebrowser/commands/command.py @@ -82,7 +82,7 @@ class Command: no_cmd_split: If true, ';;' to split sub-commands is ignored. backend: Which backend the command works with (or None if it works with both) - no_replace_variables: Whether or not to replace variables like {url} + no_replace_variables: Don't replace variables like {url} _qute_args: The saved data from @cmdutils.argument _needs_js: Whether the command needs javascript enabled _modes: The modes the command can be executed in. diff --git a/qutebrowser/mainwindow/statusbar/command.py b/qutebrowser/mainwindow/statusbar/command.py index 781df81ad..62a01ef32 100644 --- a/qutebrowser/mainwindow/statusbar/command.py +++ b/qutebrowser/mainwindow/statusbar/command.py @@ -108,9 +108,6 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit): space: If given, a space is added to the end. append: If given, the text is appended to the current text. """ - args = split.simple_split(text) - text = ' '.join(args) - if space: text += ' ' if append: diff --git a/scripts/dev/src2asciidoc.py b/scripts/dev/src2asciidoc.py index af1ba0936..5d7819ea0 100755 --- a/scripts/dev/src2asciidoc.py +++ b/scripts/dev/src2asciidoc.py @@ -239,7 +239,7 @@ def _get_command_doc_notes(cmd): Yield: Strings which should be added to the docs. """ - if cmd.maxsplit is not None or cmd.no_cmd_split: + if cmd.maxsplit is not None or cmd.no_cmd_split or cmd.no_replace_variables: yield "" yield "==== note" if cmd.maxsplit is not None: @@ -248,6 +248,8 @@ def _get_command_doc_notes(cmd): if cmd.no_cmd_split: yield ("* With this command, +;;+ is interpreted literally " "instead of splitting off a second command.") + if cmd.no_replace_variables: + yield "* This command does not replace variables like +\{url\}+." def _get_action_metavar(action, nargs=1):