From 7dd9d919ab5e843a682740a17c46010a53811bf1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Mon, 7 Apr 2025 01:33:46 -0400
Subject: [PATCH] Remove hot-spots as soon as they scroll off the screen.

Don't keep them around until there's no hotspots left.
---
 src/sbbs3/terminal.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/sbbs3/terminal.cpp b/src/sbbs3/terminal.cpp
index d8dea9c14c..69f844453d 100644
--- a/src/sbbs3/terminal.cpp
+++ b/src/sbbs3/terminal.cpp
@@ -24,10 +24,19 @@ void Terminal::scroll_hotspots(unsigned count)
 		return;
 	unsigned spots = 0;
 	unsigned remain = 0;
-	for (list_node_t* node = mouse_hotspots->first; node != NULL; node = node->next) {
+	list_node_t* node = mouse_hotspots->first;
+	while (node != NULL) {
 		struct mouse_hotspot* spot = (struct mouse_hotspot*)node->data;
-		spot->y -= count;
+		list_node_t* next = node->next;
+		if (spot->y >= count) {
+			spot->y -= count;
+			remain++;
+		}
+		else {
+			listRemoveNode(mouse_hotspots, node, true);
+		}
 		spots++;
+		node = next;
 	}
 #ifdef _DEBUG
 	if (spots)
-- 
GitLab