diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d6da2d322..83688edb82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,9 +12,15 @@ compliance with `DefaultObject` in commands. (Griatch) - Fix: Show `XYZRoom` subclass when repr() it. (Griatch) - [Fix][pull3485]: Typo in `sethome` message (chiizujin) +- [Fix][pull3487]: Fix traceback when using `get`,`drop` and `give` with no + arguments (InspectorCaracal) +- [Fix][issue3476]: Don't ignore EvEditor commands with wrong capitalization + (Griatch) [pull3438]: https://github.com/evennia/evennia/pull/3446 [pull3485]: https://github.com/evennia/evennia/pull/3485 +[pull3487]: https://github.com/evennia/evennia/pull/3487 +[issue3476]: https://github.com/evennia/evennia/issues/3476 ## Evennia 4.1.0 diff --git a/evennia/utils/eveditor.py b/evennia/utils/eveditor.py index 04578c8be8..6175ada54f 100644 --- a/evennia/utils/eveditor.py +++ b/evennia/utils/eveditor.py @@ -44,7 +44,6 @@ import re from django.conf import settings from django.utils.translation import gettext as _ - from evennia import CmdSet from evennia.commands import cmdhandler from evennia.utils import dedent, fill, is_iter, justify, logger, to_str, utils @@ -98,7 +97,7 @@ _HELP_TEXT = _( :s - search/replace word or regex in buffer or on line :j - justify buffer or line . is f, c, l or r. Default f (full) - :f - flood-fill entire buffer or line : Equivalent to :j left + :f - flood-fill entire buffer or line . Equivalent to :j l :fi - indent entire buffer or line :fd - de-indent entire buffer or line @@ -351,6 +350,35 @@ class CmdEditorBase(_COMMAND_DEFAULT_CLASS): self.arg1 = arg1 self.arg2 = arg2 + def insert_raw_string_into_buffer(self): + """ + Insert a line into the buffer. Used by both CmdLineInput and CmdEditorGroup. + + """ + caller = self.caller + editor = caller.ndb._eveditor + buf = editor.get_buffer() + + # add a line of text to buffer + line = self.raw_string.strip("\r\n") + if editor._codefunc and editor._indent >= 0: + # if automatic indentation is active, add spaces + line = editor.deduce_indent(line, buf) + buf = line if not buf else buf + "\n%s" % line + self.editor.update_buffer(buf) + if self.editor._echo_mode: + # need to do it here or we will be off one line + cline = len(self.editor.get_buffer().split("\n")) + if editor._codefunc: + # display the current level of identation + indent = editor._indent + if indent < 0: + indent = "off" + + self.caller.msg("|b%02i|||n (|g%s|n) %s" % (cline, indent, raw(line))) + else: + self.caller.msg("|b%02i|||n %s" % (cline, raw(line))) + def _load_editor(caller): """ @@ -394,29 +422,7 @@ class CmdLineInput(CmdEditorBase): If the editor handles code, it might add automatic indentation. """ - caller = self.caller - editor = caller.ndb._eveditor - buf = editor.get_buffer() - - # add a line of text to buffer - line = self.raw_string.strip("\r\n") - if editor._codefunc and editor._indent >= 0: - # if automatic indentation is active, add spaces - line = editor.deduce_indent(line, buf) - buf = line if not buf else buf + "\n%s" % line - self.editor.update_buffer(buf) - if self.editor._echo_mode: - # need to do it here or we will be off one line - cline = len(self.editor.get_buffer().split("\n")) - if editor._codefunc: - # display the current level of identation - indent = editor._indent - if indent < 0: - indent = "off" - - self.caller.msg("|b%02i|||n (|g%s|n) %s" % (cline, indent, raw(line))) - else: - self.caller.msg("|b%02i|||n %s" % (cline, raw(line))) + self.insert_raw_string_into_buffer() class CmdEditorGroup(CmdEditorBase): @@ -801,6 +807,9 @@ class CmdEditorGroup(CmdEditorBase): caller.msg(_("Auto-indentation turned off.")) else: caller.msg(_("This command is only available in code editor mode.")) + else: + # no match - insert as line in buffer + self.insert_raw_string_into_buffer() class EvEditorCmdSet(CmdSet):