projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wibble
[apps/madmutt.git]
/
lib-ui
/
madtty.c
diff --git
a/lib-ui/madtty.c
b/lib-ui/madtty.c
index
135e9a7
..
85bd257
100644
(file)
--- a/
lib-ui/madtty.c
+++ b/
lib-ui/madtty.c
@@
-19,19
+19,12
@@
Copyright © 2006 Pierre Habouzit
*/
Copyright © 2006 Pierre Habouzit
*/
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
+#include <lib-ui/lib-ui.h>
+
#include <fcntl.h>
#include <pty.h>
#include <fcntl.h>
#include <pty.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <termios.h>
#include <termios.h>
-#include <wchar.h>
#include "madtty.h"
#include "madtty.h"
@@
-962,7
+955,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;
@@
-983,9
+976,16
@@
void madtty_init_colors(void)
int madtty_color_pair(int fg, int bg)
{
int madtty_color_pair(int fg, int bg)
{
- if (fg < -1)
- fg = -1;
- if (bg < -1)
- bg = -1;
- return COLOR_PAIR(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);
}
}