Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save uwabami/55feca5bdbe8042b3441cafa738a63c9 to your computer and use it in GitHub Desktop.
Save uwabami/55feca5bdbe8042b3441cafa738a63c9 to your computer and use it in GitHub Desktop.
tmux v2.6 で 罫線描画を全て ASCII とする patch. 代替文字として良いのがあったら教えて下さい
From: Youhei SASAKI <uwabami@gfd-dennou.org>
Date: Fri, 27 Oct 2017 12:32:42 +0900
Subject: Use ASCII char for box drawning with option pane-border-ascii
Signed-off-by: Youhei SASAKI <uwabami@gfd-dennou.org>
---
options-table.c | 6 ++++++
tty-acs.c | 67 +++++++++++++++++++++++++++++----------------------------
2 files changed, 40 insertions(+), 33 deletions(-)
--- a/options-table.c
+++ b/options-table.c
@@ -315,6 +315,12 @@
.default_num = 0
},
+ { .name = "pane-border-ascii",
+ .type = OPTIONS_TABLE_FLAG,
+ .scope = OPTIONS_TABLE_SESSION,
+ .default_num = 1
+ },
+
{ .name = "prefix",
.type = OPTIONS_TABLE_KEY,
.scope = OPTIONS_TABLE_SESSION,
--- a/tty-acs.c
+++ b/tty-acs.c
@@ -30,38 +30,38 @@
const char *string;
};
static const struct tty_acs_entry tty_acs_table[] = {
- { '+', "\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', "\342\224\230" }, /* lower right corner */
- { 'k', "\342\224\220" }, /* upper right corner */
- { 'l', "\342\224\214" }, /* upper left corner */
- { 'm', "\342\224\224" }, /* lower left corner */
- { 'n', "\342\224\274" }, /* large plus or crossover */
- { 'o', "\342\216\272" }, /* scan line 1 */
- { 'p', "\342\216\273" }, /* scan line 3 */
- { 'q', "\342\224\200" }, /* horizontal line */
- { 'r', "\342\216\274" }, /* scan line 7 */
- { 's', "\342\216\275" }, /* scan line 9 */
- { 't', "\342\224\234" }, /* tee pointing right */
- { 'u', "\342\224\244" }, /* tee pointing left */
- { 'v', "\342\224\264" }, /* tee pointing up */
- { 'w', "\342\224\254" }, /* tee pointing down */
- { 'x', "\342\224\202" }, /* 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 */
- { '~', "\302\267" } /* bullet */
+ { '+', ">" }, /* arrow pointing right */
+ { ',', "<" }, /* arrow pointing left */
+ { '-', "^" }, /* arrow pointing up */
+ { '.', "." }, /* arrow pointing down */
+ { '0', "#" }, /* solid square block */
+ { '`', "#" }, /* diamond */
+ { 'a', "#" }, /* checker board (stipple) */
+ { 'f', "#" }, /* degree symbol */
+ { 'g', "#" }, /* plus/minus */
+ { 'h', "#" }, /* board of squares */
+ { 'i', "" }, /* lantern symbol */
+ { 'j', "+" }, /* lower right corner */
+ { 'k', "+" }, /* upper right corner */
+ { 'l', "+" }, /* upper left corner */
+ { 'm', "+" }, /* lower left corner */
+ { 'n', "+" }, /* large plus or crossover */
+ { 'o', "_" }, /* scan line 1 */
+ { 'p', "_" }, /* scan line 3 */
+ { 'q', "-" }, /* horizontal line */
+ { 'r', "_" }, /* scan line 7 */
+ { 's', "_" }, /* scan line 9 */
+ { 't', "+" }, /* tee pointing right */
+ { 'u', "+" }, /* tee pointing left */
+ { 'v', "+" }, /* tee pointing up */
+ { 'w', "+" }, /* tee pointing down */
+ { 'x', "|" }, /* vertical line */
+ { 'y', "#" }, /* less-than-or-equal-to */
+ { 'z', "#" }, /* greater-than-or-equal-to */
+ { '{', "#" }, /* greek pi */
+ { '|', "#" }, /* not-equal */
+ { '}', "#" }, /* UK pound sign */
+ { '~', "*" } /* bullet */
};
static int
@@ -107,7 +107,8 @@
struct tty_acs_entry *entry;
/* Use the ACS set instead of UTF-8 if needed. */
- if (tty_acs_needed(tty)) {
+ if (tty_acs_needed(tty) ||
+ options_get_number(global_s_options, "pane-border-ascii") != 0) {
if (tty->term->acs[ch][0] == '\0')
return (NULL);
return (&tty->term->acs[ch][0]);
From: Youhei SASAKI <uwabami@gfd-dennou.org>
Date: Tue, 16 May 2017 18:43:52 +0900
Subject: Use box drawing DECSP or ASCII with option pane-border-ascii
Signed-off-by: Youhei SASAKI <uwabami@gfd-dennou.org>
---
options-table.c | 6 +++++
tty-acs.c | 68 ++++++++++++++++++++++++++++-----------------------------
tty.c | 2 +-
3 files changed, 41 insertions(+), 35 deletions(-)
diff --git a/options-table.c b/options-table.c
index 403509b..8f8065f 100644
--- a/options-table.c
+++ b/options-table.c
@@ -298,6 +298,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 = 1
+ },
+
{ .name = "prefix",
.type = OPTIONS_TABLE_KEY,
.scope = OPTIONS_TABLE_SESSION,
diff --git a/tty-acs.c b/tty-acs.c
index 6e3103d..8f03a7e 100644
--- a/tty-acs.c
+++ b/tty-acs.c
@@ -30,38 +30,38 @@ struct tty_acs_entry {
const char *string;
};
static const struct tty_acs_entry tty_acs_table[] = {
- { '+', "\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', "\342\224\230" }, /* lower right corner */
- { 'k', "\342\224\220" }, /* upper right corner */
- { 'l', "\342\224\214" }, /* upper left corner */
- { 'm', "\342\224\224" }, /* lower left corner */
- { 'n', "\342\224\274" }, /* large plus or crossover */
- { 'o', "\342\216\272" }, /* scan line 1 */
- { 'p', "\342\216\273" }, /* scan line 3 */
- { 'q', "\342\224\200" }, /* horizontal line */
- { 'r', "\342\216\274" }, /* scan line 7 */
- { 's', "\342\216\275" }, /* scan line 9 */
- { 't', "\342\224\234" }, /* tee pointing right */
- { 'u', "\342\224\244" }, /* tee pointing left */
- { 'v', "\342\224\264" }, /* tee pointing up */
- { 'w', "\342\224\254" }, /* tee pointing down */
- { 'x', "\342\224\202" }, /* 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 */
- { '~', "\302\267" } /* bullet */
+ { '+', ">" }, /* arrow pointing right */
+ { ',', "<" }, /* arrow pointing left */
+ { '-', "^" }, /* arrow pointing up */
+ { '.', "." }, /* arrow pointing down */
+ { '0', "#" }, /* solid square block */
+ { '`', "#" }, /* diamond */
+ { 'a', "#" }, /* checker board (stipple) */
+ { 'f', "#" }, /* degree symbol */
+ { 'g', "#" }, /* plus/minus */
+ { 'h', "#" }, /* board of squares */
+ { 'i', "#" }, /* lantern symbol */
+ { 'j', "+" }, /* lower right corner */
+ { 'k', "+" }, /* upper right corner */
+ { 'l', "+" }, /* upper left corner */
+ { 'm', "+" }, /* lower left corner */
+ { 'n', "+" }, /* large plus or crossover */
+ { 'o', "_" }, /* scan line 1 */
+ { 'p', "_" }, /* scan line 3 */
+ { 'q', "-" }, /* horizontal line */
+ { 'r', "_" }, /* scan line 7 */
+ { 's', "_" }, /* scan line 9 */
+ { 't', "+" }, /* tee pointing right */
+ { 'u', "+" }, /* tee pointing left */
+ { 'v', "+" }, /* tee pointing up */
+ { 'w', "+" }, /* tee pointing down */
+ { 'x', "|" }, /* vertical line */
+ { 'y', "#" }, /* less-than-or-equal-to */
+ { 'z', "#" }, /* greater-than-or-equal-to */
+ { '{', "#" }, /* greek pi */
+ { '|', "#" }, /* not-equal */
+ { '}', "#" }, /* UK pound sign */
+ { '~', "*" } /* bullet */
};
static int
@@ -80,8 +80,8 @@ tty_acs_get(struct tty *tty, u_char ch)
{
struct tty_acs_entry *entry;
- /* If not a UTF-8 terminal, use the ACS set. */
- if (tty != NULL && !(tty->flags & TTY_UTF8)) {
+ /* If pane-border-ascii */
+ if ( options_get_number(global_s_options, "pane-border-ascii") != 0 ) {
if (tty->term->acs[ch][0] == '\0')
return (NULL);
return (&tty->term->acs[ch][0]);
diff --git a/tty.c b/tty.c
index 14906cc..bbb8460 100644
--- a/tty.c
+++ b/tty.c
@@ -72,7 +72,7 @@ static void tty_default_attributes(struct tty *, const struct window_pane *,
u_int);
#define tty_use_acs(tty) \
- (tty_term_has((tty)->term, TTYC_ACSC) && !((tty)->flags & TTY_UTF8))
+ (tty_term_has((tty)->term, TTYC_ACSC) && (options_get_number(global_s_options, "pane-border-ascii") != 0 ))
#define tty_use_margin(tty) \
((tty)->term_type == TTY_VT420)
From: Youhei SASAKI <uwabami@gfd-dennou.org>
Date: Wed, 8 Aug 2018 17:23:23 +0900
Subject: Use boxdrawing with ASCII
Signed-off-by: Youhei SASAKI <uwabami@gfd-dennou.org>
Signed-off-by: Youhei SASAKI <uwabami@gfd-dennou.org>
---
tty-acs.c | 64 +++++++++++++++++++++++++++++++--------------------------------
1 file changed, 32 insertions(+), 32 deletions(-)
--- a/tty-acs.c
+++ b/tty-acs.c
@@ -30,42 +30,38 @@
const char *string;
};
static const struct tty_acs_entry tty_acs_table[] = {
- { '+', "\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) */
- { 'b', "\342\220\211" },
- { 'c', "\342\220\214" },
- { 'd', "\342\220\215" },
- { 'e', "\342\220\212" },
- { 'f', "\302\260" }, /* degree symbol */
- { 'g', "\302\261" }, /* plus/minus */
- { 'h', "\342\220\244" },
- { 'i', "\342\220\213" },
- { 'j', "\342\224\230" }, /* lower right corner */
- { 'k', "\342\224\220" }, /* upper right corner */
- { 'l', "\342\224\214" }, /* upper left corner */
- { 'm', "\342\224\224" }, /* lower left corner */
- { 'n', "\342\224\274" }, /* large plus or crossover */
- { 'o', "\342\216\272" }, /* scan line 1 */
- { 'p', "\342\216\273" }, /* scan line 3 */
- { 'q', "\342\224\200" }, /* horizontal line */
- { 'r', "\342\216\274" }, /* scan line 7 */
- { 's', "\342\216\275" }, /* scan line 9 */
- { 't', "\342\224\234" }, /* tee pointing right */
- { 'u', "\342\224\244" }, /* tee pointing left */
- { 'v', "\342\224\264" }, /* tee pointing up */
- { 'w', "\342\224\254" }, /* tee pointing down */
- { 'x', "\342\224\202" }, /* 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 */
- { '~', "\302\267" } /* bullet */
+ { '+', ">" }, /* arrow pointing right */
+ { ',', "<" }, /* arrow pointing left */
+ { '-', "^" }, /* arrow pointing up */
+ { '.', "." }, /* arrow pointing down */
+ { '0', "#" }, /* solid square block */
+ { '`', "#" }, /* diamond */
+ { 'a', "#" }, /* checker board (stipple) */
+ { 'f', "#" }, /* degree symbol */
+ { 'g', "#" }, /* plus/minus */
+ { 'h', "#" }, /* board of squares */
+ { 'i', "#" }, /* lantern symbol */
+ { 'j', "+" }, /* lower right corner */
+ { 'k', "+" }, /* upper right corner */
+ { 'l', "+" }, /* upper left corner */
+ { 'm', "+" }, /* lower left corner */
+ { 'n', "+" }, /* large plus or crossover */
+ { 'o', "_" }, /* scan line 1 */
+ { 'p', "_" }, /* scan line 3 */
+ { 'q', "-" }, /* horizontal line */
+ { 'r', "_" }, /* scan line 7 */
+ { 's', "_" }, /* scan line 9 */
+ { 't', "+" }, /* tee pointing right */
+ { 'u', "+" }, /* tee pointing left */
+ { 'v', "+" }, /* tee pointing up */
+ { 'w', "+" }, /* tee pointing down */
+ { 'x', "|" }, /* vertical line */
+ { 'y', "#" }, /* less-than-or-equal-to */
+ { 'z', "#" }, /* greater-than-or-equal-to */
+ { '{', "#" }, /* greek pi */
+ { '|', "#" }, /* not-equal */
+ { '}', "#" }, /* UK pound sign */
+ { '~', "*" } /* bullet */
};
static int
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment