From c5c8e8a39aa356b29ec3590739993bf8b252d2c9 Mon Sep 17 00:00:00 2001 From: verygoodlee <45035465+verygoodlee@users.noreply.github.com> Date: Fri, 30 Jan 2026 13:08:50 +0800 Subject: [PATCH] console.lua: allow scrolling up the log until only one line remains Currently, if some log lines have very long text that actually renders across multiple lines, even if you scroll to the top, the topmost content will be pushed out of the screen by these lines and will never be visible. In STATS page 2/4/5/0, you can scroll down until there is one line left on the screen, we can keep the scrolling behavior of the log consistent with it. --- player/lua/console.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/player/lua/console.lua b/player/lua/console.lua index 6603b685a3..d2bf222acb 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -761,9 +761,10 @@ local function render() local log_ass = "" local log_buffer = log_buffers[id] or {} - log_offset = math.max(math.min(log_offset, #log_buffer - max_lines), 0) - for i = #log_buffer - math.min(max_lines, #log_buffer) - log_offset + 1, - #log_buffer - log_offset do + log_offset = math.max(math.min(log_offset, #log_buffer - 1), 0) + local last = #log_buffer - log_offset + local first = math.max(last - math.min(max_lines, #log_buffer) + 1, 1) + for i = first, last do log_ass = log_ass .. style .. log_buffer[i].style .. ass_escape(log_buffer[i].text) .. "\\N" end