st

simple terminal

git clone https://9o.is/git/st.git

commit 64307a33333e42327d44a78181fac8e3b3d2eba6
parent e25ebb836156f570945721dca8b6f3fd336cadb4
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 30 Mar 2024 12:30:49 +0100

Revert "Fix cursor move with wide glyphs"

This reverts commit 8ccab2e68b15e8396effc21fa2ae509b140d7639.

This patch needs some more work. It caused regressions with programs that use
GNU readline, etc.

Original test-case example from Tim Culverhouse <tim@timculverhouse.com>:

	printf " 😀" && sleep 2 && printf "\e[D" && sleep 2 && printf "\e[D" && sleep 2

After the patch it caused regressions, example test-case:

	printf "A歗\bB\n"

Diffstat:
Mst.c | 10+++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/st.c b/st.c @@ -86,8 +86,8 @@ enum escape_state { typedef struct { Glyph attr; /* current char attributes */ - int x; /* terminal column */ - int y; /* terminal row */ + int x; + int y; char state; } TCursor; @@ -2175,16 +2175,12 @@ tstrsequence(uchar c) void tcontrolcode(uchar ascii) { - size_t i; - switch (ascii) { case '\t': /* HT */ tputtab(1); return; case '\b': /* BS */ - for (i = 1; term.c.x && term.line[term.c.y][term.c.x - i].u == 0; ++i) - ; - tmoveto(term.c.x - i, term.c.y); + tmoveto(term.c.x-1, term.c.y); return; case '\r': /* CR */ tmoveto(0, term.c.y);