summaryrefslogtreecommitdiff
path: root/erts/emulator/drivers
diff options
context:
space:
mode:
authorGlauber Campinho <glauber.campinho@soundcloud.com>2017-09-01 15:12:48 +0200
committerGlauber Campinho <glauber.campinho@soundcloud.com>2017-09-13 15:16:18 +0200
commitc128db95440cc4caf34cbad5e91e1e26bb5fa6a3 (patch)
tree9189904cbbd1a1cb18bce5a3ce4dc5013ff73589 /erts/emulator/drivers
parent1e57f7471d60d60d9c837051d4625a35d779c520 (diff)
downloaderlang-c128db95440cc4caf34cbad5e91e1e26bb5fa6a3.tar.gz
Fix del_chars not considering wide chars and update buffer length before calling write_buf
After deleting the chars the function `del_chars` was considering the code points to move the cursor back and not the graphemes
Diffstat (limited to 'erts/emulator/drivers')
-rw-r--r--erts/emulator/drivers/unix/ttsl_drv.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/erts/emulator/drivers/unix/ttsl_drv.c b/erts/emulator/drivers/unix/ttsl_drv.c
index 3d007173c4..2a508b02eb 100644
--- a/erts/emulator/drivers/unix/ttsl_drv.c
+++ b/erts/emulator/drivers/unix/ttsl_drv.c
@@ -936,10 +936,10 @@ static int put_chars(byte *s, int l)
int n;
n = insert_buf(s, l);
+ if (lpos > llen)
+ llen = lpos;
if (n > 0)
write_buf(lbuf + lpos - n, n);
- if (lpos > llen)
- llen = lpos;
return TRUE;
}
@@ -1016,7 +1016,7 @@ static int del_chars(int n)
outc(' ');
move_left(1);
}
- move_cursor(llen + l, lpos);
+ move_cursor(llen + gcs, lpos);
}
else if (pos < lpos) {
l = lpos - pos; /* Buffer characters */
@@ -1036,7 +1036,7 @@ static int del_chars(int n)
outc(' ');
move_left(1);
}
- move_cursor(llen + l, lpos);
+ move_cursor(llen + gcs, lpos);
}
return TRUE;
}
@@ -1289,7 +1289,7 @@ static int cp_pos_to_col(int cp_pos)
if (cp_pos > llen) {
col += cp_pos - llen;
- cp_pos = llen;
+ cp_pos = llen;
}
while (i < cp_pos) {