##// END OF EJS Templates
synchronize with editor patch
vds -
Show More
@@ -333,6 +333,12 b' class Pdb(OldPdb):'
333 333 #frame, lineno = frame_lineno
334 334 print >>Term.cout, self.format_stack_entry(frame_lineno, '', context)
335 335
336 # vds: >>
337 frame, lineno = frame_lineno
338 filename = frame.f_code.co_filename
339 __IPYTHON__.hooks.synchronize_with_editor(filename, lineno, 0)
340 # vds: <<
341
336 342 def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):
337 343 import linecache, repr
338 344
@@ -496,6 +502,12 b' class Pdb(OldPdb):'
496 502 last = first + 10
497 503 self.print_list_lines(self.curframe.f_code.co_filename, first, last)
498 504
505 # vds: >>
506 lineno = first
507 filename = self.curframe.f_code.co_filename
508 __IPYTHON__.hooks.synchronize_with_editor(filename, lineno, 0)
509 # vds: <<
510
499 511 do_l = do_list
500 512
501 513 def do_pdef(self, arg):
@@ -53,10 +53,12 b' from pprint import PrettyPrinter'
53 53
54 54 # List here all the default hooks. For now it's just the editor functions
55 55 # but over time we'll move here all the public API for user-accessible things.
56 __all__ = ['editor', 'fix_error_editor', 'result_display',
56 # vds: >>
57 __all__ = ['editor', 'fix_error_editor', 'synchronize_with_editor', 'result_display',
57 58 'input_prefilter', 'shutdown_hook', 'late_startup_hook',
58 59 'generate_prompt', 'generate_output_prompt','shell_hook',
59 60 'show_in_pager','pre_prompt_hook', 'pre_runcode_hook']
61 # vds: <<
60 62
61 63 pformat = PrettyPrinter().pformat
62 64
@@ -107,6 +109,10 b' def fix_error_editor(self,filename,linenum,column,msg):'
107 109 finally:
108 110 t.close()
109 111
112 # vds: >>
113 def synchronize_with_editor(self, filename, linenum, column):
114 pass
115 # vds: <<
110 116
111 117 class CommandChainDispatcher:
112 118 """ Dispatch calls to a chain of commands until some func can handle it
@@ -490,6 +490,11 b' class ListTB(TBTools):'
490 490 Colors.Normal, s))
491 491 else:
492 492 list.append('%s\n' % str(stype))
493
494 # vds:>>
495 __IPYTHON__.hooks.synchronize_with_editor(filename, lineno, 0)
496 # vds:<<
497
493 498 return list
494 499
495 500 def _some_str(self, value):
@@ -801,6 +806,15 b' class VerboseTB(TBTools):'
801 806 for name in names:
802 807 value = text_repr(getattr(evalue, name))
803 808 exception.append('\n%s%s = %s' % (indent, name, value))
809
810 # vds: >>
811 if records:
812 frame, file, lnum, func, lines, index = records[-1]
813 #print "file:", str(file), "linenb", str(lnum)
814 file = abspath(file)
815 __IPYTHON__.hooks.synchronize_with_editor(file, lnum, 0)
816 # vds: <<
817
804 818 # return all our info assembled as a single string
805 819 return '%s\n\n%s\n%s' % (head,'\n'.join(frames),''.join(exception[0]) )
806 820
General Comments 0
You need to be logged in to leave comments. Login now