summarylogtreecommitdiffstats
path: root/fullwidth-emoji.patch
diff options
context:
space:
mode:
authorRay Song2016-03-21 23:10:10 +0800
committerRay Song2016-03-21 23:10:10 +0800
commit7209ffc81f4d349a6fe3527153588ae5aa49e66d (patch)
treec4f698d1541866f4f0c1686ae517964f190f24c0 /fullwidth-emoji.patch
parent2cec4b17420736ae76a10836889edc4802feb6e8 (diff)
downloadaur-7209ffc81f4d349a6fe3527153588ae5aa49e66d.tar.gz
fix utf8 backspace
Diffstat (limited to 'fullwidth-emoji.patch')
-rw-r--r--fullwidth-emoji.patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/fullwidth-emoji.patch b/fullwidth-emoji.patch
index ebbbd6ac0fc..15b28e9e545 100644
--- a/fullwidth-emoji.patch
+++ b/fullwidth-emoji.patch
@@ -12,3 +12,33 @@
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. */