Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/lib/behavior/columnResizer/ContextualResizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,22 @@ class ContextualResizer {
column.setWidth(newWidth, true);
desktop.scrollCenterVisible(column);
}

public maximizeWidth(column: Column) {
const grid = column.grid;
const desktop = grid.desktop;
const presetWidths = this.presetWidths.getWidths(column.getMinWidth(), column.getMaxWidth());
const maxWidth = presetWidths[presetWidths.length-1];
column.setWidth(maxWidth, true);
desktop.scrollCenterVisible(column);
}

public minimizeWidth(column: Column) {
const grid = column.grid;
const desktop = grid.desktop;
const presetWidths = this.presetWidths.getWidths(column.getMinWidth(), column.getMaxWidth());
const minWidth = presetWidths[0];
column.setWidth(minWidth, true);
desktop.scrollCenterVisible(column);
}
}
12 changes: 12 additions & 0 deletions src/lib/behavior/columnResizer/RawResizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,16 @@ class RawResizer {
}
column.setWidth(newWidth, true);
}

public maximizeWidth(column: Column) {
const presetWidths = this.presetWidths.getWidths(column.getMinWidth(), column.getMaxWidth());
const maxWidth = presetWidths[presetWidths.length-1];
column.setWidth(maxWidth, true);
}

public minimizeWidth(column: Column) {
const presetWidths = this.presetWidths.getWidths(column.getMinWidth(), column.getMaxWidth());
const minWidth = presetWidths[0];
column.setWidth(minWidth, true);
}
}
11 changes: 11 additions & 0 deletions src/lib/keyBindings/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ class Actions {
this.config.columnResizer.decreaseWidth(column);
};

public readonly columnWidthMaximize = (cm: ClientManager, dm: DesktopManager, window: Window, column: Column, grid: Grid) => {
this.config.columnResizer.maximizeWidth(column);
};


public readonly columnWidthMinimize = (cm: ClientManager, dm: DesktopManager, window: Window, column: Column, grid: Grid) => {
this.config.columnResizer.minimizeWidth(column);
};

public readonly cyclePresetWidths = (cm: ClientManager, dm: DesktopManager, window: Window, column: Column, grid: Grid) => {
const nextWidth = this.config.presetWidths.next(column.getWidth(), column.getMinWidth(), column.getMaxWidth());
column.setWidth(nextWidth, true);
Expand Down Expand Up @@ -471,5 +480,7 @@ namespace Actions {
export interface ColumnResizer {
increaseWidth(column: Column): void;
decreaseWidth(column: Column): void;
maximizeWidth(column: Column): void;
minimizeWidth(column: Column): void;
}
}
10 changes: 10 additions & 0 deletions src/lib/keyBindings/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ function getKeyBindings(world: World, actions: Actions): KeyBinding[] {
defaultKeySequence: "Meta+Ctrl+-",
action: () => world.doIfTiledFocused(actions.columnWidthDecrease),
},
{
name: "column-width-maximize",
description: "Increase column width to maximum",
action: () => world.doIfTiledFocused(actions.columnWidthMaximize),
},
{
name: "column-width-minimize",
description: "Decrease column width to minimum",
action: () => world.doIfTiledFocused(actions.columnWidthMinimize),
},
{
name: "cycle-preset-widths",
description: "Cycle through preset column widths",
Expand Down