renamed setting, cleanup

This commit is contained in:
Eugene Pankov
2022-04-12 18:35:44 +02:00
parent 4cf9eda55f
commit be72cd59cc
3 changed files with 32 additions and 35 deletions

View File

@@ -523,7 +523,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
* Changes the size of the focused pane in the given direction * Changes the size of the focused pane in the given direction
*/ */
resizePane (direction: ResizeDirection): void { 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 // The direction of the resize pane, vertically or horizontally
let directionvh: SplitOrientation = 'h' let directionvh: SplitOrientation = 'h'
@@ -547,50 +547,44 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
return return
} }
let cur: BaseTabComponent | SplitContainer = this.focusedTab let currentContainer: BaseTabComponent | SplitContainer = this.focusedTab
let child: BaseTabComponent | SplitContainer | null = this.focusedTab let child: BaseTabComponent | SplitContainer | null = this.focusedTab
let curSplitOrientation: SplitOrientation | null = null let curSplitOrientation: SplitOrientation | null = null
// Find the first split that is in the orientations that the user chooses to change // Find the first split that is in the orientations that the user chooses to change
while (curSplitOrientation !== directionvh) { while (curSplitOrientation !== directionvh) {
const par = this.getParentOf(cur) const parentContainer = this.getParentOf(currentContainer)
if (par == null) { if (!parentContainer) {
return return
} }
child = cur child = currentContainer
cur = par currentContainer = parentContainer
if (cur instanceof SplitContainer) { if (currentContainer instanceof SplitContainer) {
curSplitOrientation = cur.orientation 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 // 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 let updatedRatio = 0
if (isDecreasing) { if (isDecreasing) {
updatedRatio = curSplit.ratios[currentChildIndex] - resizeIncrement updatedRatio = currentContainer.ratios[currentChildIndex] - resizeStep
if (updatedRatio < 0) { if (updatedRatio < 0) {
return return
} }
} else { } else {
updatedRatio = curSplit.ratios[currentChildIndex] + resizeIncrement updatedRatio = currentContainer.ratios[currentChildIndex] + resizeStep
if (updatedRatio > 1) { if (updatedRatio > 1) {
return return
} }
} }
const ratioModifier = resizeIncrement / curSplit.ratios.length
// Modify all the ratios evenly to normalize the pane sizes currentContainer.ratios[currentChildIndex] = updatedRatio
curSplit.ratios.forEach((ratio) => {
if (isDecreasing) {
curSplit.ratios[ratio] += ratioModifier
} else {
curSplit.ratios[ratio] -= ratioModifier
}
})
curSplit.ratios[currentChildIndex] = updatedRatio
this.layout() this.layout()
} }

View File

@@ -12,12 +12,12 @@ appearance:
frame: thin frame: thin
css: '/* * { color: blue !important; } */' css: '/* * { color: blue !important; } */'
opacity: 1.0 opacity: 1.0
paneResize: 0.1
vibrancy: false vibrancy: false
vibrancyType: 'blur' vibrancyType: 'blur'
terminal: terminal:
showBuiltinProfiles: true showBuiltinProfiles: true
showRecentProfiles: 3 showRecentProfiles: 3
paneResizeStep: 0.1
hotkeys: hotkeys:
profile: profile:
__nonStructural: true __nonStructural: true

View File

@@ -66,18 +66,6 @@ h3.mb-3(translate) Window
step='0.01' 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') .form-line(*ngIf='platform.supportsWindowControls')
.header .header
.title(translate) Window frame .title(translate) Window frame
@@ -316,6 +304,21 @@ h3.mt-4(translate) Tabs
(ngModelChange)='config.save();', (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 h3.mt-4(translate) Hacks
.form-line .form-line