Add text_kwargs support to EvMore.msg. Resolve #3273

This commit is contained in:
Griatch 2023-09-23 23:07:19 +02:00
parent 808bde0c7c
commit 0f9d2beb09
4 changed files with 28 additions and 8 deletions

View file

@ -101,11 +101,12 @@ class CmdHelp(COMMAND_DEFAULT_CLASS):
# should topics disply their help entry when clicked
clickable_topics = HELP_CLICKABLE_TOPICS
def msg_help(self, text):
def msg_help(self, text, **kwargs):
"""
messages text to the caller, adding an extra oob argument to indicate
that this is a help command result and could be rendered in a separate
help window
help window.
"""
if type(self).help_more:
usemore = True
@ -122,7 +123,11 @@ class CmdHelp(COMMAND_DEFAULT_CLASS):
pass
if usemore:
evmore.msg(self.caller, text, session=self.session)
# adding the 'text_kwargs' keyword means it will be sent with the text outputfunc
# for every page.
evmore.msg(
self.caller, text, session=self.session, text_kwargs={"type": "help"}, **kwargs
)
return
self.msg(text=(text, {"type": "help"}))
@ -685,7 +690,6 @@ class CmdHelp(COMMAND_DEFAULT_CLASS):
# the subtopics is a list describing the path through the subtopic_map.
for subtopic_query in subtopics:
if subtopic_query not in subtopic_map:
# exact match failed. Try startswith-match
fuzzy_match = False