Added rounding to the percent of page in status bar.
authorDaniel Carl <danielcarl@gmx.de>
Sat, 20 Apr 2013 14:25:26 +0000 (16:25 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 20 Apr 2013 14:25:26 +0000 (16:25 +0200)
If the user scrolled to 1% of the page there was 0% shown and with 50G vimb
browser showed 49% in status bar. This patch adapts the rounding of the values
in the status bar so that they fit to the done scrolling.

src/main.c

index cb0e14a..caca584 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <sys/stat.h>
+#include <math.h>
 #include "main.h"
 #include "util.h"
 #include "command.h"
@@ -306,7 +307,7 @@ void vb_update_statusbar()
 
     /* show the scroll status */
     max = gtk_adjustment_get_upper(vb.gui.adjust_v) - gtk_adjustment_get_page_size(vb.gui.adjust_v);
-    val = (int)(gtk_adjustment_get_value(vb.gui.adjust_v) / max * 100);
+    val = (int)floor(0.5 + (gtk_adjustment_get_value(vb.gui.adjust_v) / max * 100));
 
     if (max == 0) {
         g_string_append(status, " All");