D6171: crecord: draw on the whole screen

jakalx (Alexander Kobjolke) phabricator at mercurial-scm.org
Wed Mar 27 08:17:09 UTC 2019


jakalx created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  When starting crecord, one can see that it has a small gap on the rightmost
  column which doesn't get used. This is in contrast to other interactive curses
  frontends such as chistedit.
  
  Disabling the displaying of the cursor allows drawing on the whole availabe
  area and thus some hacky code in align() could be removed.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/crecord.py

CHANGE DETAILS

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -962,8 +962,8 @@
         # turn tabs into spaces
         instr = instr.expandtabs(4)
         strwidth = encoding.colwidth(instr)
-        numspaces = (width - ((strwidth + xstart) % width) - 1)
-        return instr + " " * numspaces + "\n"
+        numspaces = (width - ((strwidth + xstart) % width))
+        return instr + " " * numspaces
 
     def printstring(self, window, text, fgcolor=None, bgcolor=None, pair=None,
         pairname=None, attrlist=None, towin=True, align=True, showwhtspc=False):
@@ -1770,6 +1770,12 @@
         # fit on the terminal.
         self.stdscr.clear()
 
+        # don't display the cursor
+        try:
+            curses.curs_set(0)
+        except curses.error:
+            pass
+
         # available colors: black, blue, cyan, green, magenta, white, yellow
         # init_pair(color_id, foreground_color, background_color)
         self.initcolorpair(None, None, name="normal")



To: jakalx, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list