]> git.neil.brown.name Git - wiggle.git/commitdiff
vpatch - use 'cols' in main window.
authorNeilBrown <neilb@suse.de>
Thu, 17 May 2012 07:26:13 +0000 (17:26 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 17 May 2012 07:26:13 +0000 (17:26 +1000)
We currently don't use 'cols' - which causes a warning because
it is set by an assignment inside a macro..

The trick to quiet to warning causes different warnings on other
compilers.

We could just do
   rows = getmaxy()
but that is 'legacy' so I'd rather not.

So just find somewhere to use cols..

Reported-by: "P. Martin" <mrsmiley98@lycos.com>
Signed-off-by: NeilBrown <neilb@suse.de>
vpatch.c

index 93102bc0ec9eb20399108309422438a4aee62f7f..3a8d19a6c1cfecf8f4bfc69fcaaf74b43b8e5398 100644 (file)
--- a/vpatch.c
+++ b/vpatch.c
@@ -2148,7 +2148,7 @@ static void main_window(struct plist *pl, int n, FILE *f, int reverse)
                if (refresh) {
                        refresh = 0;
                        getmaxyx(stdscr, rows, cols);
-                       cols = cols; /* Silence warning that 'cols' isn't used */
+
                        if (row >= rows + 3)
                                row = (rows+1)/2;
                        if (row >= rows)
@@ -2178,7 +2178,7 @@ static void main_window(struct plist *pl, int n, FILE *f, int reverse)
                }
                {char bb[20];
                        sprintf(bb, "%d", c);
-                       mvaddstr(0, 70, bb);
+                       mvaddstr(0, cols-strlen(bb), bb);
                        clrtoeol();
                }
                move(row, 9);