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

This commit is contained in:
2025-09-16 07:52:47 +01:00
parent 3d9bf962e7
commit 148b108062

View File

@@ -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)