Re: text layout in sysinst
On 06.02.2021 20:58, Roland Illig wrote: On 05.02.2021 21:12, Roland Illig wrote: Hi, 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. Fixed it. https://mail-index.netbsd.org/source-changes/2021/02/13/msg126856.html
Re: text layout in sysinst
On Sun, Feb 07, 2021 at 14:26:47 +0100, Roland Illig wrote: > On 07.02.2021 05:25, Valery Ushakov wrote: > > 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. > > Thanks for this explanation, it seemed to provide all the details I > needed to fix it myself. I tried it but failed miserably since I > stumpled upon a dozen other bugs while trying to fix this one. > Therefore I first made the libcurses test framework a little more reliable. > > Could you perhaps fix this one? You know the code way better than I do, > with all the subtleties around aliasing and SYNCH_IN and SYNCH_OUT and > the various code paths that are taken by all the functions. The change that introduced this problem was, I guess, trying to fix the other side of the real bug. Before that change, I guess, addch was advancing curx, but addstr was not: http://mail-index.netbsd.org/source-changes/2016/11/28/msg079394.html Fixing this properly requires more effort than I currently can afford to spare (I don't really know the curses code that well, I just did a few cleanups here and there). Cc'ing Brett. -uwe
Re: text layout in sysinst
On 07.02.2021 05:25, Valery Ushakov wrote: 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. Thanks for this explanation, it seemed to provide all the details I needed to fix it myself. I tried it but failed miserably since I stumpled upon a dozen other bugs while trying to fix this one. Therefore I first made the libcurses test framework a little more reliable. Could you perhaps fix this one? You know the code way better than I do, with all the subtleties around aliasing and SYNCH_IN and SYNCH_OUT and the various code paths that are taken by all the functions. Roland
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
Re: text layout in sysinst
On 05.02.2021 21:12, Roland Illig wrote: Hi, 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.
Re: text layout in sysinst
On Fri, Feb 05, 2021 at 09:12:32PM +0100, Roland Illig wrote: > When I start sysinst from an installed system though, the language > selection is skipped completely (which I didn't understand from reading > the code) This means the message catalog files have not been found - I thought I fixed that sometime back, but I can reproduce the issue in -current. Will have a look. Martin
text layout in sysinst
Hi, 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. When I start sysinst from an installed system though, the language selection is skipped completely (which I didn't understand from reading the code), and the menu items are only indented by 8 characters. This is the intended indentation, at least for German. In German, the menu items are a bit longer than in English, resulting in an ugly line break in one of the menu items, which the text formatting doesn't take care of. I'd like to get rid of this line break without changing the text. What is the magic happening here that I didn't get? Thanks, Roland