summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-06-14 16:19:07 +0200
committerFlorian Bruhin <me@the-compiler.org>2022-06-14 17:05:40 +0200
commit1d7b89fd0038198548c0a335d2d8676e8c5e0d9d (patch)
treea83371fa2c0dadfe857271cadc65483bc21bc786
parentd576a8d88f7141e2037137a423fc4714c4ef4e41 (diff)
downloadqutebrowser-1d7b89fd0038198548c0a335d2d8676e8c5e0d9d.tar.gz
qutebrowser-1d7b89fd0038198548c0a335d2d8676e8c5e0d9d.zip
Add --rich to :message-* commands
See #7246
-rw-r--r--doc/help/commands.asciidoc20
-rw-r--r--qutebrowser/components/misccommands.py20
2 files changed, 29 insertions, 11 deletions
diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc
index aaafa9188..d141eff0e 100644
--- a/doc/help/commands.asciidoc
+++ b/doc/help/commands.asciidoc
@@ -811,34 +811,46 @@ How many times to run the macro.
[[message-error]]
=== message-error
-Syntax: +:message-error 'text'+
+Syntax: +:message-error [*--rich*] 'text'+
Show an error message in the statusbar.
==== positional arguments
* +'text'+: The text to show.
+==== optional arguments
+* +*-r*+, +*--rich*+: Render the given text as https://doc.qt.io/qt-5/richtext-html-subset.html[Qt Rich Text].
+
+
[[message-info]]
=== message-info
-Syntax: +:message-info 'text'+
+Syntax: +:message-info [*--rich*] 'text'+
Show an info message in the statusbar.
==== positional arguments
* +'text'+: The text to show.
+==== optional arguments
+* +*-r*+, +*--rich*+: Render the given text as https://doc.qt.io/qt-5/richtext-html-subset.html[Qt Rich Text].
+
+
==== count
-How many times to show the message
+How many times to show the message.
[[message-warning]]
=== message-warning
-Syntax: +:message-warning 'text'+
+Syntax: +:message-warning [*--rich*] 'text'+
Show a warning message in the statusbar.
==== positional arguments
* +'text'+: The text to show.
+==== optional arguments
+* +*-r*+, +*--rich*+: Render the given text as https://doc.qt.io/qt-5/richtext-html-subset.html[Qt Rich Text].
+
+
[[messages]]
=== messages
Syntax: +:messages [*--plain*] [*--tab*] [*--bg*] [*--window*] [*--logfilter* 'logfilter'] ['level']+
diff --git a/qutebrowser/components/misccommands.py b/qutebrowser/components/misccommands.py
index 77b8a8948..bf9f80745 100644
--- a/qutebrowser/components/misccommands.py
+++ b/qutebrowser/components/misccommands.py
@@ -359,36 +359,42 @@ def nop() -> None:
@cmdutils.register()
-def message_error(text: str) -> None:
+def message_error(text: str, rich: bool = False) -> None:
"""Show an error message in the statusbar.
Args:
text: The text to show.
+ rich: Render the given text as
+ https://doc.qt.io/qt-5/richtext-html-subset.html[Qt Rich Text].
"""
- message.error(text)
+ message.error(text, rich=rich)
@cmdutils.register()
@cmdutils.argument('count', value=cmdutils.Value.count)
-def message_info(text: str, count: int = 1) -> None:
+def message_info(text: str, count: int = 1, rich: bool = False) -> None:
"""Show an info message in the statusbar.
Args:
text: The text to show.
- count: How many times to show the message
+ count: How many times to show the message.
+ rich: Render the given text as
+ https://doc.qt.io/qt-5/richtext-html-subset.html[Qt Rich Text].
"""
for _ in range(count):
- message.info(text)
+ message.info(text, rich=rich)
@cmdutils.register()
-def message_warning(text: str) -> None:
+def message_warning(text: str, rich: bool = False) -> None:
"""Show a warning message in the statusbar.
Args:
text: The text to show.
+ rich: Render the given text as
+ https://doc.qt.io/qt-5/richtext-html-subset.html[Qt Rich Text].
"""
- message.warning(text)
+ message.warning(text, rich=rich)
@cmdutils.register(debug=True)