Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
219:8b6adc3f1acc | 220:8dfdc6f1778e |
---|---|
389 // If the window entry doesn't exist yet, let's create it. | 389 // If the window entry doesn't exist yet, let's create it. |
390 if (win_entry == NULL) { | 390 if (win_entry == NULL) { |
391 win_entry = scr_CreateBuddyPanel(winId, dont_show); | 391 win_entry = scr_CreateBuddyPanel(winId, dont_show); |
392 } | 392 } |
393 | 393 |
394 // The message must be displayed -> update top pointer | |
395 if (win_entry->cleared) | |
396 win_entry->top = g_list_last(win_entry->hbuf); | |
397 | |
394 hbuf_add_line(&win_entry->hbuf, text, timestamp, prefix_flags, | 398 hbuf_add_line(&win_entry->hbuf, text, timestamp, prefix_flags, |
395 maxX - ROSTER_WIDTH - PREFIX_WIDTH); | 399 maxX - ROSTER_WIDTH - PREFIX_WIDTH); |
396 | 400 |
397 if (win_entry->cleared) { | 401 if (win_entry->cleared) { |
398 win_entry->cleared = 0; // The message must be displayed | 402 win_entry->cleared = FALSE; |
399 win_entry->top = g_list_last(win_entry->hbuf); | 403 if (g_list_next(win_entry->top)) |
404 win_entry->top = g_list_next(win_entry->top); | |
405 } | |
406 | |
407 // Make sure the last line appears in the window; update top if necessary | |
408 if (win_entry->top) { | |
409 int dist; | |
410 GList *first = g_list_first(win_entry->hbuf); | |
411 dist = g_list_position(first, g_list_last(win_entry->hbuf)) - | |
412 g_list_position(first, win_entry->top); | |
413 if (dist >= CHAT_WIN_HEIGHT) | |
414 win_entry->top = NULL; | |
400 } | 415 } |
401 | 416 |
402 if (!dont_show) { | 417 if (!dont_show) { |
403 // Show and refresh the window | 418 // Show and refresh the window |
404 top_panel(win_entry->panel); | 419 top_panel(win_entry->panel); |