diff cmd2.py @ 19:25f22e742a68

statement ends fixed
author devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil
date Wed, 19 Dec 2007 11:30:13 -0500
parents d0f0b3e0b89b
children d6d64c2e3b98
line wrap: on
line diff
--- a/cmd2.py	Wed Dec 19 11:12:25 2007 -0500
+++ b/cmd2.py	Wed Dec 19 11:30:13 2007 -0500
@@ -85,14 +85,12 @@
 	# but statementHasEnded needs a string arg; anyway, we're getting
 	# user input and users are slow.
 	
+    statementEndPattern = re.compile(r'[\n;]\s*$')	
     def statementHasEnded(self, lines):
 	"""This version lets statements end with ; or with a blank line.
 	Override for your own needs."""
-	print '>%s<' % (lines.splitlines()[-1])
-	if not lines.splitlines()[-1].strip():
-	    return True
-        return (lines.strip()[-1] == ';') 
-	
+	return bool(self.statementEndPattern.search(lines))
+	       
     def do_history(self, arg):
         """history [arg]: lists past commands issued