mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Added scroll handler
This commit is contained in:
parent
3b3ffcfb37
commit
a19c0a5989
@ -365,6 +365,26 @@ inp_block(void)
|
||||
wtimeout(inp_win, -1);
|
||||
}
|
||||
|
||||
void
|
||||
inp_win_handle_scroll(void)
|
||||
{
|
||||
int col = getcurx(inp_win);
|
||||
int wcols = getmaxx(stdscr);
|
||||
|
||||
// if lost cursor off screen, move contents to show it
|
||||
if (col >= pad_start + (wcols -2)) {
|
||||
pad_start = col - (wcols / 2);
|
||||
if (pad_start < 0) {
|
||||
pad_start = 0;
|
||||
}
|
||||
} else if (col <= pad_start) {
|
||||
pad_start = pad_start - (wcols / 2);
|
||||
if (pad_start < 0) {
|
||||
pad_start = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
inp_write(char *line, int offset)
|
||||
{
|
||||
@ -372,6 +392,8 @@ inp_write(char *line, int offset)
|
||||
werase(inp_win);
|
||||
waddstr(inp_win, line);
|
||||
wmove(inp_win, 0, col);
|
||||
inp_win_handle_scroll();
|
||||
|
||||
_inp_win_update_virtual();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user