comparison mercurial/crecord.py @ 25555:838fa1932ff8

crecord: extract ui refresh code after editing of hunk in a function This is useful to reuse the logic to implement the continuation of the crecord session if the user edits a hunk and the editor exits with a non-zero status.
author Laurent Charignon <lcharignon@fb.com>
date Fri, 05 Jun 2015 13:32:52 -0700
parents 6fabde6ef445
children 40f0e9e5b821
comparison
equal deleted inserted replaced
25554:94441df6206c 25555:838fa1932ff8
1417 1417
1418 def toggleedit(self, item=None, test=False): 1418 def toggleedit(self, item=None, test=False):
1419 """ 1419 """
1420 edit the currently chelected chunk 1420 edit the currently chelected chunk
1421 """ 1421 """
1422 def updateui(self):
1423 self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1
1424 self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize)
1425 self.updatescroll()
1426 self.stdscr.refresh()
1427 self.statuswin.refresh()
1428 self.stdscr.keypad(1)
1422 1429
1423 def editpatchwitheditor(self, chunk): 1430 def editpatchwitheditor(self, chunk):
1424 if chunk is None: 1431 if chunk is None:
1425 self.ui.write(_('cannot edit patch for whole file')) 1432 self.ui.write(_('cannot edit patch for whole file'))
1426 self.ui.write("\n") 1433 self.ui.write("\n")
1499 if self.emptypatch(): 1506 if self.emptypatch():
1500 header.hunks = hunksbefore + [item] + hunksafter 1507 header.hunks = hunksbefore + [item] + hunksafter
1501 self.currentselecteditem = header 1508 self.currentselecteditem = header
1502 1509
1503 if not test: 1510 if not test:
1504 self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1 1511 updateui(self)
1505 self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize)
1506 self.updatescroll()
1507 self.stdscr.refresh()
1508 self.statuswin.refresh()
1509 self.stdscr.keypad(1)
1510 1512
1511 def emptypatch(self): 1513 def emptypatch(self):
1512 item = self.headerlist 1514 item = self.headerlist
1513 if not item: 1515 if not item:
1514 return True 1516 return True