From 6afe37631fe1e5a5a42efd741c6dde70ec6d0cb2 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 29 Sep 2024 11:37:01 +0200 Subject: [PATCH] Respect `subtopic_separator_char` in more places in CmdHelp. Resolve #3612 --- CHANGELOG.md | 3 +++ evennia/commands/default/help.py | 14 ++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c10e43f293..1ab01cc261 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,8 @@ did not add it to the handler's object (Griatch) - [Fix][pull3625]: Lycanthropy tutorial page had some issues (feyrkh) - [Fix][pull3622]: Fix for examine command tracebacking with strvalue error (aMiss-aWry) +- [Fix][issue3612]: Make sure help entries' `subtopic_separator_char` is + respected (Griatch) - [Docs][issue3591]: Fix of NPC reaction tutorial code (Griatch) - 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 [issue3556]: https://github.com/evennia/evennia/issues/3556 [issue3519]: https://github.com/evennia/evennia/issues/3519 +[issue3612]: https://github.com/evennia/evennia/issues/3612 [pull3595]: https://github.com/evennia/evennia/pull/3595 [pull3533]: https://github.com/evennia/evennia/pull/3533 [pull3594]: https://github.com/evennia/evennia/pull/3594 diff --git a/evennia/commands/default/help.py b/evennia/commands/default/help.py index 4e9b06bdde..5026e37402 100644 --- a/evennia/commands/default/help.py +++ b/evennia/commands/default/help.py @@ -13,7 +13,6 @@ from dataclasses import dataclass from itertools import chain from django.conf import settings - from evennia.help.filehelp import FILE_HELP_ENTRIES from evennia.help.models import HelpEntry 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.ansi import ANSIString from evennia.utils.eveditor import EvEditor -from evennia.utils.utils import ( - class_from_module, - dedent, - format_grid, - inherits_from, - pad, -) +from evennia.utils.utils import class_from_module, dedent, format_grid, inherits_from, pad CMD_IGNORE_PREFIXES = settings.CMD_IGNORE_PREFIXES COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS) @@ -477,6 +470,7 @@ class CmdHelp(COMMAND_DEFAULT_CLASS): tuple: A tuple (match, suggestions). """ + def strip_prefix(query): if query and query[0] in settings.CMD_IGNORE_PREFIXES: return query[1:] @@ -742,7 +736,7 @@ class CmdHelp(COMMAND_DEFAULT_CLASS): if not fuzzy_match: # 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( topic=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_index = [subtopic for subtopic in subtopic_map if subtopic is not None] # 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 help_text = subtopic_map[None]