Module Name: src
Committed By: rillig
Date: Sun Feb 14 11:21:37 UTC 2021
Modified Files:
src/tests/lib/libcurses/tests: addch
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libcurses/tests/addch
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libcurses/tests/addch
diff -u src/tests/lib/libcurses/tests/addch:1.6 src/tests/lib/libcurses/tests/addch:1.7
--- src/tests/lib/libcurses/tests/addch:1.6 Sat Feb 13 14:30:37 2021
+++ src/tests/lib/libcurses/tests/addch Sun Feb 14 11:21:37 2021
@@ -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 mvaddch 5 3 `\003e`
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