mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
9f7c0f3911
commit
6ed7a71a4d
@ -223,12 +223,15 @@ class Repl(object):
|
||||
while True:
|
||||
try:
|
||||
prompt = self.ps2 if more else self.ps1
|
||||
lw = ''
|
||||
if more:
|
||||
lw = ' ' * 4
|
||||
if self.lines:
|
||||
lw = leading_whitespace(self.lines[-1]) + lw
|
||||
if hasattr(self, 'readline'):
|
||||
self.readline.set_pre_input_hook(lambda:(self.readline.insert_text(lw), self.readline.redisplay()))
|
||||
else:
|
||||
prompt += lw
|
||||
|
||||
try:
|
||||
line = raw_input(prompt).decode(self.enc)
|
||||
except EOFError:
|
||||
@ -261,7 +264,8 @@ class Repl(object):
|
||||
except PYJError as e:
|
||||
for data in e.errors:
|
||||
msg = data.get('message') or ''
|
||||
if data['line'] == len(self.lines) and 'Unexpected token: eof' in msg or 'Unterminated regular expression' in msg:
|
||||
if data['line'] == len(self.lines) and data['col'] > 0 and (
|
||||
'Unexpected token: eof' in msg or 'Unterminated regular expression' in msg):
|
||||
return True
|
||||
else:
|
||||
for e in e.errors:
|
||||
|
Loading…
x
Reference in New Issue
Block a user