# $NetBSD: addch,v 1.8 2021/02/25 01:07:43 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
call OK mvaddch 5 3 `\003e`
call OK refresh
call OK addch `\000\n`

call OK addch `\000\t`
call2 6 8 getyx STDSCR
call OK addch `\0008`
call OK addch `\000\n`

call OK addstr "0123456"
call OK addch `\000\t`
call2 7 8 getyx STDSCR
call OK addch `\0008`
call OK addch `\000\n`

call OK refresh
compare addch.chk

# Ensure that backspace works as intended.
# See tests/addbytes.
call OK move 1 0
call OK addstr "12345"
call OK addch `\000\010`
call2 1 4 getyx STDSCR

call OK addch `\000\010`
call OK addch `\000\010`
call OK addch `\000\010`
call OK addch `\000\010`
call2 1 0 getyx STDSCR

# If curx is already 0, backspace is a no-op.
call OK addch `\000\010`
call2 1 0 getyx STDSCR

call OK addstr "123"
call OK addch `\000\t`
call2 1 8 getyx STDSCR

# Backspace affects the cursor position, no matter whether the previously
# output char was a tab or a space.
call OK addch `\000\010`
call2 1 7 getyx STDSCR
