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
This commit is contained in:
rillig 2021-02-14 11:21:37 +00:00
parent 44db56f660
commit f6084dc243
1 changed files with 15 additions and 6 deletions

View File

@ -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