Putty: pasting text adds additional whitespace

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi there,

I've been using Putty for a very long time, and it's a wonderful ssh
client - but there's been an issue that's been hanging around in the
last couple of versions that a real pain in the ass. And I'm not
totally sure if it's putty at fault or my vi settings..

When I copy any text data (in Putty, Notepad or anywhere else) and I
paste it in another location in my editor for every new line it adds
another tab, so something like the following:


Would be pasting in like so:


Very very annoying when trying to move around large block of code. Has
anyone seen behaviour like this? And know how to fix it?


Re: Putty: pasting text adds additional whitespace

Quoted text here. Click to load it

This is likely not to be PuTTY at all. When you paste text in PuTTY,
it behaves exactly as if you'd typed the same text into the keyboard
(that's the only way it can possibly work).

Quoted text here. Click to load it

In this snippet, you have a few spaces before each line of text. So
this is equivalent to typing SPACE SPACE foo RETURN SPACE SPACE foo1

Quoted text here. Click to load it

This suggests that your editor has auto-indent enabled, so that when
you press RETURN it indents to the same level as the previous line.
So you hit RETURN after foo, and it brings the cursor to exactly
where it would want to be to type "foo1", but PuTTY is sending
another two spaces before that. And so on.

I don't think there's any sensible way that PuTTY, or any other
terminal emulator with copy and paste, could be `fixed' to work
around this. The solution is to disable auto-indent in your editor
when you're doing this sort of pasting.
Simon Tatham         "infinite loop _see_ loop, infinite"

Site Timeline