Skip to content

Instantly share code, notes, and snippets.

@kota65535
Forked from waltarix/tmux-do-not-combine-utf8.patch
Last active November 23, 2016 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kota65535/7647c1c3e15352f6b76f629f157e7ebb to your computer and use it in GitHub Desktop.
Save kota65535/7647c1c3e15352f6b76f629f157e7ebb to your computer and use it in GitHub Desktop.
tmux: Fix a problems with displaying Ambiguous-width, Japanese Dakuten and Handakuten signs.
diff --git a/screen-write.c b/screen-write.c
index 2b7fba0..5cd1a48 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1052,6 +1052,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
* If the width is zero, combine onto the previous character, if
* there is space.
*/
+ /*
if (width == 0) {
if (screen_write_combine(ctx, &gc->data) == 0) {
screen_write_initctx(ctx, &ttyctx);
@@ -1059,6 +1060,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
}
return;
}
+ */
/* Initialise the redraw context. */
screen_write_initctx(ctx, &ttyctx);
diff --git a/options-table.c b/options-table.c
index 4898e55..4c78953 100644
--- a/options-table.c
+++ b/options-table.c
@@ -293,6 +293,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 7fd265d..967901d 100644
--- a/tty-acs.c
+++ b/tty-acs.c
@@ -64,6 +64,41 @@ const struct tty_acs_entry tty_acs_table[] = {
{ '~', "\302\267" } /* bullet */
};
+const struct tty_acs_entry tty_acs_table_putty[] = {
+ { '+', "\342\206\222" },
+ { ',', "\342\206\220" },
+ { '-', "\342\206\221" },
+ { '.', "\342\206\223" },
+ { '0', "\342\226\256" },
+ { '`', "\342\227\206" },
+ { 'a', "\342\226\222" },
+ { 'f', "\302\260" },
+ { 'g', "\302\261" },
+ { 'h', "\342\226\222" },
+ { 'i', "\342\230\203" },
+ { 'j', "+" },
+ { 'k', "+" },
+ { 'l', "+" },
+ { 'm', "+" },
+ { 'n', "+" },
+ { 'o', "\342\216\272" },
+ { 'p', "\342\216\273" },
+ { 'q', "-" },
+ { 'r', "\342\216\274" },
+ { 's', "\342\216\275" },
+ { 't', "+" },
+ { 'u', "+" },
+ { 'v', "+" },
+ { 'w', "+" },
+ { 'x', "|" },
+ { 'y', "\342\211\244" },
+ { 'z', "\342\211\245" },
+ { '{', "\317\200" },
+ { '|', "\342\211\240" },
+ { '}', "\302\243" },
+ { '~', "*" }
+};
+
int
tty_acs_cmp(const void *key, const void *value)
{
@@ -89,7 +124,8 @@ 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), sizeof tty_acs_table[0],
+ 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