From 32c4139c720cb350b296f7cd05210bca3b09ca5b Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Thu, 27 Apr 2023 10:03:31 -0500 Subject: [PATCH] Added check to prevent page down from looping endlessly --- editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor.c b/editor.c index ea4baeb..540c253 100644 --- a/editor.c +++ b/editor.c @@ -124,7 +124,7 @@ void page_down_handler(Buffer* buffer) { once, so this hardcoded statement is fine. */ - while (*(buffer->start - 1) != '\n') { + while ((*(buffer->start - 1) != '\n') && (buffer->end != (buffer->text + buffer->size))) { buffer_right(buffer); }