Do not skip wrongly capitalized EvEditor commands. Resolve #3476
This commit is contained in:
parent
ccd6b365e9
commit
50d8ae2f54
2 changed files with 40 additions and 25 deletions
|
|
@ -12,9 +12,15 @@
|
||||||
compliance with `DefaultObject` in commands. (Griatch)
|
compliance with `DefaultObject` in commands. (Griatch)
|
||||||
- Fix: Show `XYZRoom` subclass when repr() it. (Griatch)
|
- Fix: Show `XYZRoom` subclass when repr() it. (Griatch)
|
||||||
- [Fix][pull3485]: Typo in `sethome` message (chiizujin)
|
- [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
|
[pull3438]: https://github.com/evennia/evennia/pull/3446
|
||||||
[pull3485]: https://github.com/evennia/evennia/pull/3485
|
[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
|
## Evennia 4.1.0
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ import re
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from evennia import CmdSet
|
from evennia import CmdSet
|
||||||
from evennia.commands import cmdhandler
|
from evennia.commands import cmdhandler
|
||||||
from evennia.utils import dedent, fill, is_iter, justify, logger, to_str, utils
|
from evennia.utils import dedent, fill, is_iter, justify, logger, to_str, utils
|
||||||
|
|
@ -98,7 +97,7 @@ _HELP_TEXT = _(
|
||||||
:s <l> <w> <txt> - search/replace word or regex <w> in buffer or on line <l>
|
:s <l> <w> <txt> - search/replace word or regex <w> in buffer or on line <l>
|
||||||
|
|
||||||
:j <l> <w> - justify buffer or line <l>. <w> is f, c, l or r. Default f (full)
|
:j <l> <w> - justify buffer or line <l>. <w> is f, c, l or r. Default f (full)
|
||||||
:f <l> - flood-fill entire buffer or line <l>: Equivalent to :j left
|
:f <l> - flood-fill entire buffer or line <l>. Equivalent to :j <l> l
|
||||||
:fi <l> - indent entire buffer or line <l>
|
:fi <l> - indent entire buffer or line <l>
|
||||||
:fd <l> - de-indent entire buffer or line <l>
|
:fd <l> - de-indent entire buffer or line <l>
|
||||||
|
|
||||||
|
|
@ -351,6 +350,35 @@ class CmdEditorBase(_COMMAND_DEFAULT_CLASS):
|
||||||
self.arg1 = arg1
|
self.arg1 = arg1
|
||||||
self.arg2 = arg2
|
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):
|
def _load_editor(caller):
|
||||||
"""
|
"""
|
||||||
|
|
@ -394,29 +422,7 @@ class CmdLineInput(CmdEditorBase):
|
||||||
If the editor handles code, it might add automatic
|
If the editor handles code, it might add automatic
|
||||||
indentation.
|
indentation.
|
||||||
"""
|
"""
|
||||||
caller = self.caller
|
self.insert_raw_string_into_buffer()
|
||||||
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)))
|
|
||||||
|
|
||||||
|
|
||||||
class CmdEditorGroup(CmdEditorBase):
|
class CmdEditorGroup(CmdEditorBase):
|
||||||
|
|
@ -801,6 +807,9 @@ class CmdEditorGroup(CmdEditorBase):
|
||||||
caller.msg(_("Auto-indentation turned off."))
|
caller.msg(_("Auto-indentation turned off."))
|
||||||
else:
|
else:
|
||||||
caller.msg(_("This command is only available in code editor mode."))
|
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):
|
class EvEditorCmdSet(CmdSet):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue