From be72cd59ccb367c97177ad85da426b581ab7f87e Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Tue, 12 Apr 2022 18:35:44 +0200 Subject: [PATCH] renamed setting, cleanup --- .../src/components/splitTab.component.ts | 38 ++++++++----------- tabby-core/src/configDefaults.yaml | 2 +- .../windowSettingsTab.component.pug | 27 +++++++------ 3 files changed, 32 insertions(+), 35 deletions(-) diff --git a/tabby-core/src/components/splitTab.component.ts b/tabby-core/src/components/splitTab.component.ts index d8407a66..8c9414ea 100644 --- a/tabby-core/src/components/splitTab.component.ts +++ b/tabby-core/src/components/splitTab.component.ts @@ -523,7 +523,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit * Changes the size of the focused pane in the given direction */ resizePane (direction: ResizeDirection): void { - const resizeIncrement = this.config.store.appearance.paneResize + const resizeStep = this.config.store.terminal.paneResizeStep // The direction of the resize pane, vertically or horizontally let directionvh: SplitOrientation = 'h' @@ -547,50 +547,44 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit return } - let cur: BaseTabComponent | SplitContainer = this.focusedTab + let currentContainer: BaseTabComponent | SplitContainer = this.focusedTab let child: BaseTabComponent | SplitContainer | null = this.focusedTab let curSplitOrientation: SplitOrientation | null = null // Find the first split that is in the orientations that the user chooses to change while (curSplitOrientation !== directionvh) { - const par = this.getParentOf(cur) - if (par == null) { + const parentContainer = this.getParentOf(currentContainer) + if (!parentContainer) { return } - child = cur - cur = par - if (cur instanceof SplitContainer) { - curSplitOrientation = cur.orientation + child = currentContainer + currentContainer = parentContainer + if (currentContainer instanceof SplitContainer) { + curSplitOrientation = currentContainer.orientation } } - const curSplit: SplitContainer = cur as SplitContainer + + if (!(currentContainer instanceof SplitContainer)) { + return + } // Determine which index in the ratios refers to the child that will be modified - const currentChildIndex = (cur as SplitContainer).children.indexOf(child) + const currentChildIndex = currentContainer.children.indexOf(child) let updatedRatio = 0 if (isDecreasing) { - updatedRatio = curSplit.ratios[currentChildIndex] - resizeIncrement + updatedRatio = currentContainer.ratios[currentChildIndex] - resizeStep if (updatedRatio < 0) { return } } else { - updatedRatio = curSplit.ratios[currentChildIndex] + resizeIncrement + updatedRatio = currentContainer.ratios[currentChildIndex] + resizeStep if (updatedRatio > 1) { return } } - const ratioModifier = resizeIncrement / curSplit.ratios.length - // Modify all the ratios evenly to normalize the pane sizes - curSplit.ratios.forEach((ratio) => { - if (isDecreasing) { - curSplit.ratios[ratio] += ratioModifier - } else { - curSplit.ratios[ratio] -= ratioModifier - } - }) - curSplit.ratios[currentChildIndex] = updatedRatio + currentContainer.ratios[currentChildIndex] = updatedRatio this.layout() } diff --git a/tabby-core/src/configDefaults.yaml b/tabby-core/src/configDefaults.yaml index 24ff5d5b..c0f032d7 100644 --- a/tabby-core/src/configDefaults.yaml +++ b/tabby-core/src/configDefaults.yaml @@ -12,12 +12,12 @@ appearance: frame: thin css: '/* * { color: blue !important; } */' opacity: 1.0 - paneResize: 0.1 vibrancy: false vibrancyType: 'blur' terminal: showBuiltinProfiles: true showRecentProfiles: 3 + paneResizeStep: 0.1 hotkeys: profile: __nonStructural: true diff --git a/tabby-settings/src/components/windowSettingsTab.component.pug b/tabby-settings/src/components/windowSettingsTab.component.pug index 0528340d..5dd1c5b3 100644 --- a/tabby-settings/src/components/windowSettingsTab.component.pug +++ b/tabby-settings/src/components/windowSettingsTab.component.pug @@ -66,18 +66,6 @@ h3.mb-3(translate) Window step='0.01' ) -.form-line() - .header - .title(translate) Pane Resize Increment - input( - type='range', - [(ngModel)]='config.store.appearance.paneResize', - (ngModelChange)='saveConfiguration();', - min='0.1', - max='0.9', - step='0.05' - ) - .form-line(*ngIf='platform.supportsWindowControls') .header .title(translate) Window frame @@ -316,6 +304,21 @@ h3.mt-4(translate) Tabs (ngModelChange)='config.save();', ) +h3.mt-4(translate) Panes + +.form-line() + .header + .title(translate) Pane resize step + .description(translate) For keyboard shortcuts + input( + type='range', + [(ngModel)]='config.store.terminal.paneResizeStep', + (ngModelChange)='saveConfiguration();', + min='0.1', + max='0.9', + step='0.05' + ) + h3.mt-4(translate) Hacks .form-line