[vim/vim] Vim sends last character of line twice when running in xterm.js (#1626)

88 views
Skip to first unread message

Lucian Buzzo

unread,
Apr 10, 2017, 4:24:27 AM4/10/17
to vim/vim, Subscribed

I'm working on a new feature for xterm.js that allows line reflow.
sourcelair/xterm.js#609
I've found that when vim wraps a line that is too long, it sends the last character of the line twice.
Here is an example of the string data sent at 26 cols:

�[m�[H�[2J�[1;1Hlorem ipsum dolor sit amet�[2;1H�[1m�[34m~                         �[3;1H~

Then if I resize to 25 cols I get this:

�[m�[H�[2J�[1;1Hlorem ipsum dolor sit amee�[2;1Ht
�[1m�[34m~ 

As you can see the e in amet is duplicated and vim sends a line with a length of 26 characters, even though the terminal width is set to 25 cols.

If I reduce the size by 1 column again, I get this:

�[m�[H�[2J�[1;1Hlorem ipsum dolor sit amm�[2;1Het
�[1m�[34m~           

This time the m is duplicated, as it's the last character on that row.

I've found that this is happening when the terminal is xterm-color and vt100.

I'm not sure why this is happening and I was hoping the the Vim community could shed some light on this issue.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

Bram Moolenaar

unread,
Apr 10, 2017, 5:05:32 PM4/10/17
to vim/vim, Subscribed

Lucian Buzzo wrote:

> I'm working on a new feature for xterm.js that allows line reflow.
> https://github.com/sourcelair/xterm.js/pull/609

> I've found that when vim wraps a line that is too long, it sends the last character of the line twice.
> Here is an example of the string data sent at 26 cols:
> ```
> [m [H [2J [1;1Hlorem ipsum dolor sit amet [2;1H [1m [34m~ [3;1H~
> ```
> Then if I resize to 25 cols I get this:
> ```
> [m [H [2J [1;1Hlorem ipsum dolor sit amee [2;1Ht
> [1m [34m~
> ```
> As you can see the `e` in `amet` is duplicated and vim sends a line with a length of 26 characters, even though the terminal width is set to 25 cols.
>
> If I reduce the size by 1 column again, I get this:
> ```
> [m [H [2J [1;1Hlorem ipsum dolor sit amm [2;1Het
> [1m [34m~
> ```
> This time the `m` is duplicated, as it's the last character on that row.
>
> I've found that this is happening when the terminal is `xterm-color` and `vt100`.

>
> I'm not sure why this is happening and I was hoping the the Vim
> community could shed some light on this issue.

This is intentional. It's used to signal that the line continues,
instead of has a line break. See src/screen.c, around line 5710.

xterm.js should replicate the behavior.

--
Yah, well, we had to carve our electrons out of driftwood we'd
find. In the winter. Uphill. Both ways.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Lucian Buzzo

unread,
Apr 11, 2017, 4:23:08 AM4/11/17
to vim/vim, Subscribed

@brammool Thanks for the response!
What do you mean by "xterm.js should replicate the behavior" ? Perhaps I am being dense, but I don't understand what you mean 😄

Bram Moolenaar

unread,
Apr 11, 2017, 4:38:16 PM4/11/17
to vim/vim, Subscribed

Lucian Buzzo wrote:

> @brammool Thanks for the response!
> What do you mean by "xterm.js should replicate the behavior" ? Perhaps
> I am being dense, but I don't understand what you mean 𐟘„

If xterm.js is to be compatible with xterm, it should handle this
sequence of characters in the same way. Assuming you support
copy&paste.

--
Not too long ago, unzipping in public was illegal...


/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Lucian Buzzo

unread,
Apr 12, 2017, 2:13:05 AM4/12/17
to vim/vim, Subscribed

Closed #1626.

Lucian Buzzo

unread,
Apr 12, 2017, 2:13:18 AM4/12/17
to vim/vim, Subscribed

@brammool Thanks for your help, I think this issue can be closed.

thecrazzymouse

unread,
Apr 12, 2022, 4:41:32 AM4/12/22
to vim/vim, Subscribed

This issue is still present in xterm.js


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/1626/1096371289@github.com>

Reply all
Reply to author
Forward
0 new messages