comparison mercurial/crecord.py @ 41991:3f467db023a2

crecord: completely redraw screen when coming back from editor Differential Revision: https://phab.mercurial-scm.org/D6129
author Kyle Lippincott <spectral@google.com>
date Wed, 13 Mar 2019 18:39:36 -0700
parents c1d83d916e85
children fa3b0ca9d74f
comparison
equal deleted inserted replaced
41990:22ed63869835 41991:3f467db023a2
552 """ 552 """
553 test interface to get selection of chunks, and mark the applied flags 553 test interface to get selection of chunks, and mark the applied flags
554 of the chosen chunks. 554 of the chosen chunks.
555 """ 555 """
556 chunkselector = curseschunkselector(headerlist, ui, operation) 556 chunkselector = curseschunkselector(headerlist, ui, operation)
557
558 class dummystdscr(object):
559 def clear(self):
560 pass
561 def refresh(self):
562 pass
563
564 chunkselector.stdscr = dummystdscr()
557 if testfn and os.path.exists(testfn): 565 if testfn and os.path.exists(testfn):
558 testf = open(testfn, 'rb') 566 testf = open(testfn, 'rb')
559 testcommands = [x.rstrip('\n') for x in testf.readlines()] 567 testcommands = [x.rstrip('\n') for x in testf.readlines()]
560 testf.close() 568 testf.close()
561 while True: 569 while True:
1604 try: 1612 try:
1605 patch = self.ui.edit(patch.getvalue(), "", action="diff") 1613 patch = self.ui.edit(patch.getvalue(), "", action="diff")
1606 except error.Abort as exc: 1614 except error.Abort as exc:
1607 self.errorstr = str(exc) 1615 self.errorstr = str(exc)
1608 return None 1616 return None
1617 finally:
1618 self.stdscr.clear()
1619 self.stdscr.refresh()
1609 1620
1610 # remove comment lines 1621 # remove comment lines
1611 patch = [line + '\n' for line in patch.splitlines() 1622 patch = [line + '\n' for line in patch.splitlines()
1612 if not line.startswith('#')] 1623 if not line.startswith('#')]
1613 return patchmod.parsepatch(patch) 1624 return patchmod.parsepatch(patch)