[pypy-svn] r41420 - pypy/dist/pypy/translator/js/examples/console
fijal at codespeak.net
fijal at codespeak.net
Mon Mar 26 20:55:17 CEST 2007
Author: fijal
Date: Mon Mar 26 20:55:15 2007
New Revision: 41420
Modified:
pypy/dist/pypy/translator/js/examples/console/client.py
Log:
Fix for a rare case when there is \n in between console checks
Modified: pypy/dist/pypy/translator/js/examples/console/client.py
==============================================================================
--- pypy/dist/pypy/translator/js/examples/console/client.py (original)
+++ pypy/dist/pypy/translator/js/examples/console/client.py Mon Mar 26 20:55:15 2007
@@ -35,11 +35,18 @@
add_text_to_dom(txt)
else:
for ps in glob.pss:
- if txt.startswith(ps) and glob.text_to_show:
- txt = txt[len(ps):]
- add_text_to_dom(ps + glob.text_to_show.pop(0) + "\n")
- add_text(txt, True)
- return
+ if glob.text_to_show:
+ num = txt.find(ps)
+ if txt.startswith(ps):
+ txt = txt[len(ps):]
+ add_text_to_dom(ps + glob.text_to_show.pop(0) + "\n")
+ add_text(txt, True)
+ return
+ if txt.startswith("\n" + ps):
+ txt = txt[len(ps) + 1:]
+ add_text_to_dom(ps + glob.text_to_show.pop(0) + "\n")
+ add_text(txt, True)
+ return
add_text_to_dom(txt)
def create_text(txt):
@@ -115,6 +122,7 @@
inp_elem = dom.document.getElementById("inp")
inp_elem.disabled = True
set_text("")
+ glob.text_to_show = [] # better safe than sorry
exported_methods.kill_console(glob.sess_id, nothing2)
def load_console(python="python"):
More information about the Pypy-commit
mailing list