fix: ensure that currentRow can not go out of the range

This commit is contained in:
Alexey Kozy
2025-08-20 13:47:40 -07:00
parent 4c0cf27cfc
commit a589be2826
+3 -1
View File
@@ -199,7 +199,9 @@ function bufferLine(
let currentRow = startRow;
let bufferStr = '';
while (currentCol !== endCol || currentRow !== endRow) {
while ((currentCol !== endCol || currentRow !== endRow) &&
currentRow >= 0 &&
currentRow < bufferService.buffer.lines.length) {
currentCol += forward ? 1 : -1;
if (forward && currentCol > bufferService.cols - 1) {