From 148b108062eac37c8b152833ad8a7e9ae61c6a4e Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Tue, 16 Sep 2025 07:52:47 +0100 Subject: [PATCH] when using 'G' command to move to end fo file, use the 'textLength' field to calculate the new bufferIdx, which is more sensible than using the LineGap's idx for the same purpose --- fcore/normal-mode/normal-move.sml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fcore/normal-mode/normal-move.sml b/fcore/normal-mode/normal-move.sml index cbb6293..f321eb2 100644 --- a/fcore/normal-mode/normal-move.sml +++ b/fcore/normal-mode/normal-move.sml @@ -63,10 +63,9 @@ struct } = app val buffer = LineGap.goToEnd buffer - val {line = bufferLine, idx = bufferIdx, ...} = buffer + val {line = bufferLine, textLength, ...} = buffer - val bufferIdx = bufferIdx - 1 - val bufferIdx = Cursor.clipIdx (buffer, bufferIdx) + val bufferIdx = Int.max (0, textLength - 2) val bufferLine = bufferLine - 1 val buffer = LineGap.goToIdx (bufferIdx, buffer)