##// END OF EJS Templates
synchronize with editor patch
vds -
Show More
@@ -333,6 +333,12 b' class Pdb(OldPdb):'
333 #frame, lineno = frame_lineno
333 #frame, lineno = frame_lineno
334 print >>Term.cout, self.format_stack_entry(frame_lineno, '', context)
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 def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):
342 def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):
337 import linecache, repr
343 import linecache, repr
338
344
@@ -496,6 +502,12 b' class Pdb(OldPdb):'
496 last = first + 10
502 last = first + 10
497 self.print_list_lines(self.curframe.f_code.co_filename, first, last)
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 do_l = do_list
511 do_l = do_list
500
512
501 def do_pdef(self, arg):
513 def do_pdef(self, arg):
@@ -53,10 +53,12 b' from pprint import PrettyPrinter'
53
53
54 # List here all the default hooks. For now it's just the editor functions
54 # List here all the default hooks. For now it's just the editor functions
55 # but over time we'll move here all the public API for user-accessible things.
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 'input_prefilter', 'shutdown_hook', 'late_startup_hook',
58 'input_prefilter', 'shutdown_hook', 'late_startup_hook',
58 'generate_prompt', 'generate_output_prompt','shell_hook',
59 'generate_prompt', 'generate_output_prompt','shell_hook',
59 'show_in_pager','pre_prompt_hook', 'pre_runcode_hook']
60 'show_in_pager','pre_prompt_hook', 'pre_runcode_hook']
61 # vds: <<
60
62
61 pformat = PrettyPrinter().pformat
63 pformat = PrettyPrinter().pformat
62
64
@@ -107,6 +109,10 b' def fix_error_editor(self,filename,linenum,column,msg):'
107 finally:
109 finally:
108 t.close()
110 t.close()
109
111
112 # vds: >>
113 def synchronize_with_editor(self, filename, linenum, column):
114 pass
115 # vds: <<
110
116
111 class CommandChainDispatcher:
117 class CommandChainDispatcher:
112 """ Dispatch calls to a chain of commands until some func can handle it
118 """ Dispatch calls to a chain of commands until some func can handle it
@@ -490,6 +490,11 b' class ListTB(TBTools):'
490 Colors.Normal, s))
490 Colors.Normal, s))
491 else:
491 else:
492 list.append('%s\n' % str(stype))
492 list.append('%s\n' % str(stype))
493
494 # vds:>>
495 __IPYTHON__.hooks.synchronize_with_editor(filename, lineno, 0)
496 # vds:<<
497
493 return list
498 return list
494
499
495 def _some_str(self, value):
500 def _some_str(self, value):
@@ -801,6 +806,15 b' class VerboseTB(TBTools):'
801 for name in names:
806 for name in names:
802 value = text_repr(getattr(evalue, name))
807 value = text_repr(getattr(evalue, name))
803 exception.append('\n%s%s = %s' % (indent, name, value))
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 # return all our info assembled as a single string
818 # return all our info assembled as a single string
805 return '%s\n\n%s\n%s' % (head,'\n'.join(frames),''.join(exception[0]) )
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