diff options
author | Glauber Campinho <[email protected]> | 2017-09-01 15:12:48 +0200 |
---|---|---|
committer | Glauber Campinho <[email protected]> | 2017-09-13 15:16:18 +0200 |
commit | c128db95440cc4caf34cbad5e91e1e26bb5fa6a3 (patch) | |
tree | 9189904cbbd1a1cb18bce5a3ce4dc5013ff73589 | |
parent | 1e57f7471d60d60d9c837051d4625a35d779c520 (diff) | |
download | otp-c128db95440cc4caf34cbad5e91e1e26bb5fa6a3.tar.gz otp-c128db95440cc4caf34cbad5e91e1e26bb5fa6a3.tar.bz2 otp-c128db95440cc4caf34cbad5e91e1e26bb5fa6a3.zip |
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
-rw-r--r-- | erts/emulator/drivers/unix/ttsl_drv.c | 10 |
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) { |