Add :message-{info,error,warning} commands.
This commit is contained in:
parent
f93eef848c
commit
94d49b4801
@ -17,6 +17,11 @@ This project adheres to http://semver.org/[Semantic Versioning].
|
||||
v0.3.0 (unreleased)
|
||||
-------------------
|
||||
|
||||
Added
|
||||
~~~~~
|
||||
|
||||
- New commands `:message-info`, `:message-error` and `:message-warning` to show messages in the statusbar, e.g. from an userscript.
|
||||
|
||||
Changed
|
||||
~~~~~~~
|
||||
|
||||
|
@ -689,6 +689,9 @@ How many steps to zoom out.
|
||||
|<<enter-mode,enter-mode>>|Enter a key mode.
|
||||
|<<follow-hint,follow-hint>>|Follow the currently selected hint.
|
||||
|<<leave-mode,leave-mode>>|Leave the mode we're currently in.
|
||||
|<<message-error,message-error>>|Show an error message in the statusbar.
|
||||
|<<message-info,message-info>>|Show an info message in the statusbar.
|
||||
|<<message-warning,message-warning>>|Show a warning message in the statusbar.
|
||||
|<<open-editor,open-editor>>|Open an external editor with the currently selected form field.
|
||||
|<<prompt-accept,prompt-accept>>|Accept the current prompt.
|
||||
|<<prompt-no,prompt-no>>|Answer no to a yes/no prompt.
|
||||
@ -749,6 +752,33 @@ Follow the currently selected hint.
|
||||
=== leave-mode
|
||||
Leave the mode we're currently in.
|
||||
|
||||
[[message-error]]
|
||||
=== message-error
|
||||
Syntax: +:message-error 'text'+
|
||||
|
||||
Show an error message in the statusbar.
|
||||
|
||||
==== positional arguments
|
||||
* +'text'+: The text to show.
|
||||
|
||||
[[message-info]]
|
||||
=== message-info
|
||||
Syntax: +:message-info 'text'+
|
||||
|
||||
Show an info message in the statusbar.
|
||||
|
||||
==== positional arguments
|
||||
* +'text'+: The text to show.
|
||||
|
||||
[[message-warning]]
|
||||
=== message-warning
|
||||
Syntax: +:message-warning 'text'+
|
||||
|
||||
Show a warning message in the statusbar.
|
||||
|
||||
==== positional arguments
|
||||
* +'text'+: The text to show.
|
||||
|
||||
[[open-editor]]
|
||||
=== open-editor
|
||||
Open an external editor with the currently selected form field.
|
||||
|
@ -28,7 +28,7 @@ try:
|
||||
except ImportError:
|
||||
hunter = None
|
||||
|
||||
from qutebrowser.utils import log, objreg, usertypes
|
||||
from qutebrowser.utils import log, objreg, usertypes, message
|
||||
from qutebrowser.commands import cmdutils, runners, cmdexc
|
||||
from qutebrowser.config import style
|
||||
from qutebrowser.misc import consolewidget
|
||||
@ -78,6 +78,36 @@ def repeat(times: {'type': int}, command, win_id: {'special': 'win_id'}):
|
||||
commandrunner.run_safely(command)
|
||||
|
||||
|
||||
@cmdutils.register(hide=True)
|
||||
def message_error(win_id: {'special': 'win_id'}, text):
|
||||
"""Show an error message in the statusbar.
|
||||
|
||||
Args:
|
||||
text: The text to show.
|
||||
"""
|
||||
message.error(win_id, text)
|
||||
|
||||
|
||||
@cmdutils.register(hide=True)
|
||||
def message_info(win_id: {'special': 'win_id'}, text):
|
||||
"""Show an info message in the statusbar.
|
||||
|
||||
Args:
|
||||
text: The text to show.
|
||||
"""
|
||||
message.info(win_id, text)
|
||||
|
||||
|
||||
@cmdutils.register(hide=True)
|
||||
def message_warning(win_id: {'special': 'win_id'}, text):
|
||||
"""Show a warning message in the statusbar.
|
||||
|
||||
Args:
|
||||
text: The text to show.
|
||||
"""
|
||||
message.warning(win_id, text)
|
||||
|
||||
|
||||
@cmdutils.register(debug=True)
|
||||
def debug_crash(typ: {'type': ('exception', 'segfault')}='exception'):
|
||||
"""Crash for debugging purposes.
|
||||
|
Loading…
Reference in New Issue
Block a user