Created
June 13, 2022 23:36
-
-
Save adsr/fd0a42f72cfeffba8d2e282735338f89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/codegen.sh b/codegen.sh | |
index 7b0cc81..60d4aa7 100755 | |
--- a/codegen.sh | |
+++ b/codegen.sh | |
@@ -3,6 +3,7 @@ set -uo pipefail | |
read -r -d '' builtin_terms <<'EOD' | |
xterm | |
+ xterm-256color | |
linux | |
screen tmux | |
rxvt-256color | |
@@ -50,6 +51,7 @@ read -r -d '' terminfo_funcs <<'EOD' | |
rev REVERSE | |
smkx ENTER_KEYPAD | |
rmkx EXIT_KEYPAD | |
+ initc INIT_COLOR | |
EOD | |
read -r -d '' extra_keys <<'EOD' | |
diff --git a/termbox.h b/termbox.h | |
index 518b41e..86174f6 100644 | |
--- a/termbox.h | |
+++ b/termbox.h | |
@@ -110,7 +110,7 @@ extern "C" { | |
#define tb_key_i(i) 0xffff - (i) | |
/* Terminal-dependent key constants (tb_event.key) and terminfo capabilities */ | |
/* BEGIN codegen h */ | |
-/* Produced by ./codegen.sh on Sun, 19 Sep 2021 01:02:02 +0000 */ | |
+/* Produced by ./codegen.sh on Mon, 13 Jun 2022 23:36:01 +0000 */ | |
#define TB_KEY_F1 (0xffff - 0) | |
#define TB_KEY_F2 (0xffff - 1) | |
#define TB_KEY_F3 (0xffff - 2) | |
@@ -178,7 +178,8 @@ extern "C" { | |
#define TB_CAP_REVERSE 33 | |
#define TB_CAP_ENTER_KEYPAD 34 | |
#define TB_CAP_EXIT_KEYPAD 35 | |
-#define TB_CAP__COUNT 36 | |
+#define TB_CAP_INIT_COLOR 36 | |
+#define TB_CAP__COUNT 37 | |
/* END codegen h */ | |
/* Some hard-coded caps */ | |
@@ -621,7 +622,7 @@ struct tb_global_t { | |
static struct tb_global_t global = {0}; | |
/* BEGIN codegen c */ | |
-/* Produced by ./codegen.sh on Sun, 19 Sep 2021 01:02:03 +0000 */ | |
+/* Produced by ./codegen.sh on Mon, 13 Jun 2022 23:36:01 +0000 */ | |
static const int16_t terminfo_cap_indexes[] = { | |
66, // kf1 (TB_CAP_F1) | |
@@ -660,6 +661,7 @@ static const int16_t terminfo_cap_indexes[] = { | |
34, // rev (TB_CAP_REVERSE) | |
89, // smkx (TB_CAP_ENTER_KEYPAD) | |
88, // rmkx (TB_CAP_EXIT_KEYPAD) | |
+ 299, // initc (TB_CAP_INIT_COLOR) | |
}; | |
// xterm | |
@@ -700,6 +702,49 @@ static const char *xterm_caps[] = { | |
"\033[7m", // rev (TB_CAP_REVERSE) | |
"\033[?1h\033=", // smkx (TB_CAP_ENTER_KEYPAD) | |
"\033[?1l\033>", // rmkx (TB_CAP_EXIT_KEYPAD) | |
+ "", // initc (TB_CAP_INIT_COLOR) | |
+}; | |
+ | |
+// xterm-256color | |
+static const char *xterm_256color_caps[] = { | |
+ "\033OP", // kf1 (TB_CAP_F1) | |
+ "\033OQ", // kf2 (TB_CAP_F2) | |
+ "\033OR", // kf3 (TB_CAP_F3) | |
+ "\033OS", // kf4 (TB_CAP_F4) | |
+ "\033[15~", // kf5 (TB_CAP_F5) | |
+ "\033[17~", // kf6 (TB_CAP_F6) | |
+ "\033[18~", // kf7 (TB_CAP_F7) | |
+ "\033[19~", // kf8 (TB_CAP_F8) | |
+ "\033[20~", // kf9 (TB_CAP_F9) | |
+ "\033[21~", // kf10 (TB_CAP_F10) | |
+ "\033[23~", // kf11 (TB_CAP_F11) | |
+ "\033[24~", // kf12 (TB_CAP_F12) | |
+ "\033[2~", // kich1 (TB_CAP_INSERT) | |
+ "\033[3~", // kdch1 (TB_CAP_DELETE) | |
+ "\033OH", // khome (TB_CAP_HOME) | |
+ "\033OF", // kend (TB_CAP_END) | |
+ "\033[5~", // kpp (TB_CAP_PGUP) | |
+ "\033[6~", // knp (TB_CAP_PGDN) | |
+ "\033OA", // kcuu1 (TB_CAP_ARROW_UP) | |
+ "\033OB", // kcud1 (TB_CAP_ARROW_DOWN) | |
+ "\033OD", // kcub1 (TB_CAP_ARROW_LEFT) | |
+ "\033OC", // kcuf1 (TB_CAP_ARROW_RIGHT) | |
+ "\033[Z", // kcbt (TB_CAP_BACK_TAB) | |
+ "\033[?1049h\033[22;0;0t", // smcup (TB_CAP_ENTER_CA) | |
+ "\033[?1049l\033[23;0;0t", // rmcup (TB_CAP_EXIT_CA) | |
+ "\033[?12l\033[?25h", // cnorm (TB_CAP_SHOW_CURSOR) | |
+ "\033[?25l", // civis (TB_CAP_HIDE_CURSOR) | |
+ "\033[H\033[2J", // clear (TB_CAP_CLEAR_SCREEN) | |
+ "\033(B\033[m", // sgr0 (TB_CAP_SGR0) | |
+ "\033[4m", // smul (TB_CAP_UNDERLINE) | |
+ "\033[1m", // bold (TB_CAP_BOLD) | |
+ "\033[5m", // blink (TB_CAP_BLINK) | |
+ "\033[3m", // sitm (TB_CAP_ITALIC) | |
+ "\033[7m", // rev (TB_CAP_REVERSE) | |
+ "\033[?1h\033=", // smkx (TB_CAP_ENTER_KEYPAD) | |
+ "\033[?1l\033>", // rmkx (TB_CAP_EXIT_KEYPAD) | |
+ "\033]4;%p1%d;rgb:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/" | |
+ "%p4%{255}%*%{1000}%/%2.2X\033\134", // initc (TB_CAP_INIT_COLOR) | |
}; | |
// linux | |
@@ -726,7 +771,7 @@ static const char *linux_caps[] = { | |
"\033[B", // kcud1 (TB_CAP_ARROW_DOWN) | |
"\033[D", // kcub1 (TB_CAP_ARROW_LEFT) | |
"\033[C", // kcuf1 (TB_CAP_ARROW_RIGHT) | |
- "\033[Z", // kcbt (TB_CAP_BACK_TAB) | |
+ "\033\011", // kcbt (TB_CAP_BACK_TAB) | |
"", // smcup (TB_CAP_ENTER_CA) | |
"", // rmcup (TB_CAP_EXIT_CA) | |
"\033[?25h\033[?0c", // cnorm (TB_CAP_SHOW_CURSOR) | |
@@ -740,6 +785,8 @@ static const char *linux_caps[] = { | |
"\033[7m", // rev (TB_CAP_REVERSE) | |
"", // smkx (TB_CAP_ENTER_KEYPAD) | |
"", // rmkx (TB_CAP_EXIT_KEYPAD) | |
+ "\033]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/" | |
+ "%02x%p4%{255}%*%{1000}%/%02x", // initc (TB_CAP_INIT_COLOR) | |
}; | |
// screen | |
@@ -780,6 +827,7 @@ static const char *screen_caps[] = { | |
"\033[7m", // rev (TB_CAP_REVERSE) | |
"\033[?1h\033=", // smkx (TB_CAP_ENTER_KEYPAD) | |
"\033[?1l\033>", // rmkx (TB_CAP_EXIT_KEYPAD) | |
+ "", // initc (TB_CAP_INIT_COLOR) | |
}; | |
// rxvt-256color | |
@@ -820,6 +868,8 @@ static const char *rxvt_256color_caps[] = { | |
"\033[7m", // rev (TB_CAP_REVERSE) | |
"\033=", // smkx (TB_CAP_ENTER_KEYPAD) | |
"\033>", // rmkx (TB_CAP_EXIT_KEYPAD) | |
+ "\033]4;%p1%d;rgb:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/" | |
+ "%p4%{255}%*%{1000}%/%2.2X\033\134", // initc (TB_CAP_INIT_COLOR) | |
}; | |
// rxvt-unicode | |
@@ -860,6 +910,8 @@ static const char *rxvt_unicode_caps[] = { | |
"\033[7m", // rev (TB_CAP_REVERSE) | |
"\033=", // smkx (TB_CAP_ENTER_KEYPAD) | |
"\033>", // rmkx (TB_CAP_EXIT_KEYPAD) | |
+ "\033]4;%p1%d;rgb:%p2%{65535}%*%{1000}%/%4.4X/%p3%{65535}%*%{1000}%/%4.4X/" | |
+ "%p4%{65535}%*%{1000}%/%4.4X\033\134", // initc (TB_CAP_INIT_COLOR) | |
}; | |
// Eterm | |
@@ -900,6 +952,7 @@ static const char *eterm_caps[] = { | |
"\033[7m", // rev (TB_CAP_REVERSE) | |
"", // smkx (TB_CAP_ENTER_KEYPAD) | |
"", // rmkx (TB_CAP_EXIT_KEYPAD) | |
+ "", // initc (TB_CAP_INIT_COLOR) | |
}; | |
static struct { | |
@@ -907,13 +960,14 @@ static struct { | |
const char **caps; | |
const char *alias; | |
} builtin_terms[] = { | |
- {"xterm", xterm_caps, "" }, | |
- {"linux", linux_caps, "" }, | |
- {"screen", screen_caps, "tmux"}, | |
- {"rxvt-256color", rxvt_256color_caps, "" }, | |
- {"rxvt-unicode", rxvt_unicode_caps, "rxvt"}, | |
- {"Eterm", eterm_caps, "" }, | |
- {NULL, NULL, NULL }, | |
+ {"xterm", xterm_caps, "" }, | |
+ {"xterm-256color", xterm_256color_caps, "" }, | |
+ {"linux", linux_caps, "" }, | |
+ {"screen", screen_caps, "tmux"}, | |
+ {"rxvt-256color", rxvt_256color_caps, "" }, | |
+ {"rxvt-unicode", rxvt_unicode_caps, "rxvt"}, | |
+ {"Eterm", eterm_caps, "" }, | |
+ {NULL, NULL, NULL }, | |
}; | |
/* END codegen c */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment