summarylogtreecommitdiffstats
path: root/fullwidth-emoji.patch
blob: 15b28e9e54547c9afc5db6689fdc30749004fd59 (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
40
41
42
43
44
--- a/vte-ng-0.42.4.a/src/vte.cc	2016-03-21 19:49:00.390775386 +0800
+++ b/vte-ng-0.42.4.a/src/vte.cc	2016-03-21 19:50:22.627904117 +0800
@@ -206,6 +206,11 @@
                 return 0;
         if (G_UNLIKELY (g_unichar_iswide (c)))
                 return 2;
+        if (G_UNLIKELY(0x25a0 <= c && c < 0x27c0 || // Geometric Shapes, Miscellaneous Symbols, Dingbats
+                       0x2b00 <= c && c < 0x2c00 || // Miscellaneous Symbols and Arrows
+                       0x1f300 <= c && c < 0x1f700 || // Miscellaneous Symbols and Pictographs ... Geometric Shapes Extended
+                       0))
+                return 2;
         if (G_LIKELY (utf8_ambiguous_width == 1))
                 return 1;
         if (G_UNLIKELY (g_unichar_iswide_cjk (c)))
--- a/vte-ng-0.42.4.a/src/vteseq.cc	2016-03-21 22:23:38.886288772 +0800
+++ b/vte-ng-0.42.4.a/src/vteseq.cc	2016-03-21 23:02:19.447553445 +0800
@@ -1533,12 +1533,23 @@
 static void
 vte_sequence_handler_backspace (VteTerminal *terminal, GValueArray *params)
 {
+        struct termios tio;
         _vte_terminal_ensure_cursor_is_onscreen(terminal);
-
-        if (terminal->pvt->screen->cursor.col > 0) {
-		/* There's room to move left, so do so. */
+        g_assert(tcgetattr(vte_pty_get_fd(terminal->pvt->pty), &tio) == 0);
+        if (tio.c_lflag & ICANON && tio.c_iflag & IUTF8) {
+                VteRowData *rowdata = _vte_terminal_ensure_row(terminal);
+                int col = terminal->pvt->screen->cursor.col;
+                if (col == 0)
+                        ;
+                else if (col > rowdata->len)
+                        col--;
+                else
+                        col = MAX(col - rowdata->cells[col-1].attr.columns, 0);
+                terminal->pvt->screen->cursor.col = col;
+        } else if (terminal->pvt->screen->cursor.col > 0) {
+                /* There's room to move left, so do so. */
                 terminal->pvt->screen->cursor.col--;
-	}
+        }
 }
 
 /* Cursor left N columns. */