Support ctrl+p/ctrl+n navigation in quickOpenWidget
This commit is contained in:
parent
b01fb0bfd0
commit
3a52eb2614
1 changed files with 19 additions and 1 deletions
|
@ -25,7 +25,7 @@ import {StandardKeyboardEvent} from 'vs/base/browser/keyboardEvent';
|
||||||
import {DefaultController, ClickBehavior} from 'vs/base/parts/tree/browser/treeDefaults';
|
import {DefaultController, ClickBehavior} from 'vs/base/parts/tree/browser/treeDefaults';
|
||||||
import DOM = require('vs/base/browser/dom');
|
import DOM = require('vs/base/browser/dom');
|
||||||
import {IActionProvider} from 'vs/base/parts/tree/browser/actionsRenderer';
|
import {IActionProvider} from 'vs/base/parts/tree/browser/actionsRenderer';
|
||||||
import {KeyCode, KeyMod} from 'vs/base/common/keyCodes';
|
import {KeyCode, KeyMod, CommonKeybindings} from 'vs/base/common/keyCodes';
|
||||||
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
|
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
|
||||||
import {ScrollbarVisibility} from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';
|
import {ScrollbarVisibility} from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';
|
||||||
|
|
||||||
|
@ -155,6 +155,15 @@ export class QuickOpenWidget implements IModelProvider {
|
||||||
DOM.addDisposableListener(this.inputBox.inputElement, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
DOM.addDisposableListener(this.inputBox.inputElement, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
||||||
let keyboardEvent: StandardKeyboardEvent = new StandardKeyboardEvent(e);
|
let keyboardEvent: StandardKeyboardEvent = new StandardKeyboardEvent(e);
|
||||||
|
|
||||||
|
if (platform.isMacintosh) {
|
||||||
|
if (keyboardEvent.equals(CommonKeybindings.WINCTRL_N)) {
|
||||||
|
keyboardEvent.keyCode = KeyCode.DownArrow;
|
||||||
|
}
|
||||||
|
else if (keyboardEvent.equals(CommonKeybindings.WINCTRL_P)) {
|
||||||
|
keyboardEvent.keyCode = KeyCode.UpArrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Do not handle Tab: It is used to navigate between elements without mouse
|
// Do not handle Tab: It is used to navigate between elements without mouse
|
||||||
if (keyboardEvent.keyCode === KeyCode.Tab) {
|
if (keyboardEvent.keyCode === KeyCode.Tab) {
|
||||||
return;
|
return;
|
||||||
|
@ -227,6 +236,15 @@ export class QuickOpenWidget implements IModelProvider {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (platform.isMacintosh) {
|
||||||
|
if (keyboardEvent.equals(CommonKeybindings.WINCTRL_N)) {
|
||||||
|
keyboardEvent.keyCode = KeyCode.DownArrow;
|
||||||
|
}
|
||||||
|
else if (keyboardEvent.equals(CommonKeybindings.WINCTRL_P)) {
|
||||||
|
keyboardEvent.keyCode = KeyCode.UpArrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Support keyboard navigation in quick navigation mode
|
// Support keyboard navigation in quick navigation mode
|
||||||
if (keyboardEvent.keyCode === KeyCode.DownArrow || keyboardEvent.keyCode === KeyCode.UpArrow || keyboardEvent.keyCode === KeyCode.PageDown || keyboardEvent.keyCode === KeyCode.PageUp) {
|
if (keyboardEvent.keyCode === KeyCode.DownArrow || keyboardEvent.keyCode === KeyCode.UpArrow || keyboardEvent.keyCode === KeyCode.PageDown || keyboardEvent.keyCode === KeyCode.PageUp) {
|
||||||
DOM.EventHelper.stop(e, true);
|
DOM.EventHelper.stop(e, true);
|
||||||
|
|
Loading…
Reference in a new issue