changeset 42025:66fc05ff0ea3

crecord: draw on the whole screen 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. Differential Revision: https://phab.mercurial-scm.org/D6171
author Alexander Kobjolke <alex@jakalx.net>
date Thu, 21 Mar 2019 21:44:29 +0100
parents b05a3e28cf24
children 98908e36d58a
files mercurial/crecord.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/crecord.py	Fri Mar 15 11:24:08 2019 -0700
+++ b/mercurial/crecord.py	Thu Mar 21 21:44:29 2019 +0100
@@ -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")