mercurial/crecord.py
branchstable
changeset 27914 505a10b504ed
parent 27533 a801d331a022
child 27936 fedd81659643
--- a/mercurial/crecord.py	Thu Jan 21 02:42:01 2016 +0900
+++ b/mercurial/crecord.py	Wed Jan 20 11:21:13 2016 -0800
@@ -1551,6 +1551,9 @@
         if not isinstance(item, uihunk):
             return
 
+        # To go back to that hunk or its replacement at the end of the edit
+        itemindex = item.parentitem().hunks.index(item)
+
         beforeadded, beforeremoved = item.added, item.removed
         newpatches = editpatchwitheditor(self, item)
         if newpatches is None:
@@ -1575,6 +1578,8 @@
         if self.emptypatch():
             header.hunks = hunksbefore + [item] + hunksafter
         self.currentselecteditem = header
+        if len(header.hunks) > itemindex:
+            self.currentselecteditem = header.hunks[itemindex]
 
         if not test:
             updateui(self)