Revert "Fix cursor move with wide glyphs"

This reverts commit 7473a8d1a5.

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"
This commit is contained in:
Hiltjo Posthuma 2024-03-30 12:30:49 +01:00
parent 5ce9716281
commit 8c68ec5241
1 changed files with 3 additions and 7 deletions

10
st.c
View File

@ -86,8 +86,8 @@ enum escape_state {
typedef struct { typedef struct {
Glyph attr; /* current char attributes */ Glyph attr; /* current char attributes */
int x; /* terminal column */ int x;
int y; /* terminal row */ int y;
char state; char state;
} TCursor; } TCursor;
@ -2175,16 +2175,12 @@ tstrsequence(uchar c)
void void
tcontrolcode(uchar ascii) tcontrolcode(uchar ascii)
{ {
size_t i;
switch (ascii) { switch (ascii) {
case '\t': /* HT */ case '\t': /* HT */
tputtab(1); tputtab(1);
return; return;
case '\b': /* BS */ 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-1, term.c.y);
;
tmoveto(term.c.x - i, term.c.y);
return; return;
case '\r': /* CR */ case '\r': /* CR */
tmoveto(0, term.c.y); tmoveto(0, term.c.y);