Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libcurses If we are inserting spaces to account for a ta...



details:   https://anonhg.NetBSD.org/src/rev/b3a854d24930
branches:  trunk
changeset: 349197:b3a854d24930
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Nov 28 18:25:26 2016 +0000

description:
If we are inserting spaces to account for a tab, move the x position of the
cursor, otherwise this is a no-op (Carsten Kunze)

diffstat:

 lib/libcurses/addbytes.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r 7f746b2ca38b -r b3a854d24930 lib/libcurses/addbytes.c
--- a/lib/libcurses/addbytes.c  Mon Nov 28 11:54:18 2016 +0000
+++ b/lib/libcurses/addbytes.c  Mon Nov 28 18:25:26 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: addbytes.c,v 1.43 2016/10/22 21:55:06 christos Exp $   */
+/*     $NetBSD: addbytes.c,v 1.44 2016/11/28 18:25:26 christos Exp $   */
 
 /*
  * Copyright (c) 1987, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addbytes.c,v 1.43 2016/10/22 21:55:06 christos Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.44 2016/11/28 18:25:26 christos Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -217,9 +217,11 @@
                case '\t':
                        tabsize = win->screen->TABSIZE;
                        PSYNCH_OUT;
-                       for (i = 0; i < (tabsize - (*x % tabsize)); i++) {
+                       newx = tabsize - (*x % tabsize);
+                       for (i = 0; i < newx; i++) {
                                if (waddbytes(win, blank, 1) == ERR)
                                        return (ERR);
+                               (*x)++;
                        }
                        PSYNCH_IN;
                        return (OK);
@@ -380,9 +382,11 @@
                        cc.elements = 1;
                        cc.attributes = win->wattr;
                        tabsize = win->screen->TABSIZE;
-                       for (i = 0; i < tabsize - (*x % tabsize); i++) {
+                       newx = tabsize - (*x % tabsize);
+                       for (i = 0; i < newx; i++) {
                                if (wadd_wch(win, &cc) == ERR)
                                        return ERR;
+                               (*x)++;
                        }
                        return OK;
                }



Home | Main Index | Thread Index | Old Index