Skip to content
Open
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
2 changes: 1 addition & 1 deletion docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ Widget picker:
The keybind footer in the TUI only shows shortcuts that apply to the currently selected widget. Plain-letter shortcuts ignore Ctrl and Alt/Option modifiers, so combinations such as `Ctrl+S` do not also trigger the letter action.

Widget-specific shortcuts:
- **Glyph widgets** (Git Branch, Git Worktree, Git Worktree Mode, Git Staged, Git Unstaged, Git Untracked, Git Conflicts, Git Ahead/Behind, Git Status, Git Changes, Git Insertions, Git Deletions, Git Clean Status, Git Is Fork, JJ Revision, JJ Bookmarks, JJ Workspace, JJ Changes, JJ Insertions, JJ Deletions): `g` set custom glyphs for the widget's symbols; Backspace in the editor renders without one, and multi-symbol widgets (Ahead/Behind, Status, Conflicts, Changes, Clean Status) edit each part in one list
- **Glyph widgets** (Git Branch, Git Worktree, Git Worktree Mode, Git Staged, Git Unstaged, Git Untracked, Git Conflicts, Git Ahead/Behind, Git Status, Git Changes, Git Insertions, Git Deletions, Git Clean Status, Git Is Fork, JJ Revision, JJ Bookmarks, JJ Workspace, JJ Changes, JJ Insertions, JJ Deletions): `g` set custom glyphs for the widget's symbols; Backspace in the editor renders without one, Shift+Tab toggles every symbol between none and default, and multi-symbol widgets (Ahead/Behind, Status, Conflicts, Changes, Clean Status) edit each part in one list
- **Git Branch**: `l` toggle clickable branch links (GitHub, GitLab, self-hosted), `w` set a maximum visible width (blank removes the limit)
- **Git Root Dir**: `l` cycle IDE links (`off` → `VS Code` → `Cursor`), `w` set a maximum visible width (blank removes the limit)
- **Git PR**: `s` toggle review status, `t` toggle title (renders "MR" for GitLab origins)
Expand Down
65 changes: 65 additions & 0 deletions src/widgets/shared/__tests__/symbol-override-editor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,69 @@ describe('SymbolSlotsEditor', () => {
cleanupEditor(rendered);
}
});

it('blanks every slot on Shift+Tab', async () => {
const rendered = renderEditor({ id: 'git-status', type: 'git-status' });

try {
await waitFor(() => {
expect(rendered.stdout.getOutput()).toContain('Conflicts:');
});
// Any new frame after Shift+Tab means the toggle was handled
rendered.stdout.clearOutput();
rendered.stdin.write('\x1B[Z');
await waitFor(() => {
expect(rendered.stdout.getOutput()).toContain('Conflicts:');
});
rendered.stdin.write('\r');
await waitFor(() => {
expect(rendered.onComplete).toHaveBeenCalledTimes(1);
});

const updated = rendered.onComplete.mock.calls[0]?.[0] as WidgetItem | undefined;
expect(updated?.metadata).toEqual({
symbolConflicts: '',
symbolStaged: '',
symbolUnstaged: '',
symbolUntracked: ''
});
} finally {
cleanupEditor(rendered);
}
});

it('restores every default on a second Shift+Tab', async () => {
const rendered = renderEditor({
id: 'git-status',
type: 'git-status',
metadata: {
symbolConflicts: '',
symbolStaged: '',
symbolUnstaged: '',
symbolUntracked: ''
}
});

try {
await waitFor(() => {
expect(rendered.stdout.getOutput()).toContain('Conflicts:');
});
// Any new frame after Shift+Tab means the toggle was handled
rendered.stdout.clearOutput();
rendered.stdin.write('\x1B[Z');
await waitFor(() => {
expect(rendered.stdout.getOutput()).toContain('Conflicts:');
});
rendered.stdin.write('\r');
await waitFor(() => {
expect(rendered.onComplete).toHaveBeenCalledTimes(1);
});

// Every slot back at its default stores no overrides at all.
const updated = rendered.onComplete.mock.calls[0]?.[0] as WidgetItem | undefined;
expect(updated?.metadata).toBeUndefined();
} finally {
cleanupEditor(rendered);
}
});
});
8 changes: 7 additions & 1 deletion src/widgets/shared/symbol-override.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ const SymbolSlotsEditor: React.FC<WidgetEditorProps & { slots: SymbolSlot[] }> =
setSelectedIndex(selectedIndex - 1 < 0 ? slots.length - 1 : selectedIndex - 1);
} else if (key.downArrow && slots.length > 1) {
setSelectedIndex(selectedIndex + 1 > slots.length - 1 ? 0 : selectedIndex + 1);
} else if (key.tab && key.shift) {
// Widgets with several glyphs are mostly blanked whole to save
// width on the status line, which is one Backspace per row
// otherwise. Blanked rows toggle back so the key is reversible.
const allBlank = values.every(value => value.length === 0);
setValues(values.map((_, index) => (allBlank ? slots[index]?.defaultSymbol ?? '' : '')));
} else if (key.tab) {
setValues(values.map((value, index) => (
index === selectedIndex ? slots[selectedIndex]?.defaultSymbol ?? '' : value
Expand All @@ -121,7 +127,7 @@ const SymbolSlotsEditor: React.FC<WidgetEditorProps & { slots: SymbolSlot[] }> =
<Text bold>Glyphs</Text>
<Text dimColor>
{slots.length > 1
? '↑↓ row, type to set, Tab default, Backspace none, Enter save, ESC cancel'
? '↑↓ row, type to set, Tab default, Backspace none, Shift+Tab toggle all none/default, Enter save, ESC cancel'
: 'Type any character or emoji, Tab default, Backspace none, Enter save, ESC cancel'}
</Text>
<Box marginTop={1} flexDirection='column'>
Expand Down