# HG changeset patch # User Martin von Zweigbergk # Date 1634055479 25200 # Node ID 0f498e03b01693900a6719c128142a228e6123f4 # Parent 7d2464b6e30b0951e09c5c1e89d3b42eefdb58d6 chistedit: move makeselection() onto state class Differential Revision: https://phab.mercurial-scm.org/D11645 diff -r 7d2464b6e30b -r 0f498e03b016 hgext/histedit.py --- a/hgext/histedit.py Tue Oct 12 09:16:14 2021 -0700 +++ b/hgext/histedit.py Tue Oct 12 09:17:59 2021 -0700 @@ -1194,10 +1194,6 @@ # ============ EVENTS =============== -def makeselection(state, pos): - state.selected = pos - - def swap(state, oldpos, newpos): """Swap two positions and calculate necessary conflicts in O(|newpos-oldpos|) time""" @@ -1218,7 +1214,7 @@ rules[oldpos].checkconflicts(rules[r]) if state.selected: - makeselection(state, newpos) + state.make_selection(newpos) def changeaction(state, pos, action): @@ -1525,7 +1521,7 @@ cycleaction(self, oldpos, next=False) elif action == b'select': selected = oldpos if selected is None else None - makeselection(self, selected) + self.make_selection(selected) elif action == b'goto' and int(ch) < len(rules) and len(rules) <= 10: newrule = next((r for r in rules if r.origpos == int(ch))) self.move_cursor(oldpos, newrule.pos) @@ -1590,6 +1586,9 @@ if mode == MODE_PATCH: self.modes[MODE_PATCH][b'patchcontents'] = self.patch_contents() + def make_selection(self, pos): + self.selected = pos + def _chisteditmain(repo, rules, stdscr): try: