Add --append argument to :set-cmd-text.
This commit is contained in:
parent
cd25a25c96
commit
7701bf602a
@ -48,6 +48,8 @@ Added
|
|||||||
* `colors -> downloads.bg.system`
|
* `colors -> downloads.bg.system`
|
||||||
- New command `:download-retry` to retry a failed download.
|
- New command `:download-retry` to retry a failed download.
|
||||||
- New command `:download-clear` which replaces `:download-remove --all`.
|
- New command `:download-clear` which replaces `:download-remove --all`.
|
||||||
|
- `:set-cmd-text` has a new `--append` argument to append to the current
|
||||||
|
statusbar text.
|
||||||
|
|
||||||
Changed
|
Changed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -571,7 +571,7 @@ If the option name ends with '?', the value of the option is shown instead. If t
|
|||||||
|
|
||||||
[[set-cmd-text]]
|
[[set-cmd-text]]
|
||||||
=== set-cmd-text
|
=== set-cmd-text
|
||||||
Syntax: +:set-cmd-text [*--space*] 'text'+
|
Syntax: +:set-cmd-text [*--space*] [*--append*] 'text'+
|
||||||
|
|
||||||
Preset the statusbar to some text.
|
Preset the statusbar to some text.
|
||||||
|
|
||||||
@ -580,6 +580,7 @@ Preset the statusbar to some text.
|
|||||||
|
|
||||||
==== optional arguments
|
==== optional arguments
|
||||||
* +*-s*+, +*--space*+: If given, a space is added to the end.
|
* +*-s*+, +*--space*+: If given, a space is added to the end.
|
||||||
|
* +*-a*+, +*--append*+: If given, the text is appended to the current text.
|
||||||
|
|
||||||
==== note
|
==== note
|
||||||
* This command does not split arguments after the last argument and handles quotes literally.
|
* This command does not split arguments after the last argument and handles quotes literally.
|
||||||
|
@ -92,7 +92,7 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
|
|||||||
|
|
||||||
@cmdutils.register(instance='status-command', name='set-cmd-text',
|
@cmdutils.register(instance='status-command', name='set-cmd-text',
|
||||||
scope='window', maxsplit=0)
|
scope='window', maxsplit=0)
|
||||||
def set_cmd_text_command(self, text, space=False):
|
def set_cmd_text_command(self, text, space=False, append=False):
|
||||||
"""Preset the statusbar to some text.
|
"""Preset the statusbar to some text.
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -103,6 +103,7 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
|
|||||||
Args:
|
Args:
|
||||||
text: The commandline to set.
|
text: The commandline to set.
|
||||||
space: If given, a space is added to the end.
|
space: If given, a space is added to the end.
|
||||||
|
append: If given, the text is appended to the current text.
|
||||||
"""
|
"""
|
||||||
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||||
window=self._win_id)
|
window=self._win_id)
|
||||||
@ -122,8 +123,14 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
|
|||||||
# I'm not sure what's the best thing to do here
|
# I'm not sure what's the best thing to do here
|
||||||
# https://github.com/The-Compiler/qutebrowser/issues/123
|
# https://github.com/The-Compiler/qutebrowser/issues/123
|
||||||
text = text.replace('{url}', url)
|
text = text.replace('{url}', url)
|
||||||
|
|
||||||
if space:
|
if space:
|
||||||
text += ' '
|
text += ' '
|
||||||
|
if append:
|
||||||
|
if not self.text():
|
||||||
|
raise cmdexc.CommandError("No current text!")
|
||||||
|
text = self.text() + text
|
||||||
|
|
||||||
if not text or text[0] not in modeparsers.STARTCHARS:
|
if not text or text[0] not in modeparsers.STARTCHARS:
|
||||||
raise cmdexc.CommandError(
|
raise cmdexc.CommandError(
|
||||||
"Invalid command text '{}'.".format(text))
|
"Invalid command text '{}'.".format(text))
|
||||||
|
Loading…
Reference in New Issue
Block a user