1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Display when scrolled up

Display [SCROLLED] in titlebar if a chat/muc/private win is scrolled up.

Implement https://github.com/profanity-im/profanity/issues/1289
This commit is contained in:
Michael Vetter 2020-05-20 15:59:57 +02:00
parent d9edfa2da9
commit 469fa8f863

View File

@ -65,6 +65,7 @@ static void _show_self_presence(void);
static void _show_contact_presence(ProfChatWin *chatwin);
static void _show_privacy(ProfChatWin *chatwin);
static void _show_muc_privacy(ProfMucWin *mucwin);
static void _show_scrolled(ProfWin *current);
void
create_title_bar(void)
@ -201,6 +202,7 @@ _title_bar_draw(void)
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
_show_contact_presence(chatwin);
_show_privacy(chatwin);
_show_scrolled(current);
if (typing) {
wprintw(win, " (typing...)");
@ -209,6 +211,7 @@ _title_bar_draw(void)
ProfMucWin *mucwin = (ProfMucWin*) current;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
_show_muc_privacy(mucwin);
_show_scrolled(current);
}
_show_self_presence();
@ -217,6 +220,24 @@ _title_bar_draw(void)
inp_put_back();
}
static void
_show_scrolled(ProfWin *current)
{
if (current && current->layout->paged == 1) {
int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
wattron(win, bracket_attrs);
wprintw(win, "[");
wattroff(win, bracket_attrs);
wprintw(win, "SCROLLED");
wattron(win, bracket_attrs);
wprintw(win, "]");
wattroff(win, bracket_attrs);
}
}
static void
_show_self_presence(void)
{