fix(sql): keep EOF cursor on trailing statement

This commit is contained in:
t8y2 committed 2026-08-01 13:27:33 +08:00
1 parent 3bd194679d
commit 288cc0687a
2 files changed
+10 -2

No files matched your search

@@ -585,8 +585,10 @@ export function statementRangeAtCursor(sql: string, cursorPos: number, databaseT
return rangeForCursorInSoftRanges(sql, softRanges, pos) ?? rangeFor(statement, sql);
}
if (pos > statement.to && (!next || pos < next.hitFrom) && isCursorOnStatementLine(sql, pos, statement)) {
return rangeForCursorInSoftRanges(sql, softRanges, pos) ?? rangeFor(statement, sql);
if (pos > statement.to && (!next || pos < next.hitFrom)) {
const softRange = rangeForCursorInSoftRanges(sql, softRanges, pos);
if (softRange) return softRange;
if (isCursorOnStatementLine(sql, pos, statement)) return rangeFor(statement, sql);
}
}