tech-userlevel archive

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

Re: text layout in sysinst



On Sat, Feb 06, 2021 at 20:58:49 +0100, Roland Illig wrote:

> On 05.02.2021 21:12, Roland Illig wrote:
>
> > when I run sysinst from a boot CD, after pressing Enter 3 times in a
> > row, I get the screen "You have chosen".  This screen presents a menu.
> > The items of the menu are indented with 16 characters (probably 2 tabs)
> > relative to the surrounding text.
> > 
> > What is the magic happening here that I didn't get?
> 
> Found it.  It's a bug in libcurses, introduced somewhere between NetBSD
> 8.0 and NetBSD-9.99.80.
> 
> 	addstr("\taddstr\n");
> 
> 	for (const char *p = "\taddch\n"; *p != '\0'; p++)
> 		addch(*p);
> 
> These two pieces of code are supposed to indent the text at the same
> position, and on NetBSD 8.0 they do, but not on NetBSD-9.99.80.
> 
> I suspect that in _cursesi_addwchar, the line "(*x)++;" is wrong.  I'll
> add a test for demonstrating and fixing this.

What's wrong is that for addstr we call _cursesi_addwchar with a
pointer to a dummy variable, but for addch we call it with a pointer
to win->curx, so we first increment win->curx in the nested
_cursesi_addwchar calls (for the spaces) and then we also increment it
in the top-level _cursesi_addwchar in that loop.

-uwe


Home | Main Index | Thread Index | Old Index