OSDN Git Service

Minor UI bugs.
authorSimon Forman <sforman@hushmail.com>
Sun, 22 Jul 2018 18:53:02 +0000 (11:53 -0700)
committerSimon Forman <sforman@hushmail.com>
Sun, 22 Jul 2018 18:53:02 +0000 (11:53 -0700)
I should nail this down better.  Command selections like ' []' were
failing to evaluate.

joy/gui/world.py

index 4b7ceb7..4fe4514 100644 (file)
@@ -91,10 +91,8 @@ class World(object):
       return self.stack[0]
 
   def interpret(self, command):
-    if len(command.split()) == 1 and not is_numerical(command):
-      assert self.has(command), repr(command)
-      if self.check(command) == False:  # not in {True, None}:
-        return
+    if self.has(command) and self.check(command) == False:  # not in {True, None}:
+      return
     old_stack = self.stack
     try:
       self.stack, _, self.dictionary = run(
@@ -132,14 +130,11 @@ class StackDisplayWorld(World):
     self.relative_STACK_FN = rel_filename
 
   def interpret(self, command):
-    if (
-      is_numerical(command)
-      or len(command.split()) > 1
-      or self.has(command)
-      and self.check(command) in {True, None}
-      ):
-      print '\njoy?', command
-      super(StackDisplayWorld, self).interpret(command)
+    command = command.strip()
+    if self.has(command) and self.check(command) == False:  # not in {True, None}:
+      return
+    print '\njoy?', command
+    super(StackDisplayWorld, self).interpret(command)
 
   def print_stack(self):
     print '\n%s <-' % stack_to_string(self.stack)