From b7ecc26305a58d046154e0c1a4387a369bbffa21 Mon Sep 17 00:00:00 2001 From: usr-org Date: Sat, 4 Feb 2023 20:48:29 +0100 Subject: [PATCH] remove 600 pixel limit on quick input widget https://github.com/microsoft/vscode/pull/117862 --- patches/user/117862.patch | 82 +++++++++++++++++++++++++++++++++++++++ patches/user/readme.txt | 5 +++ 2 files changed, 87 insertions(+) create mode 100644 patches/user/117862.patch diff --git a/patches/user/117862.patch b/patches/user/117862.patch new file mode 100644 index 00000000000..15004aa73d5 --- /dev/null +++ b/patches/user/117862.patch @@ -0,0 +1,82 @@ +diff --git a/src/vs/base/parts/quickinput/browser/quickInput.ts b/src/vs/base/parts/quickinput/browser/quickInput.ts +index 2ab5e7a478d21..0f92b25ca96ac 100644 +--- a/src/vs/base/parts/quickinput/browser/quickInput.ts ++++ b/src/vs/base/parts/quickinput/browser/quickInput.ts +@@ -36,6 +36,8 @@ export interface IQuickInputOptions { + idPrefix: string; + container: HTMLElement; + ignoreFocusOut(): boolean; ++ maximumWidth(): number; ++ relativeWidth(): number; + isScreenReaderOptimized(): boolean; + backKeybindingLabel(): string | undefined; + setContextKey(id?: string): void; +@@ -1110,8 +1112,6 @@ class InputBox extends QuickInput implements IInputBox { + } + + export class QuickInputController extends Disposable { +- private static readonly MAX_WIDTH = 600; // Max total width of quick input widget +- + private idPrefix: string; + private ui: QuickInputUI | undefined; + private dimension?: dom.IDimension; +@@ -1670,7 +1670,7 @@ export class QuickInputController extends Disposable { + this.ui.container.style.top = `${this.titleBarOffset}px`; + + const style = this.ui.container.style; +- const width = Math.min(this.dimension!.width * 0.62 /* golden cut */, QuickInputController.MAX_WIDTH); ++ const width = Math.min(this.dimension!.width * this.options.relativeWidth(), this.options.maximumWidth()); + style.width = width + 'px'; + style.marginLeft = '-' + (width / 2) + 'px'; + +diff --git a/src/vs/platform/quickinput/browser/quickInput.ts b/src/vs/platform/quickinput/browser/quickInput.ts +index d696697f9d0d1..7578f096adf2a 100644 +--- a/src/vs/platform/quickinput/browser/quickInput.ts ++++ b/src/vs/platform/quickinput/browser/quickInput.ts +@@ -65,6 +65,8 @@ export class QuickInputService extends Themable implements IQuickInputService { + idPrefix: 'quickInput_', // Constant since there is still only one. + container: host.container, + ignoreFocusOut: () => false, ++ maximumWidth: () => 600, ++ relativeWidth: () => 0.62, + isScreenReaderOptimized: () => this.accessibilityService.isScreenReaderOptimized(), + backKeybindingLabel: () => undefined, + setContextKey: (id?: string) => this.setContextKey(id), +diff --git a/src/vs/workbench/browser/workbench.contribution.ts b/src/vs/workbench/browser/workbench.contribution.ts +index 137c89d8bfb27..65db46aa963d0 100644 +--- a/src/vs/workbench/browser/workbench.contribution.ts ++++ b/src/vs/workbench/browser/workbench.contribution.ts +@@ -238,6 +238,20 @@ import { isStandalone } from 'vs/base/browser/browser'; + 'description': localize('workbench.quickOpen.preserveInput', "Controls whether the last typed input to Quick Open should be restored when opening it the next time."), + 'default': false + }, ++ 'workbench.quickOpen.maximumWidth': { ++ 'type': 'number', ++ 'description': localize('workbench.quickOpen.maxWidth', "Limits the maximum width of the quick open widget to the specified number of pixels."), ++ 'default': 600, ++ 'minimum': 200, ++ 'maximum': 2000 ++ }, ++ 'workbench.quickOpen.relativeWidth': { ++ 'type': 'number', ++ 'description': localize('workbench.quickOpen.relativeWidth', "Controls the width of the quick open widget relative to the total window width."), ++ 'default': 0.62, ++ 'minimum': 0.1, ++ 'maximum': 1.0 ++ }, + 'workbench.settings.openDefaultSettings': { + 'type': 'boolean', + 'description': localize('openDefaultSettings', "Controls whether opening settings also opens an editor showing all default settings."), +diff --git a/src/vs/workbench/services/quickinput/browser/quickInputService.ts b/src/vs/workbench/services/quickinput/browser/quickInputService.ts +index fcdad25645e4a..0bf9c63e5c405 100644 +--- a/src/vs/workbench/services/quickinput/browser/quickInputService.ts ++++ b/src/vs/workbench/services/quickinput/browser/quickInputService.ts +@@ -41,6 +41,8 @@ export class QuickInputService extends BaseQuickInputService { + + protected createController(): QuickInputController { + return super.createController(this.layoutService, { ++ maximumWidth: () => this.configurationService.getValue('workbench.quickOpen.maximumWidth'), ++ relativeWidth: () => this.configurationService.getValue('workbench.quickOpen.relativeWidth'), + ignoreFocusOut: () => !this.configurationService.getValue('workbench.quickOpen.closeOnFocusLost'), + backKeybindingLabel: () => this.keybindingService.lookupKeybinding('workbench.action.quickInputBack')?.getLabel() || undefined, + }); diff --git a/patches/user/readme.txt b/patches/user/readme.txt index 8bbd9831832..37ec89a2792 100644 --- a/patches/user/readme.txt +++ b/patches/user/readme.txt @@ -1 +1,6 @@ store user patches at location patches/user and those will be applied to vscode source git by the scripts + + +- remove arbitrary 600 pixel limit on quick input widget + - remove arbitrary 600 pixel limit on quick input widget +wget https://github.com/microsoft/vscode/pull/117862.diff