Patchwork D6131: crecord: redraw the screen when starting up chunkselector

login
register
mail settings
Submitter phabricator
Date March 14, 2019, 3:17 a.m.
Message ID <differential-rev-PHID-DREV-khgpulrcs5tvk3e2fxjo-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/39244/
State Superseded
Headers show

Comments

phabricator - March 14, 2019, 3:17 a.m.
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Failure to do this can cause screen corruption like:
  
    <headerline>
     [X] filename.cc
    <several blank lines>
    <output from previous iteration of split that happened to be here>
  
  I believe this might only happen in some terminals, and maybe only when using
  the "alternate screen". Regardless of the exact conditions to reproduce, it
  should be safe to always clear it when starting up and is probably the correct
  thing to do anyway :)

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6131

AFFECTED FILES
  mercurial/crecord.py

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: mercurial-devel
phabricator - March 14, 2019, 4:30 a.m.
martinvonz added inline comments.

INLINE COMMENTS

> crecord.py:537-538
>      try:
> -        import pdb
> -        pdb.set_trace()
>          curses.wrapper(chunkselector.main)

I assume this patch was based on some local commit that we don't have in core (and don't want in core :)). Can you rebase it to @ and update?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6131

To: spectral, #hg-reviewers
Cc: martinvonz, mercurial-devel
phabricator - March 14, 2019, 5:57 a.m.
spectral added inline comments.

INLINE COMMENTS

> martinvonz wrote in crecord.py:537-538
> I assume this patch was based on some local commit that we don't have in core (and don't want in core :)). Can you rebase it to @ and update?

https://phab.mercurial-scm.org/D6129, apparently...  I'll see myself to the shamecube.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6131

To: spectral, #hg-reviewers
Cc: martinvonz, mercurial-devel

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -534,8 +534,6 @@ 
     if util.safehasattr(signal, 'SIGTSTP'):
         origsigtstp = signal.getsignal(signal.SIGTSTP)
     try:
-        import pdb
-        pdb.set_trace()
         curses.wrapper(chunkselector.main)
         if chunkselector.initexc is not None:
             raise chunkselector.initexc
@@ -1765,6 +1763,12 @@ 
         except curses.error:
             self.usecolor = False
 
+        # In some situations we may have some cruft left on the "alternate
+        # screen" from another program (or previous iterations of ourself), and
+        # we won't clear it if the scroll region is small enough to comfortably
+        # fit on the terminal.
+        self.stdscr.clear()
+
         # available colors: black, blue, cyan, green, magenta, white, yellow
         # init_pair(color_id, foreground_color, background_color)
         self.initcolorpair(None, None, name="normal")