From 08e71bd1b4d96ef8ac48cecbc2eaa65318414f3b Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Mon, 2 Mar 2026 21:07:20 -0500 Subject: [PATCH] feat(tui-v2): cap card width, fix hint casing, verb-first compact strip Add max_width=72 to _board_card so Content cards don't stretch across viewport. Capitalize Nostr QR Private hint. Compact mode global strip now uses verb-first labels matching normal and dense modes. Co-Authored-By: Claude Opus 4.6 --- docs/tui_v2_ui_refresh_plan.md | 20 +++++++++++++++++++ memory-update.md | 11 ++++++++++ src/seedpass/tui_v2/app.py | 18 +++++++++++------ src/tests/test_tui_v2_textual_interactions.py | 4 ++-- 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/docs/tui_v2_ui_refresh_plan.md b/docs/tui_v2_ui_refresh_plan.md index 4a922796..55b72d74 100644 --- a/docs/tui_v2_ui_refresh_plan.md +++ b/docs/tui_v2_ui_refresh_plan.md @@ -1248,3 +1248,23 @@ Validation: 1. `poetry run pytest -q src/tests/test_tui_v2_textual_interactions.py src/tests/test_tui_v2_action_matrix.py` 2. Result: `58 passed`. + +## 35) Progress Update (2026-03-03, Slice: Final Micro-Polish) + +Completed: + +1. Added max-width cap (72 chars) to `_board_card` renderer: + - Content cards no longer stretch across the full viewport. + - Long rows are truncated with ellipsis character. + - Note board max line width reduced from ~112 to 76 chars. +2. Capitalized Nostr action hint: + - Before: `qr private confirm` + - After: `QR Private (confirm)` +3. Compact mode global strip now uses verb-first labels: + - Before: `S Settings A Add C Create Seed R Remove Seed H Hide/Reveal E Export I Import B Backup Ctrl+P Cmd Compact` + - After: `Settings (S) Add (A) Seed+ (C) Seed- (R) Reveal (H) Export (E) Import (I) Backup (B) Cmd (Ctrl+P)` + +Validation: + +1. `poetry run pytest -q src/tests/test_tui_v2_textual_interactions.py src/tests/test_tui_v2_action_matrix.py` +2. Result: `58 passed`. diff --git a/memory-update.md b/memory-update.md index 74378a3d..db5abab5 100644 --- a/memory-update.md +++ b/memory-update.md @@ -210,3 +210,14 @@ ### Verification - Focused TUI v2 gate: `58 passed`. + +## Session Update (2026-03-03, Slice 9) + +### Final micro-polish +- `_board_card` now has max_width=72 cap with ellipsis truncation for long rows. +- Nostr action hint capitalized: `QR Private (confirm)`. +- Compact mode global strip verb-first: `Settings (S) Add (A) ...`. +- All three modes (compact/dense/normal) now share consistent verb-first label style. + +### Verification +- Focused TUI v2 gate: `58 passed`. diff --git a/src/seedpass/tui_v2/app.py b/src/seedpass/tui_v2/app.py index 3f59ccbb..357cdd13 100644 --- a/src/seedpass/tui_v2/app.py +++ b/src/seedpass/tui_v2/app.py @@ -906,7 +906,7 @@ def launch_tui2( if kind: context = f"{context} ({kind_l})" if self._compact_layout: - global_row = "S Settings A Add C Create Seed R Remove Seed H Hide/Reveal E Export I Import B Backup Ctrl+P Cmd Compact" + global_row = "Settings (S) Add (A) Seed+ (C) Seed- (R) Reveal (H) Export (E) Import (I) Backup (B) Cmd (Ctrl+P)" if self._viewport_width and self._viewport_width < 130: context = context.replace("Entry ▣ ", "") context = context.replace("Reveal", "Rev") @@ -1901,10 +1901,16 @@ def launch_tui2( ] @staticmethod - def _board_card(title: str, rows: list[str]) -> list[str]: - width = max([len(title), *[len(row) for row in rows], 12]) + def _board_card( + title: str, rows: list[str], *, max_width: int = 72 + ) -> list[str]: + natural = max([len(title), *[len(row) for row in rows], 12]) + width = min(natural, max_width) + capped_rows = [ + r if len(r) <= width else f"{r[: width - 1]}\u2026" for r in rows + ] top = f"+- {title} " + "-" * max(1, width - len(title) - 2) + "+" - body = [f"| {row.ljust(width)} |" for row in rows] + body = [f"| {row.ljust(width)} |" for row in capped_rows] bottom = "+" + "-" * (width + 2) + "+" return [top, *body, bottom] @@ -2240,9 +2246,9 @@ def launch_tui2( tags_text=tags_text, notes_text=notes_text ), ( - "Actions: v reveal | g qr | qr private cfm | a archive" + "Actions: v reveal | g qr | QR Private (cfm) | a archive" if self._dense_hires_layout - else "Actions: Reveal (v) | QR (g) | qr private confirm | Archive (a)" + else "Actions: Reveal (v) | QR (g) | QR Private (confirm) | Archive (a)" ), ] return "\n".join(lines) diff --git a/src/tests/test_tui_v2_textual_interactions.py b/src/tests/test_tui_v2_textual_interactions.py index a9098341..e1ebe41b 100644 --- a/src/tests/test_tui_v2_textual_interactions.py +++ b/src/tests/test_tui_v2_textual_interactions.py @@ -1263,7 +1263,7 @@ async def test_tui2_textual_compact_layout_hides_link_panel_and_can_restore() -> await pilot.pause() link_detail = app.query_one("#link-detail", Static) assert link_detail.has_class("hidden") - assert "Compact" in _widget_text(app, "#action-strip") + assert "Settings (S)" in _widget_text(app, "#action-strip") detail = _widget_text(app, "#entry-detail") assert "Tags: alpha, beta" in detail assert "Notes: compact note" in detail @@ -1275,7 +1275,7 @@ async def test_tui2_textual_compact_layout_hides_link_panel_and_can_restore() -> app._update_responsive_layout(width=120) await pilot.pause() assert link_detail.has_class("hidden") - assert "Compact" in _widget_text(app, "#action-strip") + assert "Settings (S)" in _widget_text(app, "#action-strip") @pytest.mark.anyio