Skip to content

Commit

Permalink
fix previous code block action (#210594)
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Apr 17, 2024
1 parent 86637ca commit 330d143
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/vs/workbench/contrib/accessibility/browser/accessibleView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,16 @@ export class AccessibleView extends Disposable {
if (!this._codeBlocks?.length || !position) {
return;
}
const codeBlockIndex = this._codeBlocks.findIndex(c => type === 'previous' ? c.endLine >= position.lineNumber : c.startLine > position.lineNumber);
if (codeBlockIndex === -1) {
let codeBlock;
const codeBlocks = this._codeBlocks.slice();
if (type === 'previous') {
codeBlock = codeBlocks.reverse().find(c => c.endLine < position.lineNumber);
} else {
codeBlock = codeBlocks.find(c => c.startLine > position.lineNumber);
}
if (!codeBlock) {
return;
}
const codeBlock = this._codeBlocks[codeBlockIndex];
this.setPosition(new Position(codeBlock.startLine, 1), true);
}

Expand Down

0 comments on commit 330d143

Please sign in to comment.