Fix :UU and :UU usage in EvEditor. Resolve #3262

This commit is contained in:
Griatch 2024-04-01 14:05:45 +02:00
parent 0c072dab02
commit 763699ea14
5 changed files with 84 additions and 82 deletions

View file

@ -11,7 +11,9 @@
from in-game with default command (chiizujin) from in-game with default command (chiizujin)
- [Feature][issue3450]: The default `page` command now tags its `Msg` objects - [Feature][issue3450]: The default `page` command now tags its `Msg` objects
with tag 'page' (category 'comms') and also checks the `Msg`' 'read' lock. with tag 'page' (category 'comms') and also checks the `Msg`' 'read' lock.
made backwards compatible for old pages. made backwards compatible for old pages (Griatch)
- Feature: Clean up the default Command variable list shown when a command has
no `func()` defined (Griatch)
- [Fix][pull3446]: Use plural ('no apples') instead of singular ('no apple') in - [Fix][pull3446]: Use plural ('no apples') instead of singular ('no apple') in
`get_numbered_name` for better grammatical form (InspectorCaracal) `get_numbered_name` for better grammatical form (InspectorCaracal)
- [Fix][pull3453]: Object aliases not showing in search multi-match - [Fix][pull3453]: Object aliases not showing in search multi-match
@ -29,6 +31,8 @@
way (chiizujin) way (chiizujin)
- [Fix][pull3464]: EvEditor range:range specification didn't return correct - [Fix][pull3464]: EvEditor range:range specification didn't return correct
range (chiizujin) range (chiizujin)
- [Fix][issue3462]: EvEditor :UU and :DD etc commands were not properly
differentiating from their lower-case alternatives (Griatch)
- Doc: Added Beginner Tutorial lessons for AI, Quests and Procedural dungeon (Griatch) - Doc: Added Beginner Tutorial lessons for AI, Quests and Procedural dungeon (Griatch)
- Doc fixes (Griatch, InspectorCaracal) - Doc fixes (Griatch, InspectorCaracal)
@ -45,6 +49,7 @@
[pull3464]: https://github.com/evennia/evennia/pull/3464 [pull3464]: https://github.com/evennia/evennia/pull/3464
[pull3467]: https://github.com/evennia/evennia/pull/3467 [pull3467]: https://github.com/evennia/evennia/pull/3467
[issue3450]: https://github.com/evennia/evennia/issues/3450 [issue3450]: https://github.com/evennia/evennia/issues/3450
[issue3462]: https://github.com/evennia/evennia/issues/3462
## Evennia 4.0.0 ## Evennia 4.0.0

View file

@ -36,14 +36,13 @@ from weakref import WeakValueDictionary
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 twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet.task import deferLater
from evennia.commands.cmdset import CmdSet from evennia.commands.cmdset import CmdSet
from evennia.commands.command import InterruptCommand from evennia.commands.command import InterruptCommand
from evennia.utils import logger, utils from evennia.utils import logger, utils
from evennia.utils.utils import string_suggestions from evennia.utils.utils import string_suggestions
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet.task import deferLater
_IN_GAME_ERRORS = settings.IN_GAME_ERRORS _IN_GAME_ERRORS = settings.IN_GAME_ERRORS

View file

