summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ui.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/ui.c b/ui.c
index 5d626ce..8bc3eae 100644
--- a/ui.c
+++ b/ui.c
@@ -41,32 +41,6 @@
 #define RIGHT (COLS - 1)
 #define WINDOW_LINES (LINES - 2)
 
-static short colorPairs;
-
-static void colorInit(void) {
-	start_color();
-	use_default_colors();
-	for (short pair = 0; pair < 16; ++pair) {
-		init_pair(1 + pair, pair % COLORS, -1);
-	}
-	colorPairs = 17;
-}
-
-static attr_t colorAttr(short fg) {
-	return (fg >= COLORS ? A_BOLD : A_NORMAL);
-}
-
-static short colorPair(short fg, short bg) {
-	if (bg == -1) return 1 + fg;
-	for (short pair = 17; pair < colorPairs; ++pair) {
-		short f, b;
-		pair_content(pair, &f, &b);
-		if (f == fg && b == bg) return pair;
-	}
-	init_pair(colorPairs, fg % COLORS, bg % COLORS);
-	return colorPairs++;
-}
-
 enum {
 	InputCols = 512,
 	PadLines = 512,
@@ -115,18 +89,46 @@ static struct Window *windowFor(size_t id) {
 	}
 	window = malloc(sizeof(*window));
 	if (!window) err(EX_OSERR, "malloc");
+
 	window->id = id;
 	window->pad = newpad(PadLines, COLS);
-	scrollok(window->pad, true);
-	wmove(window->pad, PadLines - 1, 0);
 	window->heat = Cold;
 	window->unread = 0;
 	window->scroll = PadLines;
 	window->mark = true;
+	scrollok(window->pad, true);
+	wmove(window->pad, PadLines - 1, 0);
+
 	windowAdd(window);
 	return window;
 }
 
+static short colorPairs;
+
+static void colorInit(void) {
+	start_color();
+	use_default_colors();
+	for (short pair = 0; pair < 16; ++pair) {
+		init_pair(1 + pair, pair % COLORS, -1);
+	}
+	colorPairs = 17;
+}
+
+static attr_t colorAttr(short fg) {
+	return (fg >= COLORS ? A_BOLD : A_NORMAL);
+}
+
+static short colorPair(short fg, short bg) {
+	if (bg == -1) return 1 + fg;
+	for (short pair = 17; pair < colorPairs; ++pair) {
+		short f, b;
+		pair_content(pair, &f, &b);
+		if (f == fg && b == bg) return pair;
+	}
+	init_pair(colorPairs, fg % COLORS, bg % COLORS);
+	return colorPairs++;
+}
+
 enum {
 	KeyFocusIn = KEY_MAX + 1,
 	KeyFocusOut,