Author: arigo
Date: Tue Apr 8 19:04:36 2008
New Revision: 53590
Modified:
pyrepl/trunk/pyrepl/pyrepl/reader.py
pyrepl/trunk/pyrepl/pyrepl/simple_interact.py
Log:
Disable alt-enter forcibly inserting a newline.
In a Python prompt it would allow several statements, which are not
handled correctly by compile('single').
For singe-line inputs e.g. as by raw_input(), inserting newline
characters in the middle will probably just confuse Python programs that
don't expect raw_input() to return multiline strings.
Modified: pyrepl/trunk/pyrepl/pyrepl/reader.py
==============================================================================
--- pyrepl/trunk/pyrepl/pyrepl/reader.py (original)
+++ pyrepl/trunk/pyrepl/pyrepl/reader.py Tue Apr 8 19:04:36 2008
@@ -135,7 +135,7 @@
(r'\M-7', 'digit-arg'),
(r'\M-8', 'digit-arg'),
(r'\M-9', 'digit-arg'),
- (r'\M-\n', 'insert-nl'),
+ #(r'\M-\n', 'insert-nl'),
('\\\\', 'self-insert')] + \
[(c, 'self-insert')
for c in map(chr, range(32, 127)) if c <> '\\'] + \
Modified: pyrepl/trunk/pyrepl/pyrepl/simple_interact.py
==============================================================================
--- pyrepl/trunk/pyrepl/pyrepl/simple_interact.py (original)
+++ pyrepl/trunk/pyrepl/pyrepl/simple_interact.py Tue Apr 8 19:04:36 2008
@@ -31,10 +31,6 @@
statement = multiline_input(more_lines, ps1, ps2)
except EOFError:
break
- # XXX with Alt-Enter we can actually enter more than one
- # statement, and compile() ignores everything after the
- # first statement in 'single' mode... We should either
- # find some obscure workaround or tweak PyPy's compiler.
more = console.push(statement)
assert not more
except KeyboardInterrupt: