Skip to content

Commit

Permalink
Fix incorrect command palette cursor position
Browse files Browse the repository at this point in the history
Fixes #6011

Fixes incorrect command palette cursor position especially on Safari browser.
Added additional handling to verify that if no selection is currently present,
force the cursor at the end of the input. Inspired by a similar implementation
in VS Code.

Signed-off-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
vince-fugnitto committed Nov 1, 2019
1 parent b92a567 commit 2c13528
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/monaco/src/browser/monaco-quick-open-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ export class MonacoQuickOpenService extends QuickOpenService {
const widget = this.widget;
if (widget.inputBox) {
widget.inputBox.inputElement.tabIndex = 1;
// Position the cursor at the end of the input unless a user has made a selection.
if (widget.inputBox.inputElement.selectionStart === widget.inputBox.inputElement.selectionEnd) {
widget.inputBox.inputElement.selectionStart = widget.inputBox.inputElement.value.length;
}
}
}

Expand Down

0 comments on commit 2c13528

Please sign in to comment.