def _getCoords(): line = lisp.count_lines(1,lisp.point()) col = lisp.current_column() if col == 0: line += 1 # get round 'if col == 0, then line is 1 out' problem if mark_exists() and lisp.point() > lisp.mark(): lisp.exchange_point_and_mark() col = lisp.current_column() lisp.exchange_point_and_mark() return line,col
def _getCoords(): line = lisp.count_lines(1, lisp.point()) col = lisp.current_column() if col == 0: line += 1 # get round 'if col == 0, then line is 1 out' problem if mark_exists() and lisp.point() > lisp.mark(): lisp.exchange_point_and_mark() col = lisp.current_column() lisp.exchange_point_and_mark() return line, col
def extract_method(self,name): lisp.save_some_buffers() filename = lisp.buffer_file_name() bline,bcol = _getPointCoords() lisp.exchange_point_and_mark() eline,ecol = _getPointCoords() lisp.exchange_point_and_mark() brmctx.extract(filename,bline,bcol,eline,ecol,name) lisp.set_marker(lisp.mark_marker(),None) _revertSavedFiles(brmctx.save())
def extract_method(self, name): lisp.save_some_buffers() filename = lisp.buffer_file_name() bline, bcol = _getPointCoords() lisp.exchange_point_and_mark() eline, ecol = _getPointCoords() lisp.exchange_point_and_mark() brmctx.extract(filename, bline, bcol, eline, ecol, name) lisp.set_marker(lisp.mark_marker(), None) _revertSavedFiles(brmctx.save())
def get_region(self): offset1 = self.get_offset() lisp.exchange_point_and_mark() offset2 = self.get_offset() lisp.exchange_point_and_mark() return min(offset1, offset2), max(offset1, offset2)