def run_cmd(self, jove, **args): sel = jove.get_region() b_row, b_col = self.view.rowcol(sel.begin()) e_row, e_col = self.view.rowcol(sel.end()) # Create rectangle top = b_row left = min(b_col, e_col) bot = e_row right = max(b_col, e_col) current_edit = jove.edit for l in range(top, bot + 1): r = sublime.Region(self.view.text_point(l, left), self.view.text_point(l, right)) if not r.empty(): self.view.erase(current_edit, r) self.view.end_edit(jove.edit)
def run_cmd(self, jove, content): print(content) sel = jove.get_region() b_row, b_col = self.view.rowcol(sel.begin()) e_row, e_col = self.view.rowcol(sel.end()) # Create rectangle top = b_row left = min(b_col, e_col) bot = e_row right = max(b_col, e_col) # For each line in the region, replace the contents by what we # gathered from the overlay current_edit = jove.edit for l in range(top, bot + 1): r = sublime.Region(self.view.text_point(l, left), self.view.text_point(l, right)) if not r.empty(): self.view.erase(current_edit, r) self.view.insert(current_edit, self.view.text_point(l, left), content) self.view.end_edit(jove.edit)