提交 dde6f243 编写于 作者: B Benjamin Pasero

Unable to jump to first element in quick open with Arrow-Down and filtered (fixes #11882)

上级 2db4e128
......@@ -335,28 +335,9 @@ export class QuickOpenWidget implements IModelProvider {
private navigateInTree(keyCode: KeyCode, isShift?: boolean): void {
const model: IModel<any> = this.tree.getInput();
const entries = model ? model.entries : [];
let focus = this.tree.getFocus();
let cycled = false;
let revealToTop = false;
// Support cycle-through navigation
if (entries.length > 1) {
// Up from no entry or first entry goes down to last
if ((keyCode === KeyCode.UpArrow || (keyCode === KeyCode.Tab && isShift)) && (focus === entries[0] || !focus)) { // TODO@Ben should not make ordering assumptions
this.tree.focusLast();
cycled = true;
}
// Down from last entry goes to up to first
else if ((keyCode === KeyCode.DownArrow || keyCode === KeyCode.Tab && !isShift) && focus === entries[entries.length - 1]) { // TODO@Ben should not make ordering assumptions
this.tree.focusFirst();
cycled = true;
}
}
const oldFocus = this.tree.getFocus();
// Normal Navigation
if (!cycled) {
switch (keyCode) {
case KeyCode.DownArrow:
this.tree.focusNext();
......@@ -382,12 +363,27 @@ export class QuickOpenWidget implements IModelProvider {
}
break;
}
let newFocus = this.tree.getFocus();
// Support cycle-through navigation if focus did not change
if (entries.length > 1 && oldFocus === newFocus) {
// Up from no entry or first entry goes down to last
if (keyCode === KeyCode.UpArrow || (keyCode === KeyCode.Tab && isShift)) {
this.tree.focusLast();
}
// Down from last entry goes to up to first
else if (keyCode === KeyCode.DownArrow || keyCode === KeyCode.Tab && !isShift) {
this.tree.focusFirst();
}
}
// Reveal
focus = this.tree.getFocus();
if (focus) {
revealToTop ? this.tree.reveal(focus, 0).done(null, errors.onUnexpectedError) : this.tree.reveal(focus).done(null, errors.onUnexpectedError);
newFocus = this.tree.getFocus();
if (newFocus) {
this.tree.reveal(newFocus).done(null, errors.onUnexpectedError);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册