From 1d7b89fd0038198548c0a335d2d8676e8c5e0d9d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 14 Jun 2022 16:19:07 +0200 Subject: Add --rich to :message-* commands See #7246 --- doc/help/commands.asciidoc | 20 ++++++++++++++++---- qutebrowser/components/misccommands.py | 20 +++++++++++++------- 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) -- cgit v1.2.3-54-g00ecf