changeset 680:1f8987e0e56c

Try to display as many buddylist items as possible
author Mikael Berthe <mikael@lilotux.net>
date Sat, 28 Jan 2006 18:02:24 +0100
parents 5933a8036672
children 8dc602a246a4
files mcabber/src/screen.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/screen.c	Sat Jan 28 17:40:00 2006 +0100
+++ b/mcabber/src/screen.c	Sat Jan 28 18:02:24 2006 +0100
@@ -713,7 +713,7 @@
   update_roster = FALSE;
 
   getmaxyx(rosterWnd, maxy, maxx);
-  maxx --;  // last char is for vertical border
+  maxx--;  // last char is for vertical border
   name[ROSTER_WIDTH-7] = 0;
 
   // cleanup of roster window
@@ -732,6 +732,11 @@
   }
 
   // Update offset if necessary
+  // a) Try to show as many buddylist items as possible
+  i = g_list_length(buddylist) - maxy;
+  if (0 <= i && i < offset)
+    offset = i;
+  // b) Make sure the current_buddy is visible
   i = g_list_position(buddylist, current_buddy);
   if (i == -1) { // This is bad
     scr_LogPrint(LPRINT_NORMAL, "Doh! Can't find current selected buddy!!");