[Updated] D11645: chistedit: move makeselection() onto state class

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Oct 13 22:28:14 UTC 2021


Closed by commit rHG0f498e03b016: chistedit: move makeselection() onto state class (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11645?vs=30733&id=30785

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11645/new/

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, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211013/6514f0dc/attachment-0002.html>


More information about the Mercurial-patches mailing list