Implement split scrolling

weechat-hashes
C. McEnroe 2020-04-06 13:46:35 -04:00
parent 1969c9125f
commit 62a3e3699c
1 changed files with 11 additions and 4 deletions

15
ui.c
View File

@ -258,6 +258,8 @@ static void errExit(void) {
reset_shell_mode(); reset_shell_mode();
} }
enum { SplitLines = 5 };
void uiInit(void) { void uiInit(void) {
initscr(); initscr();
cbreak(); cbreak();
@ -279,9 +281,8 @@ void uiInit(void) {
status = newwin(1, COLS, 0, 0); status = newwin(1, COLS, 0, 0);
if (!status) err(EX_OSERR, "newwin"); if (!status) err(EX_OSERR, "newwin");
marker = newwin(1, COLS, LINES - 2, 0); marker = newwin(1, COLS, BOTTOM - SplitLines - 1, 0);
short fg = 8 + COLOR_BLACK; wbkgd(marker, ACS_BULLET);
wbkgd(marker, '~' | colorAttr(fg) | COLOR_PAIR(colorPair(fg, -1)));
input = newpad(1, 1024); input = newpad(1, 1024);
if (!input) err(EX_OSERR, "newpad"); if (!input) err(EX_OSERR, "newpad");
@ -311,6 +312,12 @@ void uiDraw(void) {
if (window->scroll) { if (window->scroll) {
touchwin(marker); touchwin(marker);
wnoutrefresh(marker); wnoutrefresh(marker);
pnoutrefresh(
window->pad,
WindowLines - SplitLines, 0,
BOTTOM - SplitLines, 0,
BOTTOM - 1, RIGHT
);
} }
int y, x; int y, x;
getyx(input, y, x); getyx(input, y, x);
@ -655,7 +662,7 @@ static void reflow(struct Window *window) {
} }
static void resize(void) { static void resize(void) {
mvwin(marker, LINES - 2, 0); mvwin(marker, BOTTOM - SplitLines - 1, 0);
int height, width; int height, width;
getmaxyx(windows.ptrs[0]->pad, height, width); getmaxyx(windows.ptrs[0]->pad, height, width);
if (width == COLS) return; if (width == COLS) return;