##// END OF EJS Templates
Darken terminal.debugger and core.debugger
Blazej Michalik -
Show More
@@ -238,7 +238,7 b' class Pdb(OldPdb):'
238 self.shell = TerminalInteractiveShell.instance()
238 self.shell = TerminalInteractiveShell.instance()
239 # needed by any code which calls __import__("__main__") after
239 # needed by any code which calls __import__("__main__") after
240 # the debugger was entered. See also #9941.
240 # the debugger was entered. See also #9941.
241 sys.modules['__main__'] = save_main
241 sys.modules["__main__"] = save_main
242
242
243 if color_scheme is not None:
243 if color_scheme is not None:
244 warnings.warn(
244 warnings.warn(
@@ -323,10 +323,10 b' class Pdb(OldPdb):'
323 def precmd(self, line):
323 def precmd(self, line):
324 """Perform useful escapes on the command before it is executed."""
324 """Perform useful escapes on the command before it is executed."""
325
325
326 if line.endswith('??'):
326 if line.endswith("??"):
327 line = 'pinfo2 ' + line[:-2]
327 line = "pinfo2 " + line[:-2]
328 elif line.endswith('?'):
328 elif line.endswith("?"):
329 line = 'pinfo ' + line[:-1]
329 line = "pinfo " + line[:-1]
330
330
331 line = super().precmd(line)
331 line = super().precmd(line)
332
332
@@ -414,11 +414,10 b' class Pdb(OldPdb):'
414
414
415 Colors = self.color_scheme_table.active_colors
415 Colors = self.color_scheme_table.active_colors
416 ColorsNormal = Colors.Normal
416 ColorsNormal = Colors.Normal
417 tpl_link = u'%s%%s%s' % (Colors.filenameEm, ColorsNormal)
417 tpl_link = "%s%%s%s" % (Colors.filenameEm, ColorsNormal)
418 tpl_call = u'%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal)
418 tpl_call = "%s%%s%s%%s%s" % (Colors.vName, Colors.valEm, ColorsNormal)
419 tpl_line = u'%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
419 tpl_line = "%%s%s%%s %s%%s" % (Colors.lineno, ColorsNormal)
420 tpl_line_em = u'%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line,
420 tpl_line_em = "%%s%s%%s %s%%s%s" % (Colors.linenoEm, Colors.line, ColorsNormal)
421 ColorsNormal)
422
421
423 frame, lineno = frame_lineno
422 frame, lineno = frame_lineno
424
423
@@ -451,8 +450,8 b' class Pdb(OldPdb):'
451 if frame is self.curframe:
450 if frame is self.curframe:
452 ret.append('> ')
451 ret.append('> ')
453 else:
452 else:
454 ret.append(' ')
453 ret.append(" ")
455 ret.append(u'%s(%s)%s\n' % (link, lineno, call))
454 ret.append("%s(%s)%s\n" % (link, lineno, call))
456
455
457 start = lineno - 1 - context//2
456 start = lineno - 1 - context//2
458 lines = linecache.getlines(filename)
457 lines = linecache.getlines(filename)
@@ -461,14 +460,14 b' class Pdb(OldPdb):'
461 lines = lines[start : start + context]
460 lines = lines[start : start + context]
462
461
463 for i, line in enumerate(lines):
462 for i, line in enumerate(lines):
464 show_arrow = (start + 1 + i == lineno)
463 show_arrow = start + 1 + i == lineno
465 linetpl = (frame is self.curframe or show_arrow) \
464 linetpl = (frame is self.curframe or show_arrow) and tpl_line_em or tpl_line
466 and tpl_line_em \
465 ret.append(
467 or tpl_line
466 self.__format_line(
468 ret.append(self.__format_line(linetpl, filename,
467 linetpl, filename, start + 1 + i, line, arrow=show_arrow
469 start + 1 + i, line,
468 )
470 arrow=show_arrow))
469 )
471 return ''.join(ret)
470 return "".join(ret)
472
471
473 def __format_line(self, tpl_line, filename, lineno, line, arrow=False):
472 def __format_line(self, tpl_line, filename, lineno, line, arrow=False):
474 bp_mark = ""
473 bp_mark = ""
@@ -518,9 +517,13 b' class Pdb(OldPdb):'
518 break
517 break
519
518
520 if lineno == self.curframe.f_lineno:
519 if lineno == self.curframe.f_lineno:
521 line = self.__format_line(tpl_line_em, filename, lineno, line, arrow=True)
520 line = self.__format_line(
521 tpl_line_em, filename, lineno, line, arrow=True
522 )
522 else:
523 else:
523 line = self.__format_line(tpl_line, filename, lineno, line, arrow=False)
524 line = self.__format_line(
525 tpl_line, filename, lineno, line, arrow=False
526 )
524
527
525 src.append(line)
528 src.append(line)
526 self.lineno = lineno
529 self.lineno = lineno
@@ -39,10 +39,9 b' class TerminalPdb(Pdb):'
39 return [(Token.Prompt, self.prompt)]
39 return [(Token.Prompt, self.prompt)]
40
40
41 if self._ptcomp is None:
41 if self._ptcomp is None:
42 compl = IPCompleter(shell=self.shell,
42 compl = IPCompleter(
43 namespace={},
43 shell=self.shell, namespace={}, global_namespace={}, parent=self.shell
44 global_namespace={},
44 )
45 parent=self.shell)
46 # add a completer for all the do_ methods
45 # add a completer for all the do_ methods
47 methods_names = [m[3:] for m in dir(self) if m.startswith("do_")]
46 methods_names = [m[3:] for m in dir(self) if m.startswith("do_")]
48
47
General Comments 0
You need to be logged in to leave comments. Login now