NetBSD/lib/libcurses
rillig 609d11bc47 libcurses: fix wrong tab width for addch
In sysinst, the installation screen is indented with tabs.  Sysinst uses
msgc, which brings its own text layout engine.  This engine does not use
addbytes but addch.  In addch, the x position for each tab was advanced
twice as much as needed.  The menu items were thus not indented by 8
spaces but by 16, which caused an ugly line break in the German
translation.

This bug largely went unnoticed because most other applications use
addbytes instead, which worked fine all the time.  It had been
introduced somewhere between NetBSD 8.0 and NetBSD 9.0.

The code around this bug used aliased variables for win->curx and
win->cury a lot.  Getting this right is difficult and needs a thorough
test suite.  Even though libcurses has 201 tests, that is not nearly
enough to cover all the relations between the various functions in
libcurses that call each other, crossing API boundaries from internal
to external, doing character conversions on the way and juggling around
4 different types of characters (char, wchar_t, chtype, cchar_t).

The simplest fix was to remove all this aliasing, while keeping the
API the same.  If _cursesi_waddbytes is not considered part of the API,
it would be possible to replace px with win->curx in all places, same
for py and win->cury.

The complicated code with the aliasing may have been meant for
performance reasons, but it's hard to see any advantage if both points
of truth need to be synchronized all the time.

Libcurses can be built in 2 modes: with wide character support or
without (-DDISABLE_WCHAR).  The test suite only covers the variant with
wide characters.  The single-byte variant has to be tested manually.
Running sysinst with the single-byte libcurses produces the correct
layout.
2021-02-13 14:30:37 +00:00
..
EXAMPLES
PSD.doc
acs.c
add_wch.c
add_wchstr.c
addbytes.c libcurses: fix wrong tab width for addch 2021-02-13 14:30:37 +00:00
addch.c
addchnstr.c
addnstr.c
addwstr.c
attributes.c
background.c
bell.c
border.c
box.c
cchar.c
chgat.c
clear.c
clearok.c
clrtobot.c
clrtoeol.c
color.c
copywin.c
cr_put.c
ctrace.c
cur_hash.c
curs_set.c
curses_addch.3
curses_addchstr.3
curses_addstr.3
curses_attributes.3
curses_background.3
curses_border.3
curses_cchar.3
curses_chgat.3
curses_clear.3
curses_color.3
curses_cursor.3
curses_default_colors.3
curses_delch.3
curses_deleteln.3
curses_echochar.3
curses_fileio.3
curses_inch.3
curses_input.3
curses_insch.3
curses_insdelln.3
curses_insertln.3
curses_keyname.3
curses_line.3
curses_mouse.3
curses_pad.3
curses_print.3
curses_private.h
curses_refresh.3
curses_scanw.3
curses_screen.3 curses_screen.3: fix typo 2021-02-07 23:00:57 +00:00
curses_scroll.3
curses_slk.3
curses_standout.3
curses_termcap.3
curses_touch.3
curses_tty.3
curses_underscore.3
curses_version.3
curses_window.3
curses.3
curses.c
curses.h curses.h: proofread, indent a bit more consistently 2021-02-13 10:37:00 +00:00
delch.c
deleteln.c
delwin.c
echo_wchar.c
echochar.c
erase.c
fileio.c
fileio.h
flushok.c
fullname.c
genfileioh.awk
get_wch.c
get_wstr.c
getch.c
getstr.c
getyx.c
id_subwins.c
idcok.c
idlok.c
immedok.c
in_wch.c
in_wchstr.c
inch.c
inchstr.c
initscr.c
ins_wch.c
ins_wstr.c
insch.c
insdelln.c
insertln.c
insstr.c
instr.c
inwstr.c
keymap.h
keyname.c
keypad.c
leaveok.c
line.c
Makefile
meta.c
mouse.c
move.c
mvwin.c
newwin.c
nodelay.c
notimeout.c
overlay.c
overwrite.c
pause.c
printw.c
putchar.c
refresh.c
resize.c
ripoffline.c
scanw.c
screen.c
scroll.c
scrollok.c
setterm.c
shlib_version
slk.c
standout.c
syncok.c
timeout.c
toucholap.c
touchwin.c
tscroll.c
tstp.c
tty.c
unctrl.c
unctrl.h
underscore.c
version.c