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.
9.3 KiB
9.3 KiB