From 5cf080f1adbc9071e04559a4e82e74ee417c5d80 Mon Sep 17 00:00:00 2001 From: Jake Stewart Date: Mon, 16 Oct 2023 01:37:58 +0800 Subject: [PATCH] fix preview scrolling bug --- src/item_preview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/item_preview.cpp b/src/item_preview.cpp index a299e14..05012e7 100644 --- a/src/item_preview.cpp +++ b/src/item_preview.cpp @@ -42,7 +42,7 @@ bool ItemPreview::scrollDown(int lines) { return true; } else if (!m_optimizeAnsi || lines >= m_height) { - m_offset = std::min((int)m_content.lines.size() - m_height, m_offset + lines); + m_offset = std::max(std::min(m_offset + lines, (int)m_content.lines.size() - m_height), 0); redraw(); return true; }