Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Terminal line wrapping and cut/paste

23 views
Skip to first unread message

John Gordon

unread,
Sep 11, 2012, 3:19:49 PM9/11/12
to
I use the PuTTY terminal software to access several different unix host
machines. I've noticed that on some machines, when I select a line of
text that has wrapped and then paste it into another window, it will be
pasted as a single line. But on other machines it gets pasted as two
separate lines.

The only pattern I can see is that the hosts which maintain the select on
a single line are all Linux, and the hosts that break the select into two
lines are all NetBSD.

What is causing this behavior? Is there a server-side setting I can look
at? As I said, I'm using the same terminal software locally, with
identical settings.

Thanks!

--
John Gordon A is for Amy, who fell down the stairs
gor...@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

Sven Mascheck

unread,
Sep 12, 2012, 7:35:57 PM9/12/12
to
John Gordon wrote:

> I use the PuTTY terminal software to access several different unix host
> machines. I've noticed that on some machines, when I select a line of
> text that has wrapped and then paste it into another window, it will be
> pasted as a single line. But on other machines it gets pasted as two
> separate lines.
>
> The only pattern I can see is that the hosts which maintain the select on
> a single line are all Linux, and the hosts that break the select into two
> lines are all NetBSD.

One explanation: the terminal only recognizes several lines as one logical
line if it had to wrap the line itself. If you're using an editor:
Editors are character based and this wouldn't happen. However, some editors
(e.g. vim) know this and trick the terminal emulator by appending a blank
to the last charcter in a line, thus forcing the terminal to wrap it, but
then continue to address the terminal based on single characters.

Perhaps this sort of applies to your case and helps locating.

Barry Margolin

unread,
Sep 13, 2012, 11:46:49 AM9/13/12
to
In article <k2r68t...@news.in-ulm.de>,
Not necessarily adding a blank, but using explicit cursor positioning
commands to move the cursor from the end of line N to the beginning of
line N+1.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

John Gordon

unread,
Sep 14, 2012, 12:29:57 AM9/14/12
to
In <k2r68t...@news.in-ulm.de> Sven Mascheck <masc...@email.invalid> writes:

> Editors are character based and this wouldn't happen. However, some editors
> (e.g. vim) know this and trick the terminal emulator by appending a blank

Aha! That may be the reason. vi is aliased to vim on the Linux machines
but not on the NetBSD boxes.

Thanks.

Sven Mascheck

unread,
Sep 17, 2012, 7:18:36 PM9/17/12
to
Barry Margolin wrote:
> In article <k2r68t...@news.in-ulm.de>,
> Sven Mascheck <masc...@email.invalid> wrote:
>>
>> One explanation: the terminal only recognizes several lines as one logical
>> line if it had to wrap the line itself. If you're using an editor:
>> Editors are character based and this wouldn't happen. However, some editors
>> (e.g. vim) know this and trick the terminal emulator by appending a blank
>> to the last charcter in a line, thus forcing the terminal to wrap it, but
>> then continue to address the terminal based on single characters. [...]

> Not necessarily adding a blank, but using explicit cursor positioning
> commands to move the cursor from the end of line N to the beginning of
> line N+1.

Isn't that what all curses based editors usually would do anyway?
Or what movement do have in mind? I wonder how the terminal
could decide on wrapping if the editor uses absolute addressing.
0 new messages