blob: 54188074dbff23128e8d3b4d9e88ab96f33338b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
diff --git i/screen-write.c w/screen-write.c
index e58d744..eabfa6d 100644
--- i/screen-write.c
+++ w/screen-write.c
@@ -18,8 +18,11 @@
#include <sys/types.h>
+#include <assert.h>
+#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "tmux.h"
@@ -494,8 +497,20 @@ screen_write_backspace(struct screen_write_ctx *ctx)
s->cy--;
s->cx = screen_size_x(s) - 1;
}
- } else
- s->cx--;
+ } else {
+ struct termios tio;
+ int fd = open(ctx->wp->tty, O_RDONLY);
+ assert(tcgetattr(fd, &tio) == 0);
+ close(fd);
+ if (tio.c_lflag & ICANON && tio.c_iflag & IUTF8 && ctx->wp->mode != &window_copy_mode) {
+ gl = &s->grid->linedata[s->grid->hsize + s->cy];
+ if (s->cx > 0 && s->cx-1 < gl->extdsize && gl->extddata[s->cx-1].data.width == 2)
+ s->cx -= 2;
+ else
+ s->cx--;
+ } else
+ s->cx--;
+ }
}
/* VT100 alignment test. */
|