Skip to content

Commit 348e88d

Browse files
Revert "Stop the cursor from jumping when changing prefix in QuickAccess (microsoft#198821)" (microsoft#204638)
This reverts commit 3154b5f.
1 parent bc056d2 commit 348e88d

File tree

4 files changed

+2
-42
lines changed

4 files changed

+2
-42
lines changed

src/vs/base/browser/ui/inputbox/inputBox.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -305,18 +305,6 @@ export class InputBox extends Widget {
305305
return this.input.selectionEnd === this.input.value.length && this.input.selectionStart === this.input.selectionEnd;
306306
}
307307

308-
public getSelection(): IRange | null {
309-
const selectionStart = this.input.selectionStart;
310-
if (selectionStart === null) {
311-
return null;
312-
}
313-
const selectionEnd = this.input.selectionEnd ?? selectionStart;
314-
return {
315-
start: selectionStart,
316-
end: selectionEnd,
317-
};
318-
}
319-
320308
public enable(): void {
321309
this.input.removeAttribute('disabled');
322310
}

src/vs/platform/quickinput/browser/quickAccess.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ export class QuickAccessController extends Disposable implements IQuickAccessCon
9292
}
9393
}
9494

95-
// Store the existing selection if there was one.
96-
const visibleSelection = visibleQuickAccess?.picker?.valueSelection;
97-
9895
// Create a picker for the provider to use with the initial value
9996
// and adjust the filtering to exclude the prefix from filtering
10097
const disposables = new DisposableStore();
@@ -151,11 +148,6 @@ export class QuickAccessController extends Disposable implements IQuickAccessCon
151148
// on the onDidHide event.
152149
picker.show();
153150

154-
// If the previous picker had a selection, we should set that in the new picker.
155-
if (visibleSelection) {
156-
picker.valueSelection = visibleSelection;
157-
}
158-
159151
// Pick mode: return with promise
160152
if (pick) {
161153
return pickPromise?.p;

src/vs/platform/quickinput/browser/quickInput.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -725,15 +725,7 @@ export class QuickPick<T extends IQuickPickItem> extends QuickInput implements I
725725
return this.ui.keyMods;
726726
}
727727

728-
get valueSelection() {
729-
const selection = this.ui.inputBox.getSelection();
730-
if (!selection) {
731-
return undefined;
732-
}
733-
return [selection.start, selection.end];
734-
}
735-
736-
set valueSelection(valueSelection: Readonly<[number, number]> | undefined) {
728+
set valueSelection(valueSelection: Readonly<[number, number]>) {
737729
this._valueSelection = valueSelection;
738730
this.valueSelectionUpdated = true;
739731
this.update();
@@ -1162,15 +1154,7 @@ export class InputBox extends QuickInput implements IInputBox {
11621154
this.update();
11631155
}
11641156

1165-
get valueSelection() {
1166-
const selection = this.ui.inputBox.getSelection();
1167-
if (!selection) {
1168-
return undefined;
1169-
}
1170-
return [selection.start, selection.end];
1171-
}
1172-
1173-
set valueSelection(valueSelection: Readonly<[number, number]> | undefined) {
1157+
set valueSelection(valueSelection: Readonly<[number, number]>) {
11741158
this._valueSelection = valueSelection;
11751159
this.valueSelectionUpdated = true;
11761160
this.update();

src/vs/platform/quickinput/browser/quickInputBox.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ export class QuickInputBox extends Disposable {
5959
this.findInput.inputBox.select(range);
6060
}
6161

62-
getSelection(): IRange | null {
63-
return this.findInput.inputBox.getSelection();
64-
}
65-
6662
isSelectionAtEnd(): boolean {
6763
return this.findInput.inputBox.isSelectionAtEnd();
6864
}

0 commit comments

Comments
 (0)