Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
tmux: Fix a problems with displaying Ambiguous-width, Japanese Dakuten and Handakuten signs.
diff --git a/screen-write.c b/screen-write.c
index 15f8d07..8a175a6 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1334,6 +1334,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
ctx->cells++;
/* If the width is zero, combine onto the previous character. */
+ /*
if (width == 0) {
screen_write_collect_flush(ctx, 0);
if ((gc = screen_write_combine(ctx, &gc->data, &xx)) != 0) {
@@ -1346,6 +1347,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
}
return;
}
+ */
/* Flush any existing scrolling. */
screen_write_collect_flush(ctx, 1);
diff --git a/options-table.c b/options-table.c
index f5e973e..046f1e5 100644
--- a/options-table.c
+++ b/options-table.c
@@ -315,6 +315,12 @@ const struct options_table_entry options_table[] = {
.default_num = 0
},
+ { .name = "pane-border-ascii",
+ .type = OPTIONS_TABLE_FLAG,
+ .scope = OPTIONS_TABLE_SESSION,
+ .default_num = 0
+ },
+
{ .name = "prefix",
.type = OPTIONS_TABLE_KEY,
.scope = OPTIONS_TABLE_SESSION,
diff --git a/tty-acs.c b/tty-acs.c
index 1f7a2b1..8c5e92d 100644
--- a/tty-acs.c
+++ b/tty-acs.c
@@ -64,6 +64,41 @@ static const struct tty_acs_entry tty_acs_table[] = {
{ '~', "\302\267" } /* bullet */
};
+static const struct tty_acs_entry tty_acs_table_putty[] = {
+ { '+', "\342\206\222" }, /* arrow pointing right */
+ { ',', "\342\206\220" }, /* arrow pointing left */
+ { '-', "\342\206\221" }, /* arrow pointing up */
+ { '.', "\342\206\223" }, /* arrow pointing down */
+ { '0', "\342\226\256" }, /* solid square block */
+ { '`', "\342\227\206" }, /* diamond */
+ { 'a', "\342\226\222" }, /* checker board (stipple) */
+ { 'f', "\302\260" }, /* degree symbol */
+ { 'g', "\302\261" }, /* plus/minus */
+ { 'h', "\342\226\222" }, /* board of squares */
+ { 'i', "\342\230\203" }, /* lantern symbol */
+ { 'j', "+" }, /* lower right corner */
+ { 'k', "+" }, /* upper right corner */
+ { 'l', "+" }, /* upper left corner */
+ { 'm', "+" }, /* lower left corner */
+ { 'n', "+" }, /* large plus or crossover */
+ { 'o', "\342\216\272" }, /* scan line 1 */
+ { 'p', "\342\216\273" }, /* scan line 3 */
+ { 'q', "-" }, /* horizontal line */
+ { 'r', "\342\216\274" }, /* scan line 7 */
+ { 's', "\342\216\275" }, /* scan line 9 */
+ { 't', "+" }, /* tee pointing right */
+ { 'u', "+" }, /* tee pointing left */
+ { 'v', "+" }, /* tee pointing up */
+ { 'w', "+" }, /* tee pointing down */
+ { 'x', "|" }, /* vertical line */
+ { 'y', "\342\211\244" }, /* less-than-or-equal-to */
+ { 'z', "\342\211\245" }, /* greater-than-or-equal-to */
+ { '{', "\317\200" }, /* greek pi */
+ { '|', "\342\211\240" }, /* not-equal */
+ { '}', "\302\243" }, /* UK pound sign */
+ { '~', "*" } /* bullet */
+};
+
static int
tty_acs_cmp(const void *key, const void *value)
{
@@ -114,7 +149,9 @@ tty_acs_get(struct tty *tty, u_char ch)
}
/* Otherwise look up the UTF-8 translation. */
- entry = bsearch(&ch, tty_acs_table, nitems(tty_acs_table),
+ entry = bsearch(&ch,
+ options_get_number(global_s_options, "pane-border-ascii") ? tty_acs_table_putty : tty_acs_table,
+ nitems(tty_acs_table),
sizeof tty_acs_table[0], tty_acs_cmp);
if (entry == NULL)
return (NULL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment