Respect subtopic_separator_char in more places in CmdHelp. Resolve #3612

This commit is contained in:
Griatch 2024-09-29 11:37:01 +02:00
parent 92e573692a
commit 6afe37631f
2 changed files with 7 additions and 10 deletions

View file

@ -32,6 +32,8 @@ did not add it to the handler's object (Griatch)
- [Fix][pull3625]: Lycanthropy tutorial page had some issues (feyrkh) - [Fix][pull3625]: Lycanthropy tutorial page had some issues (feyrkh)
- [Fix][pull3622]: Fix for examine command tracebacking with strvalue error - [Fix][pull3622]: Fix for examine command tracebacking with strvalue error
(aMiss-aWry) (aMiss-aWry)
- [Fix][issue3612]: Make sure help entries' `subtopic_separator_char` is
respected (Griatch)
- [Docs][issue3591]: Fix of NPC reaction tutorial code (Griatch) - [Docs][issue3591]: Fix of NPC reaction tutorial code (Griatch)
- Docs: Tutorial fixes (Griatch, aMiss-aWry, feyrkh) - Docs: Tutorial fixes (Griatch, aMiss-aWry, feyrkh)
@ -39,6 +41,7 @@ did not add it to the handler's object (Griatch)
[issue3590]: https://github.com/evennia/evennia/issues/3590 [issue3590]: https://github.com/evennia/evennia/issues/3590
[issue3556]: https://github.com/evennia/evennia/issues/3556 [issue3556]: https://github.com/evennia/evennia/issues/3556
[issue3519]: https://github.com/evennia/evennia/issues/3519 [issue3519]: https://github.com/evennia/evennia/issues/3519
[issue3612]: https://github.com/evennia/evennia/issues/3612
[pull3595]: https://github.com/evennia/evennia/pull/3595 [pull3595]: https://github.com/evennia/evennia/pull/3595
[pull3533]: https://github.com/evennia/evennia/pull/3533 [pull3533]: https://github.com/evennia/evennia/pull/3533
[pull3594]: https://github.com/evennia/evennia/pull/3594 [pull3594]: https://github.com/evennia/evennia/pull/3594

View file

@ -13,7 +13,6 @@ from dataclasses import dataclass
from itertools import chain from itertools import chain
from django.conf import settings from django.conf import settings
from evennia.help.filehelp import FILE_HELP_ENTRIES from evennia.help.filehelp import FILE_HELP_ENTRIES
from evennia.help.models import HelpEntry from evennia.help.models import HelpEntry
from evennia.help.utils import help_search_with_index, parse_entry_for_subcategories from evennia.help.utils import help_search_with_index, parse_entry_for_subcategories
@ -21,13 +20,7 @@ from evennia.locks.lockhandler import LockException
from evennia.utils import create, evmore from evennia.utils import create, evmore
from evennia.utils.ansi import ANSIString from evennia.utils.ansi import ANSIString
from evennia.utils.eveditor import EvEditor from evennia.utils.eveditor import EvEditor
from evennia.utils.utils import ( from evennia.utils.utils import class_from_module, dedent, format_grid, inherits_from, pad
class_from_module,
dedent,
format_grid,
inherits_from,
pad,
)
CMD_IGNORE_PREFIXES = settings.CMD_IGNORE_PREFIXES CMD_IGNORE_PREFIXES = settings.CMD_IGNORE_PREFIXES
COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS) COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS)
@ -477,6 +470,7 @@ class CmdHelp(COMMAND_DEFAULT_CLASS):
tuple: A tuple (match, suggestions). tuple: A tuple (match, suggestions).
""" """
def strip_prefix(query): def strip_prefix(query):
if query and query[0] in settings.CMD_IGNORE_PREFIXES: if query and query[0] in settings.CMD_IGNORE_PREFIXES:
return query[1:] return query[1:]
@ -742,7 +736,7 @@ class CmdHelp(COMMAND_DEFAULT_CLASS):
if not fuzzy_match: if not fuzzy_match:
# no match found - give up # no match found - give up
checked_topic = topic + f"/{subtopic_query}" checked_topic = topic + f"{self.subtopic_separator_char}{subtopic_query}"
output = self.format_help_entry( output = self.format_help_entry(
topic=topic, topic=topic,
help_text=f"No help entry found for '{checked_topic}'", help_text=f"No help entry found for '{checked_topic}'",
@ -757,7 +751,7 @@ class CmdHelp(COMMAND_DEFAULT_CLASS):
subtopic_map = subtopic_map.pop(subtopic_query) subtopic_map = subtopic_map.pop(subtopic_query)
subtopic_index = [subtopic for subtopic in subtopic_map if subtopic is not None] subtopic_index = [subtopic for subtopic in subtopic_map if subtopic is not None]
# keep stepping down into the tree, append path to show position # keep stepping down into the tree, append path to show position
topic = topic + f"/{subtopic_query}" topic = topic + f"{self.subtopic_separator_char}{subtopic_query}"
# we reached the bottom of the topic tree # we reached the bottom of the topic tree
help_text = subtopic_map[None] help_text = subtopic_map[None]