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

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

上级 2db4e128
...@@ -335,59 +335,55 @@ export class QuickOpenWidget implements IModelProvider { ...@@ -335,59 +335,55 @@ export class QuickOpenWidget implements IModelProvider {
private navigateInTree(keyCode: KeyCode, isShift?: boolean): void { private navigateInTree(keyCode: KeyCode, isShift?: boolean): void {
const model: IModel<any> = this.tree.getInput(); const model: IModel<any> = this.tree.getInput();
const entries = model ? model.entries : []; const entries = model ? model.entries : [];
let focus = this.tree.getFocus(); const oldFocus = this.tree.getFocus();
let cycled = false;
let revealToTop = false;
// Support cycle-through navigation // Normal Navigation
if (entries.length > 1) { switch (keyCode) {
case KeyCode.DownArrow:
this.tree.focusNext();
break;
// Up from no entry or first entry goes down to last case KeyCode.UpArrow:
if ((keyCode === KeyCode.UpArrow || (keyCode === KeyCode.Tab && isShift)) && (focus === entries[0] || !focus)) { // TODO@Ben should not make ordering assumptions this.tree.focusPrevious();
this.tree.focusLast(); break;
cycled = true;
}
// Down from last entry goes to up to first case KeyCode.PageDown:
else if ((keyCode === KeyCode.DownArrow || keyCode === KeyCode.Tab && !isShift) && focus === entries[entries.length - 1]) { // TODO@Ben should not make ordering assumptions this.tree.focusNextPage();
this.tree.focusFirst(); break;
cycled = true;
}
}
// Normal Navigation case KeyCode.PageUp:
if (!cycled) { this.tree.focusPreviousPage();
switch (keyCode) { break;
case KeyCode.DownArrow:
this.tree.focusNext();
break;
case KeyCode.UpArrow: case KeyCode.Tab:
if (isShift) {
this.tree.focusPrevious(); this.tree.focusPrevious();
break; } else {
this.tree.focusNext();
}
break;
}
case KeyCode.PageDown: let newFocus = this.tree.getFocus();
this.tree.focusNextPage();
break;
case KeyCode.PageUp: // Support cycle-through navigation if focus did not change
this.tree.focusPreviousPage(); if (entries.length > 1 && oldFocus === newFocus) {
break;
case KeyCode.Tab: // Up from no entry or first entry goes down to last
if (isShift) { if (keyCode === KeyCode.UpArrow || (keyCode === KeyCode.Tab && isShift)) {
this.tree.focusPrevious(); this.tree.focusLast();
} else { }
this.tree.focusNext();
} // Down from last entry goes to up to first
break; else if (keyCode === KeyCode.DownArrow || keyCode === KeyCode.Tab && !isShift) {
this.tree.focusFirst();
} }
} }
// Reveal // Reveal
focus = this.tree.getFocus(); newFocus = this.tree.getFocus();
if (focus) { if (newFocus) {
revealToTop ? this.tree.reveal(focus, 0).done(null, errors.onUnexpectedError) : this.tree.reveal(focus).done(null, errors.onUnexpectedError); 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.
先完成此消息的编辑!
想要评论请 注册