Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libcurses/tests tests/libcurses: document the hist...



details:   https://anonhg.NetBSD.org/src/rev/0f35af73adaf
branches:  trunk
changeset: 952666:0f35af73adaf
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 14 11:21:37 2021 +0000

description:
tests/libcurses: document the history about tab bugs in addch/addstr

Verified by installing all versions of libcurses from 2012 to 2021 and
running a simple test program on them:

        #include <stdio.h>
        #include <curses.h>

        int
        main(int argc, char **argv)
        {
                int xstr, ystr, xch, ych;

                initscr();

                addstr("\t");
                xstr = getcurx(stdscr);
                addstr("\n");
                ystr = getcury(stdscr);

                addch('\t');
                xch = getcurx(stdscr);
                addch('\n');
                ych = getcury(stdscr);

                endwin();

                fprintf(stderr, "%s\t%d,%d\t%d,%d\n",
                    argv[1], ystr, xstr, ych, xch);
        }

Some selected outputs:

        ...
        2016.11.24.14.49.08     1,0     2,8
        2016.11.28.18.25.26     1,8     2,8
        ...
        2019.05.12.02.29.00     1,8     2,8
        2019.05.20.22.17.41     1,8     2,16
        ...
        2021.02.13.10.37.00     1,8     2,16
        2021.02.13.14.30.37     1,8     2,8

diffstat:

 tests/lib/libcurses/tests/addch |  21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r e0e3c54ca1f7 -r 0f35af73adaf tests/lib/libcurses/tests/addch
--- a/tests/lib/libcurses/tests/addch   Sun Feb 14 03:41:13 2021 +0000
+++ b/tests/lib/libcurses/tests/addch   Sun Feb 14 11:21:37 2021 +0000
@@ -1,3 +1,18 @@
+# $NetBSD: addch,v 1.7 2021/02/14 11:21:37 rillig Exp $
+#
+# Between at least 2012 and 2016, addstr did not advance win->curx for a '\t',
+# but addch did.  This was inconsistent.
+#
+# On 2016.11.28.18.25.26 on NetBSD 7.99.43, this inconsistency was fixed.
+# Now both functions advanced win->curx.
+#
+# On 2019.05.20.22.17.41 on NetBSD 8.99.41, the fix was modified, which
+# introduced another inconsistency.  Since then, addstr advanced win->curx as
+# expected, but addch advanced it by twice the amount.
+#
+# On 2021.02.13.14.30.37 on NetBSD 9.99.80, this inconsistency was fixed.
+# Now both functions advanced win->curx again.
+
 include start
 call OK addch `\001t`
 call OK refresh
@@ -5,17 +20,11 @@
 call OK refresh
 call OK addch `\000\n`
 
-# Somewhere between NetBSD 8.0 and 9.0, a bug was added to addch that
-# doubled the spaces for a tab.  Instead of 8 spaces, there were 16.
-# Fixed in NetBSD 9.99.80.
 call OK addch `\000\t`
 call2 6 8 getyx STDSCR
 call OK addch `\0008`
 call OK addch `\000\n`
 
-# Somewhere between NetBSD 8.0 and 9.0, a bug was added to addch that
-# doubled the spaces for a tab.  Instead of 1 space, there were 2.
-# Fixed in NetBSD 9.99.80.
 call OK addstr "0123456"
 call OK addch `\000\t`
 call2 7 8 getyx STDSCR



Home | Main Index | Thread Index | Old Index