Raphael PICCOLO
Raphael PICCOLO

Reputation: 2175

understanding CUB ansi escape sequence

i don't understand why sometimes the CUB sequence is allowed to continue through the previous line and sometimes not. the documentation tells it's not but in real situation... http://vt100.net/docs/vt100-ug/chapter3.html#CUB

for exemple i have a screen filled with spaces on 80 columns and 24 lines.

i am at position line 3, column 4 which can be set with escape sequence : \033[3;4H

i move the cursor on the left 10 times with sequence \033[10D wich will put me at position : line 2 column 76

so it worked ?!! and sometimes it doesn't

please save me ! :)

I can reduce the situation but this is where i saw it :

I'm writing a vt* emulator and everithing works fine. i can launch emacs/vim and others but then i launched vttest in putty with the "script" command to record every typed characters and sequences. like so :

# script test
Script started, file is test
# vttest
...

when i do "cat test" in putty for exemple, it replays everythings like i did. when i play it with my emulator i am able to parse and to analyse every escape sequence they provide, but the display is not the same.

Upvotes: 2

Views: 244

Answers (1)

Thomas Dickey
Thomas Dickey

Reputation: 54583

The wording on VT100.net is fairly clear:

If an attempt is made to move the cursor to the left of the left margin,
the cursor stops at the left margin.

In a recent discussion, someone pointed out that PuTTY honors a (non-VT100) capability bw, which quoting from ncurses' terminfo manual:

   auto_left_margin              bw         bw        cub1 wraps from col‐
                                                      umn 0 to last column 

PuTTY's behavior for wrapping at the margins differs from VT100s, as you have seen. ncurses has a terminal entry named "putty", simply because PuTTY differs from all of the other terminals enough to make using a nuisance otherwise.

Upvotes: 0

Related Questions