Skip to content

feat(terminal): add manual tab rename command and dialog#141

Open
niwo-gh wants to merge 2 commits intopolyipseity:mainfrom
niwo-gh:feat/manual-tab-rename
Open

feat(terminal): add manual tab rename command and dialog#141
niwo-gh wants to merge 2 commits intopolyipseity:mainfrom
niwo-gh:feat/manual-tab-rename

Conversation

@niwo-gh
Copy link
Copy Markdown

@niwo-gh niwo-gh commented Apr 2, 2026

Summary

  • Adds a userTitle field to TerminalView.State that lets users manually rename terminal tabs
  • Rename is accessible via the pane context menu ("Rename") and the command palette ("Rename Terminal")
  • The manual title takes priority over OSC/shell-set titles and profile names; clearing it restores the previous automatic name
  • Persists across sessions via the existing state serialization

Resolves #94

Changes

Area Detail
State New nullable userTitle: string | null field with fixTyped validation; defaults to null
UI Rename item added to pane context menu (grouped with copy/edit/restart)
Command rename-terminal registered via addCommand with withLastFocusedView ([false, true])
Dialog DialogModal with text input; trims whitespace, converts empty to null
i18n 4 new keys in en locale (commands.rename-terminal, components.terminal.menus.rename, .rename-prompt, generic.rename); 3 icon keys in en/asset.json; all 48 non-English locales synced via sync-locale-keys.mjs
Tests tests/src/terminal/view.spec.ts — covers State.DEFAULT, State.fix() with valid string, missing, non-string, boolean, null, and empty string inputs
Changeset manual-tab-rename-minor.md — minor bump

How it works

  1. User right-clicks a terminal tab → "Rename" (or invokes "Rename Terminal" from the command palette)
  2. A dialog appears with a text input pre-filled with the current custom title (or empty if none)
  3. On confirm, the trimmed value is stored as state.userTitle; empty input clears to null
  4. The name getter priority chain: userTitle → OSC title → profile name → executable basename → i18n fallback
  5. Setting this.state triggers updateView() which refreshes the tab header and persists layout

Testing

  • 134 vitest tests pass (14 files), 0 type errors, 0 unhandled errors
  • New test file mocks src/import.js to avoid xterm addon loading in the test environment

niwo-gh added 2 commits April 2, 2026 10:59
Add a userTitle field to TerminalView.State that lets users rename
terminal tabs via pane menu or command palette. The manual title
takes priority over OSC/shell-set titles and profile names; clearing
it restores the previous automatic name.

- State: add nullable userTitle field with fixTyped validation
- UI: add rename item to pane context menu and register command
- Dialog: DialogModal with text input, trim + null-on-empty
- i18n: add rename keys to en locale, sync all 48 locales
- Tests: add State.DEFAULT and State.fix() coverage for userTitle

Resolves polyipseity#94
@janah01 janah01 self-requested a review April 3, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update tab name

1 participant