From 4e1318fb0e0c0af448296d9cd4fcacdd824cfb60 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sun, 31 Oct 2021 20:49:13 +0100 Subject: [PATCH] less: Fix condition to read more data While mathematically equivalent, the presence of a size_t forces the comparison to work with size_t's. This means that '-1 < 0' is false, contrary to the 'mathematically pure' interpretation of the inequality. --- Userland/Utilities/less.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Utilities/less.cpp b/Userland/Utilities/less.cpp index 37672ccc51..9c6868a5c1 100644 --- a/Userland/Utilities/less.cpp +++ b/Userland/Utilities/less.cpp @@ -139,7 +139,7 @@ public: { clear_status(); - while (n - (m_lines.size() - m_line) + m_height - 1 > 0) { + while (m_lines.size() < m_line + n + m_height - 1) { if (!read_line()) break; }