projects
/
apps
/
madtty.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
debug
[apps/madtty.git]
/
madtty
/
madtty.c
diff --git
a/madtty/madtty.c
b/madtty/madtty.c
index
5b51618
..
af12870
100644
(file)
--- a/
madtty/madtty.c
+++ b/
madtty/madtty.c
@@
-612,6
+612,17
@@
static void try_interpret_escape_seq(madtty_t *t)
if (t->elen + 1 >= (int)sizeof(t->ebuf)) {
cancel:
if (t->elen + 1 >= (int)sizeof(t->ebuf)) {
cancel:
+#ifndef NDEBUG
+ fprintf(stderr, "cancelled: \\033");
+ for (int i = 0; i < (int)t->elen; i++) {
+ if (isprint(t->ebuf[i])) {
+ fputc(t->ebuf[i], stderr);
+ } else {
+ fprintf(stderr, "\\%03o", t->ebuf[i]);
+ }
+ }
+ fputc('\n', stderr);
+#endif
cancel_escape_sequence(t);
}
}
cancel_escape_sequence(t);
}
}
@@
-671,7
+682,7
@@
static uint16_t const vt100_0[62] = { // 41 .. 7e
0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3, 0x00b7, // 78-7e
};
0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3, 0x00b7, // 78-7e
};
-void madtty_putc(madtty_t *t, wchar_t wc)
+
static
void madtty_putc(madtty_t *t, wchar_t wc)
{
int width = 0;
{
int width = 0;
@@
-963,7
+974,7
@@
void madtty_keypress(madtty_t *t, int keycode)
void madtty_init_colors(void)
{
void madtty_init_colors(void)
{
- if (COLOR
S > 8
) {
+ if (COLOR
_PAIRS > 64
) {
use_default_colors();
assume_default_colors(-1, -1);
has_default = 1;
use_default_colors();
assume_default_colors(-1, -1);
has_default = 1;
@@
-984,5
+995,16
@@
void madtty_init_colors(void)
int madtty_color_pair(int fg, int bg)
{
int madtty_color_pair(int fg, int bg)
{
- return has_default ? (fg + 1) * 16 + bg + 1 : (7 - fg) * 8 + bg;
+ if (has_default) {
+ if (fg < -1)
+ fg = -1;
+ if (bg < -1)
+ bg = -1;
+ return COLOR_PAIR((fg + 1) * 16 + bg + 1);
+ }
+ if (fg < 0)
+ fg = COLOR_WHITE;
+ if (bg < 0)
+ bg = COLOR_BLACK;
+ return COLOR_PAIR((7 - fg) * 8 + bg);
}
}