martinwguy/xvi

Line end calculation for command line is imprecise

Closed this issue · 1 comments

cmd_input() has code to make sure command input doesn't overflow the
command buffer (or the screen), but the check is done before inserting a
character without taking account of the width of the newly-inserted
character so a control character inserted into an almost-fill command line
can overflow the command line buffer.

Example:
: followed by 74 normal characters followed by control-E control-E results
in a displayed line ending in "aaaaa^E^ _" where _ marks the position of the
cursor, in the 80th column.
If you then delete this back to the :, it gets the deletion out by one:
when you hit <- at the :, nothing happens. You have to hit it again to
cancel the command.

Similarly, inserting top-bit-set characters (e.g. accented characters)
displays them as octal \303, which also get truncated if at the end of
the command line and, again, deleting them is skewed.

Fixed by 1e245ce