feat(coding-agent): configurable double-escape action (tree vs branch)

Add doubleEscapeAction setting to choose whether double-escape with an
empty editor opens /tree (default) or /branch.

- Add setting to Settings interface and SettingsManager
- Add to /settings UI for easy toggling
- Update interactive-mode to respect the setting
- Document in README.md settings table

fixes #404
This commit is contained in:
Mario Zechner 2026-01-03 01:59:08 +01:00
parent 17b3a14bfa
commit 42b1e06ad1
6 changed files with 34 additions and 6 deletions

View file

@ -755,10 +755,14 @@ export class InteractiveMode {
this.isBashMode = false;
this.updateEditorBorderColor();
} else if (!this.editor.getText().trim()) {
// Double-escape with empty editor triggers /branch
// Double-escape with empty editor triggers /tree or /branch based on setting
const now = Date.now();
if (now - this.lastEscapeTime < 500) {
this.showUserMessageSelector();
if (this.settingsManager.getDoubleEscapeAction() === "tree") {
this.showTreeSelector();
} else {
this.showUserMessageSelector();
}
this.lastEscapeTime = 0;
} else {
this.lastEscapeTime = now;
@ -1682,6 +1686,7 @@ export class InteractiveMode {
availableThemes: getAvailableThemes(),
hideThinkingBlock: this.hideThinkingBlock,
collapseChangelog: this.settingsManager.getCollapseChangelog(),
doubleEscapeAction: this.settingsManager.getDoubleEscapeAction(),
},
{
onAutoCompactChange: (enabled) => {
@ -1739,6 +1744,9 @@ export class InteractiveMode {
onCollapseChangelogChange: (collapsed) => {
this.settingsManager.setCollapseChangelog(collapsed);
},
onDoubleEscapeActionChange: (action) => {
this.settingsManager.setDoubleEscapeAction(action);
},
onCancel: () => {
done();
this.ui.requestRender();