summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 61817e8)
raw | patch | inline | side by side (parent: 61817e8)
author | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 3 Oct 2010 04:55:53 +0000 (00:55 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 3 Oct 2010 04:56:58 +0000 (00:56 -0400) |
tig.c | patch | blob | history |
index 801fccd4914e0338a8e23e576d3dded09f8ee8a2..390923adb7121a767b4c68c79ba035d08f8b2370 100644 (file)
--- a/tig.c
+++ b/tig.c
/* The display array of active views and the index of the current view. */
static struct view *display[2];
+static WINDOW *display_win[2];
+static WINDOW *display_title[2];
static unsigned int current_view;
#define foreach_displayed_view(view, i) \
int height, width; /* The width and height of the main window */
WINDOW *win; /* The main window */
- WINDOW *title; /* The title window living below the main window */
/* Navigation */
unsigned long offset; /* Offset of the window top */
char buf[SIZEOF_STR];
char state[SIZEOF_STR];
size_t bufpos = 0, statelen = 0;
+ WINDOW *window = display[0] == view ? display_title[0] : display_title[1];
assert(view_is_displayed(view));
}
if (view == display[current_view])
- wbkgdset(view->title, get_line_attr(LINE_TITLE_FOCUS));
+ wbkgdset(window, get_line_attr(LINE_TITLE_FOCUS));
else
- wbkgdset(view->title, get_line_attr(LINE_TITLE_BLUR));
+ wbkgdset(window, get_line_attr(LINE_TITLE_BLUR));
- mvwaddnstr(view->title, 0, 0, buf, bufpos);
- wclrtoeol(view->title);
- wnoutrefresh(view->title);
+ mvwaddnstr(window, 0, 0, buf, bufpos);
+ wclrtoeol(window);
+ wnoutrefresh(window);
}
static int
offset = 0;
foreach_displayed_view (view, i) {
- if (!view->win) {
- view->win = newwin(view->height, 0, offset, 0);
- if (!view->win)
+ if (!display_win[i]) {
+ display_win[i] = newwin(view->height, 0, offset, 0);
+ if (!display_win[i])
die("Failed to create %s view", view->name);
- scrollok(view->win, FALSE);
+ scrollok(display_win[i], FALSE);
- view->title = newwin(1, 0, offset + view->height, 0);
- if (!view->title)
+ display_title[i] = newwin(1, 0, offset + view->height, 0);
+ if (!display_title[i])
die("Failed to create title window");
} else {
- wresize(view->win, view->height, view->width);
- mvwin(view->win, offset, 0);
- mvwin(view->title, offset + view->height, 0);
+ wresize(display_win[i], view->height, view->width);
+ mvwin(display_win[i], offset, 0);
+ mvwin(display_title[i], offset + view->height, 0);
}
+ view->win = display_win[i];
+
offset += view->height + 1;
}
}