Skip to content

Commit

Permalink
Bug fix: findOuterBracketRaw on small documents
Browse files Browse the repository at this point in the history
  • Loading branch information
lukstafi committed Nov 24, 2023
1 parent 4661a5b commit a59b863
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,9 @@ function findOuterBracketRaw(
let nesting = 0;
let delta = direction[side];
let skippedChars = 0;
for (
let offset = cursor - delta * Math.max(closingRawMaxLength || 0, openingRawMaxLength || 0);
0 <= offset && offset <= lastOffset; offset += delta
) {
let offset = cursor - delta * Math.max(closingRawMaxLength || 0, openingRawMaxLength || 0);
offset = Math.max(0, Math.min(offset, lastOffset));
for (; 0 <= offset && offset <= lastOffset; offset += delta) {
// Reset to the default delta.
delta = direction[side];
const offsetPos = doc.positionAt(offset);
Expand Down

0 comments on commit a59b863

Please sign in to comment.