# HG changeset patch # User mikael # Date 1117885495 0 # Node ID 8dfdc6f1778e57f4432c4323cad3c7fcf1285c71 # Parent 8b6adc3f1acc784e8dcc6c8123660c10ef54d25e [/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...) diff -r 8b6adc3f1acc -r 8dfdc6f1778e mcabber/src/TODO --- a/mcabber/src/TODO Tue May 31 16:56:49 2005 +0000 +++ b/mcabber/src/TODO Sat Jun 04 11:44:55 2005 +0000 @@ -1,8 +1,6 @@ BUGS: -* /clear : does not scroll again when typing until bottom after issuing a - /clear command... * We should display a warning when we can't write (any more) logs (bad dir, no space left...) * Colors are misnamed diff -r 8b6adc3f1acc -r 8dfdc6f1778e mcabber/src/screen.c --- 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) {