0

I've run into a very odd problem connecting to my Raspberry Pi (running Raspbian) using PuTTY for Windows — the ANSI "cursor" position isn't getting updated correctly.

This manifests in a couple of different ways that I've discovered so far. The most obvious (and irritating) problem is that, when I press backspace, it moves the cursor forwards instead of backwards. For example, here I tried to type bash --version, but accidentally omitted the s and had to backspace once to correct it:

pi@raspberrypi:~$ bash --veri sion
GNU bash, version 5.0.3(1)-release (arm-unknown-linux-gnueabihf)
…

You can see that the incorrect i is still present, followed by a space where I pressed backspace, followed by the rest of the command. The command still executes correctly, which means the keystrokes are being interpreted correctly; they just aren't being displayed correctly.

Another case I've seen is that, upon resizing the PuTTY window, the prompt is redisplayed starting one line below the cursor position rather than over the top of the existing one. For example, if I resize the window twice, I see the following without pressing any keys at all:

pi@raspberrypi:~$
                 pi@raspberrypi:~$
                                  pi@raspberrypi:~$

Has anyone run into anything like this before or otherwise knows what's going on? I haven't been successful finding a solution online and nothing in PuTTY's settings jumps out at me as a possible solution.

1

I've not found a real explanation for the problem, but I did find a workaround. The behavior only occurs when TERM is set to xterm-color256; changing it to xterm-color fixes the problem.

To change this permanently, launch PuTTY and load the saved session you want to change. In the menu on the left, select Connection > Data. There, you'll see the "Terminal-type string". Change this to just xterm-color, then go back to Session and re-save your settings.

Connection > Data

  • Not sure where you got that xterm-color256 at the first place, there's no such terminal definition and this string doesn't appear in PuTTY's source either. Did you mean xterm-256color instead? – egmont Jul 18 '19 at 15:09
  • @egmont Yeah, I see a terminfo file for xterm-256color as well, but xterm-color256 is the default in PuTTY. Maybe I changed the default (incorrectly) some time ago and forgot. – Ben Blank Jul 18 '19 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.