Moving cursor to the beginning of previous line #660

Open
opened 2021-06-23 12:08:51 +02:00 by keybreak · 4 comments
keybreak commented 2021-06-23 12:08:51 +02:00 (Migrated from github.com)

Instead of:

printf "\e[F"

one has to do

printf "\e[A\r"

to move the cursor to the beginning of the previous line.

In most terminals that's not the case, some interactive scripts may break.

Instead of: ``` printf "\e[F" ``` one has to do ``` printf "\e[A\r" ``` to move the cursor to the beginning of the previous line. In most terminals that's not the case, some interactive scripts may break.
yurikhan commented 2021-06-23 18:08:39 +02:00 (Migrated from github.com)

Scripts that send hardcoded escape sequences are broken to begin with. Instead, scripts should use tput that will consult the terminfo database for the current terminal and emit the relevant sequences.

Also, \e[F is not featured in xterm’s terminfo, while \e[A is (as capability cuu1).

The fact that cool-retro-term sets the TERM variable to xterm is only tangentially related to the point I’m driving here.

Scripts that send hardcoded escape sequences are broken to begin with. Instead, scripts should use `tput` that will consult the terminfo database for the current terminal and emit the relevant sequences. Also, `\e[F` is not featured in `xterm`’s terminfo, while `\e[A` is (as capability `cuu1`). The fact that `cool-retro-term` sets the `TERM` variable to `xterm` is only tangentially related to the point I’m driving here.
keybreak commented 2021-06-23 21:36:23 +02:00 (Migrated from github.com)

In xterm you can use \e[F.

In xterm you can use `\e[F`.
yurikhan commented 2021-06-24 07:38:58 +02:00 (Migrated from github.com)

You’re missing the point. Yes, xterm implements \e[F and documents it in its own manual. No, you cannot use it portably in scripts, because it is not exposed in the terminfo database.

You’re missing the point. Yes, xterm *implements* `\e[F` and *documents* it in its own manual. No, you *cannot use it portably* in scripts, because it is not exposed in the terminfo database.
keybreak commented 2021-06-24 08:56:10 +02:00 (Migrated from github.com)

Well yeah because some choose not to, it's not something to debate really.
Most of the terminals i've tested support it, even most debloated of all st or even freaking Windows 🤣

So i'd absolutely love CRT to support it as well and become one of the serious and more compatible ones.

Well yeah because **some** choose not to, it's not something to debate really. Most of the terminals i've tested support it, even most debloated of all `st` or even freaking Windows :rofl: So i'd absolutely love CRT to support it as well and become one of the serious and more compatible ones.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: seeseemelk/cool-retro-term#660
No description provided.