Skip to content

Commit

Permalink
Fix bug in bidi isolate handling
Browse files Browse the repository at this point in the history
FIX: Fix a bug that broke some bidi isolates not on the first line of
the document.
  • Loading branch information
marijnh committed Dec 28, 2023
1 parent 55257cc commit b0e79c1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,13 @@ export function getIsolatedRanges(view: EditorView, line: Line): readonly Isolat
let result: Isolate[] = []
RangeSet.spans(sets, line.from, line.to, {
point() {},
span(from, to, active, open) {
span(fromDoc, toDoc, active, open) {
let from = fromDoc - line.from, to = toDoc - line.from
let level = result
for (let i = active.length - 1; i >= 0; i--, open--) {
let direction = active[i].spec.bidiIsolate, update
if (direction == null)
direction = autoDirection(line.text, from - line.from, to - line.from)
direction = autoDirection(line.text, from, to)
if (open > 0 && level.length &&
(update = level[level.length - 1]).to == from && update.direction == direction) {
update.to = to
Expand Down

0 comments on commit b0e79c1

Please sign in to comment.