Skip to content

feat(navigation): show tab index in titles (display-tab-number)#1697

Open
cmoron wants to merge 1 commit into
raphamorim:mainfrom
cmoron:feat/display-tab-number
Open

feat(navigation): show tab index in titles (display-tab-number)#1697
cmoron wants to merge 1 commit into
raphamorim:mainfrom
cmoron:feat/display-tab-number

Conversation

@cmoron

@cmoron cmoron commented Jun 30, 2026

Copy link
Copy Markdown

Summary

Adds an opt-in [navigation] display-tab-number setting. When enabled, each tab in the rio-rendered strip is prefixed with its 1-based visual position:

1 vim
2 ~/src/rio
3 htop
[navigation]
display-tab-number = true
# Optional separator between the number and the title (default: a single space)
tab-number-separator = " - "   # -> "1 - vim"

Default is false — no change for existing users.

Closes #1537.

Why

Behavior

  • Reordering renumbers automatically. The number is the render position (tab_index), i.e. the live slot in ContextManager's contexts vector. Keyboard moves (move_current_to_*) and drag-reorder physically reorder that vector, so a tab dragged from slot 3 to the front becomes 1 and the rest shift up (ghostty-style), live during the drag.
  • Configurable separator. tab-number-separator is the string inserted between the number and the title. Default is a single space (1 vim); set " - " for 1 - vim, ": " for 1: vim, or "" for 1vim.
  • Applied uniformly, including user-renamed tabs.
  • Scope: Tab mode only. Plain has no strip; NativeTab (macOS) uses the OS tab bar, which rio doesn't render.
  • Live config reload is honored — the preserved island picks up both settings.

Implementation

  • rio-backend: two Navigation fields — display-tab-number: bool and tab-number-separator: String (default " ").
  • frontends/rioterm: Island carries both; get_title_for_tab applies the prefix via a small pure format_tab_label(display, position, separator, title) helper, so both the strip and the drag preview share one code path.

Tests

  • rio-backend: parses display-tab-number / tab-number-separator and checks defaults.
  • rioterm: format_tab_label prefix + separator logic, and a reorder test asserting the moved tab renumbers (["a","b","c"] → move c to front → ["1 - c","2 - a","3 - b"]).

cargo fmt --check, cargo clippy --all-targets --features wgpu, and the touched test suites pass locally.

Docs

Companion docs PR (config reference for both options): raphamorim/rioterm.com#2

In `Tab` navigation mode the strip shows only each tab's title, which
makes visual/keyboard tab tracking harder on wide layouts (raphamorim#1537).
The maintainer endorsed a `[navigation] display-tab-number` toggle in
PR raphamorim#593, closed only because the tab system was being rewritten for v0.3;
that rewrite has since landed.

Opt-in (default false). The number is the 1-based render position, so
reordering tabs (keyboard move or drag) renumbers them for free. The
index/title separator is configurable via `tab-number-separator`
(default a single space).
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.

Feature request: show a number on the tab?

1 participant