From c0d415580839827b93ba66a171168e9a51c014a2 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sat, 31 Jan 2026 21:53:32 +0000 Subject: [PATCH] adjust 'NormalYank.yankLineDown' function to pass failing test --- fcore/normal-mode/normal-yank.sml | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/fcore/normal-mode/normal-yank.sml b/fcore/normal-mode/normal-yank.sml index b462240..3a378b2 100644 --- a/fcore/normal-mode/normal-yank.sml +++ b/fcore/normal-mode/normal-yank.sml @@ -131,28 +131,9 @@ struct else let val buffer = LineGap.goToIdx (endLineIdx, buffer) - - (* right now, endLineIdx may be on a newline. - * If it is, we want to delete that newline too, - * and in that case, we increment by 1 to do so. - * However, we don't want to delete the last newline in the file - * so we don't increment in that case. - * Edge case: if the startIdx also begins after a newline - * then it is okay for us to delete the newline at the end of the file - * because there will already be a newline at the end of the file - * after the deletion. *) - val endsOnNewline = Cursor.isCursorAtStartOfLine (buffer, endLineIdx) - - val buffer = LineGap.goToIdx (startIdx, buffer) - val startsAfterNewline = - startIdx > 0 andalso Cursor.isPrevChrStartOfLine (buffer, startIdx) - val endLineIdx = - if endsOnNewline then - if endLineIdx = #textLength buffer - 1 then - if startsAfterNewline then endLineIdx + 1 else endLineIdx - else - endLineIdx + 1 + if Cursor.isCursorAtStartOfLine (buffer, endLineIdx) then + endLineIdx + 1 else endLineIdx