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 KNF. 2017-01-06 13:53:18 +00:00
add_wch.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
add_wchstr.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
addbytes.c libcurses: fix wrong tab width for addch 2021-02-13 14:30:37 +00:00
addch.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
addchnstr.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
addnstr.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
addwstr.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
attributes.c #ifdef HAVE_WCHAR around enhanced curses stuff. 2019-07-25 20:18:50 +00:00
background.c wbkgd - when updating window rendition for the new background character, 2018-11-19 20:37:04 +00:00
bell.c KNF. 2017-01-06 13:53:18 +00:00
border.c Checks for bottom right corner were reversed. 2017-01-09 21:17:29 +00:00
box.c KNF. 2017-01-06 13:53:18 +00:00
cchar.c setcchar - don't lose combining marks to a typo. 2020-07-02 23:43:01 +00:00
chgat.c
clear.c
clearok.c
clrtobot.c werase, wclrtobot, wclrtoeol - make code even more similar. 2020-03-15 01:18:43 +00:00
clrtoeol.c werase, wclrtobot, wclrtoeol - make code even more similar. 2020-03-15 01:18:43 +00:00
color.c KNF. 2017-01-06 13:53:18 +00:00
copywin.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
cr_put.c Back out incorrect fix for PR 53617 and fix it in a different way. 2019-05-20 22:17:41 +00:00
ctrace.c __CTRACE - don't call gettimeofday() twice. 2018-10-29 00:31:57 +00:00
cur_hash.c u_int -> unsigned int, u_int32_t -> uint32_t. 2017-01-06 09:14:07 +00:00
curs_set.c
curses_addch.3 Rename curses_insertch.3 to curses_insch.3 to match the function names 2018-10-25 10:36:56 +00:00
curses_addchstr.3
curses_addstr.3 typo 2019-07-28 14:28:50 +00:00
curses_attributes.3 Rename curses_insertch.3 to curses_insch.3 to match the function names 2018-10-25 10:36:56 +00:00
curses_background.3 Correct function prototypes in curses_background(3) 2018-09-29 11:23:18 +00:00
curses_border.3
curses_cchar.3 Grammar improvements. 2018-11-24 11:04:39 +00:00
curses_chgat.3
curses_clear.3 At some point we lost the text that explains the difference between 2019-01-11 06:14:39 +00:00
curses_color.3 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
curses_cursor.3 Whitespace. 2017-01-05 09:46:32 +00:00
curses_default_colors.3
curses_delch.3 Rename curses_insertch.3 to curses_insch.3 to match the function names 2018-10-25 10:36:56 +00:00
curses_deleteln.3
curses_echochar.3
curses_fileio.3
curses_inch.3 Add comma in enumeration. 2018-10-29 21:06:13 +00:00
curses_input.3 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
curses_insch.3 Oops, update name in .Dt, bump date. 2018-10-25 10:41:00 +00:00
curses_insdelln.3
curses_insertln.3
curses_keyname.3
curses_line.3
curses_mouse.3 Fix synopsis, use more markup. 2020-03-23 16:14:20 +00:00
curses_pad.3 Implement ncurses is_pad(3). 2017-01-05 23:15:43 +00:00
curses_print.3
curses_private.h __NEED_ERASE - don't shadow __LDATA::attr with macro parameter name. 2020-03-15 01:12:47 +00:00
curses_refresh.3 Whitespace. 2017-01-05 09:46:32 +00:00
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 Fix the documented function prototype of slk_attr_set(3) 2018-09-29 22:04:57 +00:00
curses_standout.3 PR/51673: Carsten Kunze: curses: standend() does not turn off A_BOLD; 2016-11-29 17:33:48 +00:00
curses_termcap.3
curses_touch.3 Typos. 2018-02-08 09:05:16 +00:00
curses_tty.3 Use Dv for non-errno return values (instead of Er). 2017-09-18 08:49:20 +00:00
curses_underscore.3 Fix function prototypes in curses_underscore.3 2018-09-29 21:52:29 +00:00
curses_version.3 curses(3): add curses_version() 2019-09-02 09:08:29 +00:00
curses_window.3
curses.3 curses(3): add curses_version() 2019-09-02 09:08:29 +00:00
curses.c Move ESCDELAY to curses.c so all globals are close to each other. 2017-01-31 09:17:53 +00:00
curses.h curses.h: proofread, indent a bit more consistently 2021-02-13 10:37:00 +00:00
delch.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
deleteln.c KNF. 2017-01-06 13:53:18 +00:00
delwin.c printw: rework vw_printw so it uses open_memstream rather than funopen2 2019-04-01 11:39:15 +00:00
echo_wchar.c Drop HAVE_WCHAR ifdefs from code that is not even compiled with !HAVE_WCHAR. 2018-11-22 22:16:45 +00:00
echochar.c
erase.c werase, wclrtobot, wclrtoeol - make code even more similar. 2020-03-15 01:18:43 +00:00
fileio.c 0x%p --> %p for non-external codes. 2020-02-24 12:20:29 +00:00
fileio.h Fix return for mvscanw to return ERR/OK instead of the number of 2019-06-30 22:16:20 +00:00
flushok.c KNF. 2017-01-06 13:53:18 +00:00
fullname.c KNF. 2017-01-06 13:53:18 +00:00
genfileioh.awk
get_wch.c Pads are not to be automatically refreshed on input. 2020-07-06 23:33:38 +00:00
get_wstr.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
getch.c Pads are not to be automatically refreshed on input. 2020-07-06 23:33:38 +00:00
getstr.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
getyx.c KNF. 2017-01-06 13:53:18 +00:00
id_subwins.c
idcok.c KNF. 2017-01-06 13:53:18 +00:00
idlok.c KNF. 2017-01-06 13:53:18 +00:00
immedok.c KNF. 2017-01-06 13:53:18 +00:00
in_wch.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
in_wchstr.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
inch.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
inchstr.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
initscr.c curses: use perror rather than err in initscr 2020-03-12 15:50:11 +00:00
ins_wch.c mvwins*(WINDOW *win, ...) functions - call wins* on win, not stdscr. 2020-07-06 22:46:50 +00:00
ins_wstr.c mvwins*(WINDOW *win, ...) functions - call wins* on win, not stdscr. 2020-07-06 22:46:50 +00:00
insch.c mvwins*(WINDOW *win, ...) functions - call wins* on win, not stdscr. 2020-07-06 22:46:50 +00:00
insdelln.c KNF. 2017-01-06 13:53:18 +00:00
insertln.c KNF. 2017-01-06 13:53:18 +00:00
insstr.c mvwins*(WINDOW *win, ...) functions - call wins* on win, not stdscr. 2020-07-06 22:46:50 +00:00
instr.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
inwstr.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
keymap.h
keyname.c Fix typo for unknown key keyname return. 2019-06-11 10:17:24 +00:00
keypad.c KNF. 2017-01-06 13:53:18 +00:00
leaveok.c KNF. 2017-01-06 13:53:18 +00:00
line.c hline, vline - don't lose attributes when using default character. 2020-07-01 02:57:01 +00:00
Makefile curses: Add stubs for mouse functions 2020-03-23 13:37:36 +00:00
meta.c KNF. 2017-01-06 13:53:18 +00:00
mouse.c curses: Add stubs for mouse functions 2020-03-23 13:37:36 +00:00
move.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
mvwin.c Move the ripoffline logic out of screen.c and into ripoffline.c. 2017-01-11 20:43:03 +00:00
newwin.c newwin - fix crash with negative ncols. 2020-07-14 04:39:39 +00:00
nodelay.c KNF. 2017-01-06 13:53:18 +00:00
notimeout.c KNF. 2017-01-06 13:53:18 +00:00
overlay.c
overwrite.c
pause.c KNF. 2017-01-06 13:53:18 +00:00
printw.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
putchar.c Back out incorrect fix for PR 53617 and fix it in a different way. 2019-05-20 22:17:41 +00:00
refresh.c 0x%p --> %p for non-external codes. 2020-02-24 12:20:29 +00:00
resize.c Remove obsolete clauses from copyright block. Original copyright was 2018-11-02 04:17:39 +00:00
ripoffline.c curses: resize ripped off windows 2018-10-03 13:22:29 +00:00
scanw.c Fix return for mvscanw to return ERR/OK instead of the number of 2019-06-30 22:16:20 +00:00
screen.c Fix for PR lib/52063 2018-11-16 10:12:00 +00:00
scroll.c Rework previous fix for getch cursor position when cursor is moved 2019-06-09 07:40:14 +00:00
scrollok.c KNF. 2017-01-06 13:53:18 +00:00
setterm.c Ignore terminfo padding specifications when checking whether 2018-10-26 22:22:24 +00:00
shlib_version terminfo: promote numeric parameters from short to int 2020-03-13 15:19:24 +00:00
slk.c __slk_set_finalise - fix length vs. width confusion 2019-07-28 00:51:59 +00:00
standout.c Use the window's screen's terminal. 2017-01-10 23:49:20 +00:00
syncok.c KNF. 2017-01-06 13:53:18 +00:00
timeout.c KNF. 2017-01-06 13:53:18 +00:00
toucholap.c KNF. 2017-01-06 13:53:18 +00:00
touchwin.c wtouchln - verify/clip input parameters 2020-07-03 23:28:51 +00:00
tscroll.c KNF. 2017-01-06 13:53:18 +00:00
tstp.c curses: don't optimize stdout buffer for non BSD platforms 2018-10-18 07:53:13 +00:00
tty.c Fix for PR lib/52063 2018-11-16 10:12:00 +00:00
unctrl.c
unctrl.h
underscore.c KNF. 2017-01-06 13:53:18 +00:00
version.c curses: believe in unicorns 2019-09-03 13:43:34 +00:00