Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1993f26

Browse files
author
Harry Pierson
committed
tweaked _input_repl_cmd and added support Ctrl-Z to exit the REPL console
1 parent ec1ed1c commit 1993f26

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

‎ipydbg.py‎

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -314,29 +314,26 @@ def _print_source_line(self, sp, lines):
314314

315315
@inputcmd(_inputcmds, ConsoleKey.R)
316316
def _input_repl_cmd(self, keyinfo):
317-
318-
print
319-
repl_locals = {'self': self}
320317
with CC.Gray:
321-
print "REPL Console"
318+
print "\nREPL Console\nPress Ctl-Z to Exit"
322319
cmd = ""
320+
_locals = {'self': self}
321+
323322
while True:
324-
Console.Write("REPL>>>" if not cmd else "...")
323+
Console.Write(">>>" if not cmd else "...")
325324

326325
line = Console.ReadLine()
327-
if notline andnotcmd:
326+
if line ==None:
328327
break
329328

330-
try:
331-
if line:
332-
cmd = cmd + line + "\n"
333-
else:
334-
code = compile(cmd, "<input>", "single")
335-
if code != None:
336-
exec code in globals(), repl_locals
337-
cmd = ""
338-
except Exception, ex:
339-
with CC.Red: print type(ex), ex
329+
if line:
330+
cmd = cmd + line + "\n"
331+
else:
332+
try:
333+
if len(cmd) > 0:
334+
exec compile(cmd, "<input>", "single") in globals(),_locals
335+
except Exception, ex:
336+
with CC.Red: print type(ex), ex
340337
cmd = ""
341338

342339
@inputcmd(_inputcmds, ConsoleKey.Spacebar)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /