##// END OF EJS Templates
chistedit: move changemode() onto state class...
Martin von Zweigbergk -
r49022:7d2464b6 default
parent child Browse files
Show More
@@ -1194,13 +1194,6 b' class histeditrule(object):'
1194
1194
1195
1195
1196 # ============ EVENTS ===============
1196 # ============ EVENTS ===============
1197 def changemode(state, mode):
1198 curmode, _ = state.mode
1199 state.mode = (mode, curmode)
1200 if mode == MODE_PATCH:
1201 state.modes[MODE_PATCH][b'patchcontents'] = state.patch_contents()
1202
1203
1204 def makeselection(state, pos):
1197 def makeselection(state, pos):
1205 state.selected = pos
1198 state.selected = pos
1206
1199
@@ -1541,9 +1534,9 b' pgup/K: move patch up, pgdn/J: move patc'
1541 elif action.startswith(b'action-'):
1534 elif action.startswith(b'action-'):
1542 changeaction(self, oldpos, action[7:])
1535 changeaction(self, oldpos, action[7:])
1543 elif action == b'showpatch':
1536 elif action == b'showpatch':
1544 changemode(self, MODE_PATCH if curmode != MODE_PATCH else prevmode)
1537 self.change_mode(MODE_PATCH if curmode != MODE_PATCH else prevmode)
1545 elif action == b'help':
1538 elif action == b'help':
1546 changemode(self, MODE_HELP if curmode != MODE_HELP else prevmode)
1539 self.change_mode(MODE_HELP if curmode != MODE_HELP else prevmode)
1547 elif action == b'quit':
1540 elif action == b'quit':
1548 return E_QUIT
1541 return E_QUIT
1549 elif action == b'histedit':
1542 elif action == b'histedit':
@@ -1591,6 +1584,12 b' pgup/K: move patch up, pgdn/J: move patc'
1591 # Reset the patch view region to the top of the new patch.
1584 # Reset the patch view region to the top of the new patch.
1592 self.modes[MODE_PATCH][b'line_offset'] = 0
1585 self.modes[MODE_PATCH][b'line_offset'] = 0
1593
1586
1587 def change_mode(self, mode):
1588 curmode, _ = self.mode
1589 self.mode = (mode, curmode)
1590 if mode == MODE_PATCH:
1591 self.modes[MODE_PATCH][b'patchcontents'] = self.patch_contents()
1592
1594
1593
1595 def _chisteditmain(repo, rules, stdscr):
1594 def _chisteditmain(repo, rules, stdscr):
1596 try:
1595 try:
@@ -1633,7 +1632,7 b' def _chisteditmain(repo, rules, stdscr):'
1633 while True:
1632 while True:
1634 oldmode, unused = state.mode
1633 oldmode, unused = state.mode
1635 if oldmode == MODE_INIT:
1634 if oldmode == MODE_INIT:
1636 changemode(state, MODE_RULES)
1635 state.change_mode(MODE_RULES)
1637 e = state.event(ch)
1636 e = state.event(ch)
1638
1637
1639 if e == E_QUIT:
1638 if e == E_QUIT:
General Comments 0
You need to be logged in to leave comments. Login now