def on_activated(self): if not regedit.is_active_in(self.view): history = History(self.view) regedit.establish( self.view, sublime.Region(history.prompt_regs[-1].end(), self.view.size()))
def run(self, edit): if self.view in hns_for: hns = hns_for[self.view] else: hns = hns_for[self.view] = HistoryNavigationState() history = History(self.view) if hns.n_inputs_back == history.number - 1: sublime.status_message("Already at oldest input") return reg = regedit.editing_region(self.view) if hns.n_inputs_back == 0: hns.pending_input = self.view.substr(reg) hns.n_inputs_back += 1 s = history.input(hns.n_inputs_back) self.view.erase(edit, reg) reg = insert_in(self.view, edit, reg.begin(), s) regedit.establish(self.view, reg)
def insert_prompt_at_end(view, edit): view.insert(edit, view.size(), current_prompt(view)) regedit.establish(view, sublime.Region(view.size()))
def adjust_edit_mode(view): """Enter edit mode after some modifications have been applied to the view""" regedit.establish(view, edit_region_for)