@ -11,7 +11,6 @@ import re
from django.conf import settings from django.conf import settings
from django.urls import reverse from django.urls import reverse
from django.utils.text import slugify from django.utils.text import slugify
from evennia.locks.lockhandler import LockHandler from evennia.locks.lockhandler import LockHandler
from evennia.utils.ansi import ANSIString from evennia.utils.ansi import ANSIString
from evennia.utils.evtable import EvTable from evennia.utils.evtable import EvTable
@ -20,6 +19,7 @@ from evennia.utils.utils import fill, is_iter, lazy_property, make_iter
CMD_IGNORE_PREFIXES = settings.CMD_IGNORE_PREFIXES CMD_IGNORE_PREFIXES = settings.CMD_IGNORE_PREFIXES
class InterruptCommand(Exception): class InterruptCommand(Exception):
"""Cleanly interrupt a command.""" """Cleanly interrupt a command."""
@ -487,31 +487,29 @@ class Command(metaclass=CommandMeta):
purposes when making commands. purposes when making commands.
""" """
variables = "\n".join( output_string = """
" |w{}|n ({}): {}".format(key, type(val), val) for key, val in self.__dict__.items() Command \"{cmdname}\" has no defined `func()` method. Available properties on this command are:
)
string = f"""
Command {self} has no defined `func()` - showing on-command variables:
{variables}
"""
# a simple test command to show the available properties
string += "-" * 50
string += "\n|w%s|n - Command variables from evennia:\n" % self.key
string += "-" * 50
string += "\nname of cmd (self.key): |w%s|n\n" % self.key
string += "cmd aliases (self.aliases): |w%s|n\n" % self.aliases
string += "cmd locks (self.locks): |w%s|n\n" % self.locks
string += "help category (self.help_category): |w%s|n\n" % self.help_category.capitalize()
string += "object calling (self.caller): |w%s|n\n" % self.caller
string += "object storing cmdset (self.obj): |w%s|n\n" % self.obj
string += "command string given (self.cmdstring): |w%s|n\n" % self.cmdstring
# show cmdset.key instead of cmdset to shorten output
string += fill(
"current cmdset (self.cmdset): |w%s|n\n"
% (self.cmdset.key if self.cmdset.key else self.cmdset.__class__)
)
self.msg(string) {variables}"""
variables = [" |w{}|n ({}): {}".format(
key, type(val), f'"{val}"' if isinstance(val, str) else val
)
for key, val in
(("self.key", self.key),
("self.cmdname", self.cmdstring),
("self.raw_cmdname", self.raw_cmdname),
("self.raw_string", self.raw_string),
("self.aliases", self.aliases),
("self.args", self.args),
("self.caller", self.caller),
("self.obj", self.obj),
("self.session", self.session),
("self.locks", self.locks),
("self.help_category", self.help_category),
("self.cmdset", self.cmdset))
]
output = output_string.format(cmdname=self.key, variables="\n ".join(variables))
self.msg(output)
def func(self): def func(self):
""" """

View file

@ -43,7 +43,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
@ -468,7 +467,8 @@ class CmdEditorGroup(CmdEditorBase):
linebuffer = self.linebuffer linebuffer = self.linebuffer
lstart, lend = self.lstart, self.lend lstart, lend = self.lstart, self.lend
cmd = self.cmdstring # preserve the cmdname including case (otherwise uu and UU would be the same)
cmd = self.raw_string[:len(self.cmdstring)]
echo_mode = self.editor._echo_mode echo_mode = self.editor._echo_mode
if cmd == ":": if cmd == ":":

View file

@ -13,7 +13,7 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":", raw_string=":",
msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)", msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)",
) )
self.call(eveditor.CmdLineInput(), "line 1", raw_string="line 1", msg="01line 1") self.call(eveditor.CmdLineInput(), "line 1", raw_string="line 1", msg="01line 1")
@ -24,7 +24,7 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", # list whole buffer "", # list whole buffer
cmdstring=":", raw_string=":",
msg="Line Editor []\n01line 1\n02line 2\n" msg="Line Editor []\n01line 1\n02line 2\n"
"03line 3\n04line 4\n05line 5\n" "03line 3\n04line 4\n05line 5\n"
"[l:05 w:010 c:0034](:h for help)", "[l:05 w:010 c:0034](:h for help)",
@ -32,7 +32,7 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
":", # list empty range ":", # list empty range
cmdstring=":", raw_string=":",
msg="Line Editor []\n01line 1\n02line 2\n" msg="Line Editor []\n01line 1\n02line 2\n"
"03line 3\n04line 4\n05line 5\n" "03line 3\n04line 4\n05line 5\n"
"[l:05 w:010 c:0034](:h for help)", "[l:05 w:010 c:0034](:h for help)",
@ -40,7 +40,7 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
":4", # list from start to line 4 ":4", # list from start to line 4
cmdstring=":", raw_string=":",
msg="Line Editor []\n01line 1\n02line 2\n" msg="Line Editor []\n01line 1\n02line 2\n"
"03line 3\n04line 4\n" "03line 3\n04line 4\n"
"[l:04 w:008 c:0027](:h for help)", "[l:04 w:008 c:0027](:h for help)",
@ -48,7 +48,7 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"2:", # list from line 2 to end "2:", # list from line 2 to end
cmdstring=":", raw_string=":",
msg="Line Editor []\n02line 2\n03line 3\n" msg="Line Editor []\n02line 2\n03line 3\n"
"04line 4\n05line 5\n" "04line 4\n05line 5\n"
"[l:04 w:008 c:0027](:h for help)", "[l:04 w:008 c:0027](:h for help)",
@ -56,7 +56,7 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"-10:10", # try to list invalid range (too large) "-10:10", # try to list invalid range (too large)
cmdstring=":", raw_string=":",
msg="Line Editor []\n01line 1\n02line 2\n" msg="Line Editor []\n01line 1\n02line 2\n"
"03line 3\n04line 4\n05line 5\n" "03line 3\n04line 4\n05line 5\n"
"[l:05 w:010 c:0034](:h for help)", "[l:05 w:010 c:0034](:h for help)",
@ -64,7 +64,7 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"3:1", # try to list invalid range (reversed) "3:1", # try to list invalid range (reversed)
cmdstring=":", raw_string=":",
msg="Line Editor []\n03line 3\n" msg="Line Editor []\n03line 3\n"
"[l:01 w:002 c:0006](:h for help)", "[l:01 w:002 c:0006](:h for help)",
) )
@ -74,14 +74,14 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":h", raw_string=":h",
msg="<txt> - any non-command is appended to the end of the buffer.", msg="<txt> - any non-command is appended to the end of the buffer.",
) )
# empty buffer # empty buffer
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":", raw_string=":",
msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)", msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)",
) )
# input a string # input a string
@ -102,49 +102,49 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":", # view buffer raw_string=":", # view buffer
msg="Line Editor []\n01First test line\n" msg="Line Editor []\n01First test line\n"
"02Second test line\n[l:02 w:006 c:0032](:h for help)", "02Second test line\n[l:02 w:006 c:0032](:h for help)",
) )
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring="::", # view buffer, no linenums raw_string="::", # view buffer, no linenums
msg="Line Editor []\nFirst test line\n" msg="Line Editor []\nFirst test line\n"
"Second test line\n[l:02 w:006 c:0032](:h for help)", "Second test line\n[l:02 w:006 c:0032](:h for help)",
) )
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":::", # add single : alone on row raw_string=":::", # add single : alone on row
msg="Single ':' added to buffer.", msg="Single ':' added to buffer.",
) )
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":", raw_string=":",
msg="Line Editor []\n01First test line\n" msg="Line Editor []\n01First test line\n"
"02Second test line\n03:\n[l:03 w:007 c:0034](:h for help)", "02Second test line\n03:\n[l:03 w:007 c:0034](:h for help)",
) )
self.call( self.call(
eveditor.CmdEditorGroup(), "", cmdstring=":dd", msg="Deleted line 3." # delete line eveditor.CmdEditorGroup(), "", raw_string=":dd", msg="Deleted line 3." # delete line
) )
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "First test line\nSecond test line") self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "First test line\nSecond test line")
self.call(eveditor.CmdEditorGroup(), "", cmdstring=":u", msg="Undid one step.") # undo self.call(eveditor.CmdEditorGroup(), "", raw_string=":u", msg="Undid one step.") # undo
self.assertEqual( self.assertEqual(
self.char1.ndb._eveditor.get_buffer(), "First test line\nSecond test line\n:" self.char1.ndb._eveditor.get_buffer(), "First test line\nSecond test line\n:"
) )
self.call(eveditor.CmdEditorGroup(), "", cmdstring=":uu", msg="Redid one step.") # redo self.call(eveditor.CmdEditorGroup(), "", raw_string=":uu", msg="Redid one step.") # redo
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "First test line\nSecond test line") self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "First test line\nSecond test line")
self.call(eveditor.CmdEditorGroup(), "", cmdstring=":u", msg="Undid one step.") # undo self.call(eveditor.CmdEditorGroup(), "", raw_string=":u", msg="Undid one step.") # undo
self.assertEqual( self.assertEqual(
self.char1.ndb._eveditor.get_buffer(), "First test line\nSecond test line\n:" self.char1.ndb._eveditor.get_buffer(), "First test line\nSecond test line\n:"
) )
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":", raw_string=":",
msg="Line Editor []\n01First test line\n" msg="Line Editor []\n01First test line\n"
"02Second test line\n03:\n[l:03 w:007 c:0034](:h for help)", "02Second test line\n03:\n[l:03 w:007 c:0034](:h for help)",
) )
@ -152,31 +152,31 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"Second", "Second",
cmdstring=":dw", # delete by word raw_string=":dw", # delete by word
msg="Removed Second for lines 1-4.", msg="Removed Second for lines 1-4.",
) )
self.call(eveditor.CmdEditorGroup(), "", cmdstring=":u", msg="Undid one step.") # undo self.call(eveditor.CmdEditorGroup(), "", raw_string=":u", msg="Undid one step.") # undo
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"2 Second", "2 Second",
cmdstring=":dw", # delete by word/line raw_string=":dw", # delete by word/line
msg="Removed Second for line 2.", msg="Removed Second for line 2.",
) )
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "First test line\n test line\n:") self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "First test line\n test line\n:")
self.call( self.call(
eveditor.CmdEditorGroup(), "2", cmdstring=":p", msg="Copy buffer is empty." # paste eveditor.CmdEditorGroup(), "2", raw_string=":p", msg="Copy buffer is empty." # paste
) )
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"2", "2",
cmdstring=":y", # yank raw_string=":y", # yank
msg="Line 2, [' test line'] yanked.", msg="Line 2, [' test line'] yanked.",
) )
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"2", "2",
cmdstring=":p", # paste raw_string=":p", # paste
msg="Pasted buffer [' test line'] to line 2.", msg="Pasted buffer [' test line'] to line 2.",
) )
self.assertEqual( self.assertEqual(
@ -184,31 +184,31 @@ class TestEvEditor(BaseEvenniaCommandTest):
) )
self.call( self.call(
eveditor.CmdEditorGroup(), "3", cmdstring=":x", msg="Line 3, [' test line'] cut." # cut eveditor.CmdEditorGroup(), "3", raw_string=":x", msg="Line 3, [' test line'] cut." # cut
) )
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"2 New Second line", "2 New Second line",
cmdstring=":i", # insert raw_string=":i", # insert
msg="Inserted 1 new line(s) at line 2.", msg="Inserted 1 new line(s) at line 2.",
) )
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"2 New Replaced Second line", # replace "2 New Replaced Second line", # replace
cmdstring=":r", raw_string=":r",
msg="Replaced 1 line(s) at line 2.", msg="Replaced 1 line(s) at line 2.",
) )
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"2 Inserted-", # insert beginning line "2 Inserted-", # insert beginning line
cmdstring=":I", raw_string=":I",
msg="Inserted text at beginning of line 2.", msg="Inserted text at beginning of line 2.",
) )
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"2 -End", # append end line "2 -End", # append end line
cmdstring=":A", raw_string=":A",
msg="Appended text to end of line 2.", msg="Appended text to end of line 2.",
) )
@ -229,7 +229,7 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":", raw_string=":",
msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)", msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)",
) )
self.call( self.call(
@ -250,7 +250,7 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":UU", raw_string=":UU",
msg="Reverted all changes to the buffer back to original state.", msg="Reverted all changes to the buffer back to original state.",
) )
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "") self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "")
@ -260,7 +260,7 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":", raw_string=":",
msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)", msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)",
) )
self.call(eveditor.CmdLineInput(), "line 1.", raw_string="line 1.", msg="01line 1.") self.call(eveditor.CmdLineInput(), "line 1.", raw_string="line 1.", msg="01line 1.")
@ -269,20 +269,20 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"2:3", "2:3",
cmdstring=":", raw_string=":",
msg="Line Editor []\n02line 2.\n03line 3.\n[l:02 w:004 c:0015](:h for help)", msg="Line Editor []\n02line 2.\n03line 3.\n[l:02 w:004 c:0015](:h for help)",
) )
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"1:2 line LINE", "1:2 line LINE",
cmdstring=":s", raw_string=":s",
msg="Search-replaced line -> LINE for lines 1-2.", msg="Search-replaced line -> LINE for lines 1-2.",
) )
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "LINE 1.\nLINE 2.\nline 3.") self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "LINE 1.\nLINE 2.\nline 3.")
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"line MINE", "line MINE",
cmdstring=":s", raw_string=":s",
msg="Search-replaced line -> MINE for lines 1-3.", msg="Search-replaced line -> MINE for lines 1-3.",
) )
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "LINE 1.\nLINE 2.\nMINE 3.") self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "LINE 1.\nLINE 2.\nMINE 3.")
@ -292,14 +292,14 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":", raw_string=":",
msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)", msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)",
) )
self.call(eveditor.CmdLineInput(), "line 1.", raw_string="line 1.", msg="01line 1.") self.call(eveditor.CmdLineInput(), "line 1.", raw_string="line 1.", msg="01line 1.")
self.call(eveditor.CmdLineInput(), "line 2.", raw_string="line 2.", msg="02line 2.") self.call(eveditor.CmdLineInput(), "line 2.", raw_string="line 2.", msg="02line 2.")
self.call(eveditor.CmdLineInput(), "line 3.", raw_string="line 3.", msg="03line 3.") self.call(eveditor.CmdLineInput(), "line 3.", raw_string="line 3.", msg="03line 3.")
self.call( self.call(
eveditor.CmdEditorGroup(), "", cmdstring=":DD", msg="Cleared 3 lines from buffer." eveditor.CmdEditorGroup(), "", raw_string=":DD", msg="Cleared 3 lines from buffer."
) )
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "") self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "")
@ -308,11 +308,11 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":", raw_string=":",
msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)", msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)",
) )
self.call(eveditor.CmdLineInput(), "line 1", raw_string="line 1", msg="01line 1") self.call(eveditor.CmdLineInput(), "line 1", raw_string="line 1", msg="01line 1")
self.call(eveditor.CmdEditorGroup(), "1:2", cmdstring=":f", msg="Flood filled line 1.") self.call(eveditor.CmdEditorGroup(), "1:2", raw_string=":f", msg="Flood filled line 1.")
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "line 1") self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "line 1")
def test_eveditor_COLON_J(self): def test_eveditor_COLON_J(self):
@ -320,16 +320,16 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":", raw_string=":",
msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)", msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)",
) )
self.call(eveditor.CmdLineInput(), "line 1", raw_string="line 1", msg="01line 1") self.call(eveditor.CmdLineInput(), "line 1", raw_string="line 1", msg="01line 1")
self.call(eveditor.CmdLineInput(), "l 2", raw_string="l 2", msg="02l 2") self.call(eveditor.CmdLineInput(), "l 2", raw_string="l 2", msg="02l 2")
self.call(eveditor.CmdLineInput(), "l 3", raw_string="l 3", msg="03l 3") self.call(eveditor.CmdLineInput(), "l 3", raw_string="l 3", msg="03l 3")
self.call(eveditor.CmdLineInput(), "l 4", raw_string="l 4", msg="04l 4") self.call(eveditor.CmdLineInput(), "l 4", raw_string="l 4", msg="04l 4")
self.call(eveditor.CmdEditorGroup(), "2 r", cmdstring=":j", msg="Right-justified line 2.") self.call(eveditor.CmdEditorGroup(), "2 r", raw_string=":j", msg="Right-justified line 2.")
self.call(eveditor.CmdEditorGroup(), "3 c", cmdstring=":j", msg="Center-justified line 3.") self.call(eveditor.CmdEditorGroup(), "3 c", raw_string=":j", msg="Center-justified line 3.")
self.call(eveditor.CmdEditorGroup(), "4 f", cmdstring=":j", msg="Full-justified line 4.") self.call(eveditor.CmdEditorGroup(), "4 f", raw_string=":j", msg="Full-justified line 4.")
l1, l2, l3, l4 = tuple(self.char1.ndb._eveditor.get_buffer().split("\n")) l1, l2, l3, l4 = tuple(self.char1.ndb._eveditor.get_buffer().split("\n"))
self.assertEqual(l1, "line 1") self.assertEqual(l1, "line 1")
self.assertEqual(l2, " " * 75 + "l 2") self.assertEqual(l2, " " * 75 + "l 2")
@ -341,44 +341,44 @@ class TestEvEditor(BaseEvenniaCommandTest):
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":", raw_string=":",
msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)", msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)",
) )
self.call(eveditor.CmdLineInput(), "line 1.", raw_string="line 1.", msg="01line 1.") self.call(eveditor.CmdLineInput(), "line 1.", raw_string="line 1.", msg="01line 1.")
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":dw", raw_string=":dw",
msg="You must give a search word to delete.", msg="You must give a search word to delete.",
) )
# self.call( # self.call(
# eveditor.CmdEditorGroup(), # eveditor.CmdEditorGroup(),
# raw_string="", # raw_string="",
# cmdstring=":i", # raw_string=":i",
# msg="You need to enter a new line and where to insert it.", # msg="You need to enter a new line and where to insert it.",
# ) # )
# self.call( # self.call(
# eveditor.CmdEditorGroup(), # eveditor.CmdEditorGroup(),
# "", # "",
# cmdstring=":I", # raw_string=":I",
# msg="You need to enter text to insert.", # msg="You need to enter text to insert.",
# ) # )
# self.call( # self.call(
# eveditor.CmdEditorGroup(), # eveditor.CmdEditorGroup(),
# "", # "",
# cmdstring=":r", # raw_string=":r",
# msg="You need to enter a replacement string.", # msg="You need to enter a replacement string.",
# ) # )
self.call( self.call(
eveditor.CmdEditorGroup(), eveditor.CmdEditorGroup(),
"", "",
cmdstring=":s", raw_string=":s",
msg="You must give a search word and something to replace it with.", msg="You must give a search word and something to replace it with.",
) )
# self.call( # self.call(
# eveditor.CmdEditorGroup(), # eveditor.CmdEditorGroup(),
# "", # "",
# cmdstring=":f", # raw_string=":f",
# msg="Valid justifications are [f]ull (default), [c]enter, [r]right or [l]eft" # msg="Valid justifications are [f]ull (default), [c]enter, [r]right or [l]eft"
# ) # )
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "line 1.") self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "line 1.")