]> granicus.if.org Git - nethack/commit
tty EDIT_GETLIN fix for wrapped prompt
authorPatR <rankin@nethack.org>
Fri, 13 Apr 2018 11:32:05 +0000 (04:32 -0700)
committerPatR <rankin@nethack.org>
Fri, 13 Apr 2018 11:32:05 +0000 (04:32 -0700)
commit77da2fdc6552cd01655c7c2192b03d6c66180fe3
tree634337802a59483cb9c7d586ba3f00cc5b56a6f4
parent22cc37ed61712678d49e8dd0684b48ed9ad75aae
tty EDIT_GETLIN fix for wrapped prompt

When a getlin() response is being typed, it wraps to second line if
the cursor tries to go past COLNO-1, but if a previous response is
treated as part of the prompt, using pline() to write prompt+space+text
wraps at a whole word boundary.  tty's getlin() assumes that the screen
position can be derived from that prompt+space+text_so_far but that
doesn't match if wrapping at a word boundary leaves blank space at end
of the top line.

When a prompt is accompanied by default answer, output the answer
separately instead of pretending it is part of the prompt.  Line-wrap
should occur at same point as when it was originally typed and avoid
the confusion about how far to back up when deleting characters.

This hasn't been exhaustively tested but it seems to work correctly
for ordinary input, input erased one character at a time, and input
killed all at once.  One thing which definitely hasn't been tested is
having the prompt itself be so long that it needs to wrap.
doc/fixes36.1
win/tty/getline.c