##// END OF EJS Templates
chistedit: move changeaction() onto state class...
Martin von Zweigbergk -
r49025:141aafac 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 changeaction(state, pos, action):
1198 """Change the action state on the given position to the new action"""
1199 rules = state.rules
1200 assert 0 <= pos < len(rules)
1201 rules[pos].action = action
1202
1203
1204 def cycleaction(state, pos, next=False):
1197 def cycleaction(state, pos, next=False):
1205 """Changes the action state the next or the previous action from
1198 """Changes the action state the next or the previous action from
1206 the action list"""
1199 the action list"""
@@ -1215,7 +1208,7 b' def cycleaction(state, pos, next=False):'
1215 index += 1
1208 index += 1
1216 else:
1209 else:
1217 index -= 1
1210 index -= 1
1218 changeaction(state, pos, KEY_LIST[index % len(KEY_LIST)])
1211 state.change_action(pos, KEY_LIST[index % len(KEY_LIST)])
1219
1212
1220
1213
1221 def changeview(state, delta, unit):
1214 def changeview(state, delta, unit):
@@ -1505,7 +1498,7 b' pgup/K: move patch up, pgdn/J: move patc'
1505 if selected is not None:
1498 if selected is not None:
1506 self.swap(oldpos, newrule.pos)
1499 self.swap(oldpos, newrule.pos)
1507 elif action.startswith(b'action-'):
1500 elif action.startswith(b'action-'):
1508 changeaction(self, oldpos, action[7:])
1501 self.change_action(oldpos, action[7:])
1509 elif action == b'showpatch':
1502 elif action == b'showpatch':
1510 self.change_mode(MODE_PATCH if curmode != MODE_PATCH else prevmode)
1503 self.change_mode(MODE_PATCH if curmode != MODE_PATCH else prevmode)
1511 elif action == b'help':
1504 elif action == b'help':
@@ -1588,6 +1581,12 b' pgup/K: move patch up, pgdn/J: move patc'
1588 if self.selected:
1581 if self.selected:
1589 self.make_selection(newpos)
1582 self.make_selection(newpos)
1590
1583
1584 def change_action(self, pos, action):
1585 """Change the action state on the given position to the new action"""
1586 rules = self.rules
1587 assert 0 <= pos < len(rules)
1588 rules[pos].action = action
1589
1591
1590
1592 def _chisteditmain(repo, rules, stdscr):
1591 def _chisteditmain(repo, rules, stdscr):
1593 try:
1592 try:
General Comments 0
You need to be logged in to leave comments. Login now