From 076d6f052ee56937c51915c0d770cfd0bae738ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Thu, 11 Feb 2021 21:51:22 -0500
Subject: [PATCH] Fix initial bar calculation.

After calculating i (offset in list to top of window), if it's less
than zero, apply it to bar and set i = 0.

Fixes #218
---
 src/uifc/uifc32.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c
index 53caa23d1d..25be3ff9d0 100644
--- a/src/uifc/uifc32.c
+++ b/src/uifc/uifc32.c
@@ -928,6 +928,10 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
 			if((*bar)<0)
 				(*bar)=0;
 			i=(*cur)-(*bar);
+			if (i < 0) {
+				*bar += i;
+				i = 0;
+			}
 			if(i+(height-vbrdrsize-1)>=opts) {
 				(*bar)=(height-vbrdrsize);
 				if (*bar > *cur)
-- 
GitLab