Mercurial > hg
diff mcabber/src/screen.c @ 220:8dfdc6f1778e
[/trunk] Changeset 232 by mikael
* Fix a bug when displaying a multi-line message in a /clear-ed window
* Always make sure the last msg is displayed in the buffer window (fix another
problem with the /clear command...)
author | mikael |
---|---|
date | Sat, 04 Jun 2005 11:44:55 +0000 |
parents | c289e3c39c48 |
children | 9a6ba4b38e63 |
line wrap: on
line diff
--- a/mcabber/src/screen.c Tue May 31 16:56:49 2005 +0000 +++ b/mcabber/src/screen.c Sat Jun 04 11:44:55 2005 +0000 @@ -391,12 +391,27 @@ win_entry = scr_CreateBuddyPanel(winId, dont_show); } + // The message must be displayed -> update top pointer + if (win_entry->cleared) + win_entry->top = g_list_last(win_entry->hbuf); + hbuf_add_line(&win_entry->hbuf, text, timestamp, prefix_flags, maxX - ROSTER_WIDTH - PREFIX_WIDTH); if (win_entry->cleared) { - win_entry->cleared = 0; // The message must be displayed - win_entry->top = g_list_last(win_entry->hbuf); + win_entry->cleared = FALSE; + if (g_list_next(win_entry->top)) + win_entry->top = g_list_next(win_entry->top); + } + + // Make sure the last line appears in the window; update top if necessary + if (win_entry->top) { + int dist; + GList *first = g_list_first(win_entry->hbuf); + dist = g_list_position(first, g_list_last(win_entry->hbuf)) - + g_list_position(first, win_entry->top); + if (dist >= CHAT_WIN_HEIGHT) + win_entry->top = NULL; } if (!dont_show) {