feat: add editorPaddingX setting for input editor horizontal padding

This commit is contained in:
Mario Zechner 2026-01-16 23:50:00 +01:00
parent 5d3e7d5aaa
commit fe52ff00d2
6 changed files with 46 additions and 2 deletions

View file

@ -70,6 +70,7 @@ export interface Settings {
enabledModels?: string[]; // Model patterns for cycling (same format as --models CLI flag)
doubleEscapeAction?: "fork" | "tree"; // Action for double-escape with empty editor (default: "tree")
thinkingBudgets?: ThinkingBudgetsSettings; // Custom token budgets for thinking levels
editorPaddingX?: number; // Horizontal padding for input editor (default: 0)
}
/** Deep merge settings: project/overrides take precedence, nested objects merge recursively */
@ -480,4 +481,13 @@ export class SettingsManager {
this.globalSettings.doubleEscapeAction = action;
this.save();
}
getEditorPaddingX(): number {
return this.settings.editorPaddingX ?? 0;
}
setEditorPaddingX(padding: number): void {
this.globalSettings.editorPaddingX = Math.max(0, Math.min(3, Math.floor(padding)));
this.save();
}
}

View file

@ -36,6 +36,7 @@ export interface SettingsConfig {
hideThinkingBlock: boolean;
collapseChangelog: boolean;
doubleEscapeAction: "fork" | "tree";
editorPaddingX: number;
}
export interface SettingsCallbacks {
@ -52,6 +53,7 @@ export interface SettingsCallbacks {
onHideThinkingBlockChange: (hidden: boolean) => void;
onCollapseChangelogChange: (collapsed: boolean) => void;
onDoubleEscapeActionChange: (action: "fork" | "tree") => void;
onEditorPaddingXChange: (padding: number) => void;
onCancel: () => void;
}
@ -267,6 +269,16 @@ export class SettingsSelectorComponent extends Container {
values: ["true", "false"],
});
// Editor padding toggle (insert after skill-commands)
const skillCommandsIndex = items.findIndex((item) => item.id === "skill-commands");
items.splice(skillCommandsIndex + 1, 0, {
id: "editor-padding",
label: "Editor padding",
description: "Horizontal padding for input editor (0-3)",
currentValue: String(config.editorPaddingX),
values: ["0", "1", "2", "3"],
});
// Add borders
this.addChild(new DynamicBorder());
@ -306,6 +318,9 @@ export class SettingsSelectorComponent extends Container {
case "double-escape-action":
callbacks.onDoubleEscapeActionChange(newValue as "fork" | "tree");
break;
case "editor-padding":
callbacks.onEditorPaddingXChange(parseInt(newValue, 10));
break;
}
},
callbacks.onCancel,

View file

@ -241,7 +241,8 @@ export class InteractiveMode {
this.statusContainer = new Container();
this.widgetContainer = new Container();
this.keybindings = KeybindingsManager.create();
this.defaultEditor = new CustomEditor(this.ui, getEditorTheme(), this.keybindings);
const editorPaddingX = this.settingsManager.getEditorPaddingX();
this.defaultEditor = new CustomEditor(this.ui, getEditorTheme(), this.keybindings, { paddingX: editorPaddingX });
this.editor = this.defaultEditor;
this.editorContainer = new Container();
this.editorContainer.addChild(this.editor as Component);
@ -2520,6 +2521,7 @@ export class InteractiveMode {
hideThinkingBlock: this.hideThinkingBlock,
collapseChangelog: this.settingsManager.getCollapseChangelog(),
doubleEscapeAction: this.settingsManager.getDoubleEscapeAction(),
editorPaddingX: this.settingsManager.getEditorPaddingX(),
},
{
onAutoCompactChange: (enabled) => {
@ -2587,6 +2589,10 @@ export class InteractiveMode {
onDoubleEscapeActionChange: (action) => {
this.settingsManager.setDoubleEscapeAction(action);
},
onEditorPaddingXChange: (padding) => {
this.settingsManager.setEditorPaddingX(padding);
this.defaultEditor.setPaddingX(padding);
},
onCancel: () => {
done();
this.ui.requestRender();