I've discovered that printing the "\b" character (8) moves the cursor back based on the width of the most recent glyph that was printed.
So, @zep, I can understand where your mind was going with this, because you wanted it to be possible to back up over something like a kana character or a PICO-8 emoji with a single backspace. That does make sense.
However, I think unless you're going to keep a long history of what was printed before that, and where the cursor was for each glyph, it's going to cause problems, because right now it's only guaranteed to work for backspacing over one character, not more.
For instance, if I print("abしd\b\bcd"), it doesn't put "cd" in the right place, as shown below, where I highlight the overprinting in the second print by changing the foreground color to orange:
Point being, you're trying to be helpful to the user by remembering the width of the last glyph, but it's not helpful to the next user who wants to back up over two glyphs. It's not a game I think you can play to win. I think it'd be better just to set backspace.dx to a constant for the font, be it oem or custom.
You should probably just set backspace to be literally a backwards space. Let the user deal with double-wide or narrow glyphs if they need to—they know what they're printing, after all.
(Another option would be to give us a command code to set the backspace size, e.g. "\^<4", and default it to 4 or whatever is appropriate for a custom font. Leaving it in our hands solves all the problems, honestly.)
[Please log in to post a comment]