From 6a23996c3891c3593691275ac66980bf6871ce23 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Fri, 2 Oct 2026 09:54:34 +1000 Subject: [PATCH] Fix log view showing   entities The server padded log lines by replacing every space with  , which only worked while the UI inserted log lines as HTML. Since the log is now rendered as text (inside
, so whitespace is preserved anyway), the
entities showed up literally. Store plain spaces instead.

Test: TestLogLinesContainNoHTMLEntities.
---
 src/screen.go      |  4 ++--
 src/screen_test.go | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/screen.go b/src/screen.go
index cc04ddc..5566214 100644
--- a/src/screen.go
+++ b/src/screen.go
@@ -109,7 +109,7 @@ func showInfo(str string) {
 
 		printLogOnScreen(logMsg, "info")
 
-		logAppend(strings.Replace(logMsg, " ", " ", -1))
+		logAppend(logMsg)
 
 	}
 
@@ -137,7 +137,7 @@ func showDebug(str string, level int) {
 
 		printLogOnScreen(logMsg, "debug")
 
-		logAppend(strings.Replace(logMsg, " ", " ", -1))
+		logAppend(logMsg)
 
 	}
 
diff --git a/src/screen_test.go b/src/screen_test.go
index 1b85c3c..e92ab26 100644
--- a/src/screen_test.go
+++ b/src/screen_test.go
@@ -106,3 +106,28 @@ func TestShowHighlightWithoutColon(t *testing.T) {
 		}
 	}
 }
+
+// The web UI renders log lines as text inside 
, so the server must store
+// plain spaces, not HTML entities.
+func TestLogLinesContainNoHTMLEntities(t *testing.T) {
+	var oldLimit = Settings.LogEntriesRAM
+	Settings.LogEntriesRAM = 500
+	t.Cleanup(func() { Settings.LogEntriesRAM = oldLimit })
+
+	resetWebScreenLog()
+	showInfo("Version:2.2.0 Build: 0201")
+	showDebug("Buffer Status:some debug text", 0)
+
+	snap := webScreenLogSnapshot()
+	if len(snap.Log) == 0 {
+		t.Fatal("no log lines recorded")
+	}
+	if !strings.Contains(snap.Log[0], "Version:                2.2.0 Build: 0201") {
+		t.Errorf("padding should be plain spaces, got %q", snap.Log[0])
+	}
+	for _, line := range snap.Log {
+		if strings.Contains(line, " ") {
+			t.Errorf("log line contains an HTML entity: %q", line)
+		}
+	}
+}