shithub: choc

Download patch

ref: 1138de4fb695a3ca5e4d06d75891fadce5cf7679
parent: 41c2cd24e6079e0883c1fde4230864343c7a05e8
author: Simon Howard <[email protected]>
date: Thu Feb 2 16:10:20 EST 2012

Fix scroll bar behavior (thanks Alexandre Xavier).

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2484

--- a/textscreen/txt_gui.c
+++ b/textscreen/txt_gui.c
@@ -269,9 +269,9 @@
 
     cursor_x = x + 1;
 
-    if (range > 1)
+    if (range > 0)
     {
-        cursor_x += (cursor * (w - 3)) / (range - 1);
+        cursor_x += (cursor * (w - 3)) / range;
     }
 
     if (cursor_x > x + w - 2)
@@ -320,9 +320,9 @@
         cursor_y = y + h - 2;
     }
 
-    if (range > 1)
+    if (range > 0)
     {
-        cursor_y += (cursor * (h - 3)) / (range - 1);
+        cursor_y += (cursor * (h - 3)) / range;
     }
 
     for (y1=y+1; y1<y+h-1; ++y1)