diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-09-10 12:44:25 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-09-10 12:44:25 +0200 |
| commit | 49196eba130b3ab4f0939f13d071aef3d0a70eab (patch) | |
| tree | 4d3f5d95dac9a8d01677ed66245f18796c63f695 /config.def.h | |
| parent | e46158f31369b8b16ed9ea3885b9def08afc4a55 (diff) | |
| download | vis-49196eba130b3ab4f0939f13d071aef3d0a70eab.tar.gz vis-49196eba130b3ab4f0939f13d071aef3d0a70eab.tar.xz | |
Simplify drawing of the window statusbar
Diffstat (limited to 'config.def.h')
| -rw-r--r-- | config.def.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/config.def.h b/config.def.h index 49a87fd..7ae374d 100644 --- a/config.def.h +++ b/config.def.h @@ -61,19 +61,19 @@ static Command cmds[] = { { /* array terminator */ }, }; -/* draw a statubar, do whatever you want with the given curses window */ -static void statusbar(WINDOW *win, bool active, const char *filename, size_t line, size_t col) { - int width, height; - getmaxyx(win, height, width); - (void)height; - wattrset(win, active ? A_REVERSE|A_BOLD : A_REVERSE); - mvwhline(win, 0, 0, ' ', width); - mvwprintw(win, 0, 0, "%s", filename); - char buf[width + 1]; - int len = snprintf(buf, width, "%d, %d", line, col); +/* draw a statubar, do whatever you want with win->statuswin curses window */ +static void statusbar(EditorWin *win) { + size_t line, col; + window_cursor_getxy(win->win, &line, &col); + wattrset(win->statuswin, vis->win == win ? A_REVERSE|A_BOLD : A_REVERSE); + mvwhline(win->statuswin, 0, 0, ' ', win->width); + mvwprintw(win->statuswin, 0, 0, "%s %s", text_filename(win->text), + text_modified(win->text) ? "[+]" : ""); + char buf[win->width + 1]; + int len = snprintf(buf, win->width, "%d, %d", line, col); if (len > 0) { buf[len] = '\0'; - mvwaddstr(win, 0, width - len - 1, buf); + mvwaddstr(win->statuswin, 0, win->width - len - 1, buf); } } |
