Mercurial > pidgin
diff console/libgnt/gnttextview.c @ 14131:db2311999862
[gaim-migrate @ 16773]
Some adjustment to the scrollbars.
Deal with dialogs with NULL title.
Status-selector in the buddylist should always show the active status.
committer: Tailor Script <tailor@pidgin.im>
| author | Sadrul Habib Chowdhury <imadil@gmail.com> |
|---|---|
| date | Tue, 15 Aug 2006 18:05:14 +0000 |
| parents | f8ab496671fa |
| children | d6d3dbe85a4c |
line wrap: on
line diff
--- a/console/libgnt/gnttextview.c Tue Aug 15 08:59:11 2006 +0000 +++ b/console/libgnt/gnttextview.c Tue Aug 15 18:05:14 2006 +0000 @@ -26,7 +26,7 @@ GntTextView *view = GNT_TEXT_VIEW(widget); int i = 0; GList *lines; - int showing, position, rows, scrcol; + int rows, scrcol; werase(widget->window); @@ -51,11 +51,17 @@ rows = widget->priv.height - 2; if (rows > 0) { + int total = g_list_length(g_list_first(view->list)); + int showing, position, up, down; - showing = rows * rows / g_list_length(g_list_first(view->list)) + 1; + showing = rows * rows / total + 1; showing = MIN(rows, showing); - position = showing * g_list_length(view->list) / rows; + total -= rows; + up = g_list_length(lines); + down = total - up; + + position = (rows - showing) * up / MAX(1, up + down); position = MAX((lines != NULL), position); if (showing + position > rows)
