D11645: chistedit: move makeselection() onto state class
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Oct 12 17:07:15 UTC 2021
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D11645
AFFECTED FILES
hgext/histedit.py
CHANGE DETAILS
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -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:
To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list