summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2024-03-30 12:30:49 +0100
committerRafael Marçalo <raroma09@gmail.com>2024-03-30 18:47:06 +0000
commitc2a8459e2260b96b9abad59c9ed9c894d2881fa3 (patch)
tree146d29f08a39242fcc2f0f6787a3c69b3c9bf57c
parent705b83a7e7d5af4d15c8ca2f0be88fcd8a91d5b0 (diff)
Revert "Fix cursor move with wide glyphs"
This reverts commit 7473a8d1a57e5f9aba41b953f4e498c35e1c9dc5. 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"
-rw-r--r--st.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/st.c b/st.c
index 61799a7..356d1da 100644
--- a/st.c
+++ b/st.c
@@ -90,8 +90,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;
@@ -2263,16 +2263,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);