mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
22db9dea76
commit
0476cbc5ef
@ -229,9 +229,10 @@ class Repl(object):
|
|||||||
try:
|
try:
|
||||||
prompt = self.ps2 if more else self.ps1
|
prompt = self.ps2 if more else self.ps1
|
||||||
lw = ''
|
lw = ''
|
||||||
if more:
|
if more and self.lines:
|
||||||
lw = ' ' * 4
|
|
||||||
if self.lines:
|
if self.lines:
|
||||||
|
if self.lines[-1][-1:] in self.LINE_CONTINUATION_CHARS:
|
||||||
|
lw = ' ' * 4
|
||||||
lw = leading_whitespace(self.lines[-1]) + lw
|
lw = leading_whitespace(self.lines[-1]) + lw
|
||||||
if hasattr(self, 'readline'):
|
if hasattr(self, 'readline'):
|
||||||
self.readline.set_pre_input_hook(lambda:(self.readline.insert_text(lw), self.readline.redisplay()))
|
self.readline.set_pre_input_hook(lambda:(self.readline.insert_text(lw), self.readline.redisplay()))
|
||||||
@ -246,6 +247,8 @@ class Repl(object):
|
|||||||
if more and line.lstrip():
|
if more and line.lstrip():
|
||||||
self.lines.append(line)
|
self.lines.append(line)
|
||||||
continue
|
continue
|
||||||
|
if more and not line.lstrip():
|
||||||
|
line = line.lstrip()
|
||||||
more = self.push(line)
|
more = self.push(line)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
self.prints("\nKeyboardInterrupt")
|
self.prints("\nKeyboardInterrupt")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user