Merge pull request #5386 from alexkozy/safe-guards

fix: ensure that currentRow can not go out of the range
This commit is contained in:
Daniel Imms
2025-08-20 14:15:08 -07:00
committed by GitHub
+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) {