Skip to content

Commit

Permalink
fix: fixed multiline jumps when a line does not have a modifiable block
Browse files Browse the repository at this point in the history
  • Loading branch information
LyonSyonII committed Nov 17, 2024
1 parent 044a2af commit d4e89ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frontend/src/components/CodeBlock/CodeBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,12 @@ export class CodeBlock extends HTMLElement {
};
const start = reverseIndex(nearestLine.text, mo, newColumn);
const end = nearestLine.text.indexOf(mo, newColumn);
if (end === -1) {
if (end === -1 && start >= 0) {
newColumn = start;
} else if (start === -1) {
} else if (start === -1 && end >= 0) {
newColumn = end;
} else {
return tr;
}
return { selection: { anchor: nearestLine.from + newColumn } };
}
Expand Down

0 comments on commit d4e89ca

Please sign in to comment.