Skip to content

fix(tui): keep navigation bindings visible in narrow terminals - #118

Merged
abhiksark merged 3 commits into
abhiksark:devfrom
xjcway123:fix/narrow-footer-bindings
Aug 21, 2026
Merged

fix(tui): keep navigation bindings visible in narrow terminals#118
abhiksark merged 3 commits into
abhiksark:devfrom
xjcway123:fix/narrow-footer-bindings

Conversation

@xjcway123

Copy link
Copy Markdown
Contributor

Summary

  • prioritize topic, docs, and quit bindings so they remain visible at 40 columns
  • hide the command-palette shortcut only when the footer cannot fit, while preserving it at normal widths
  • put the close action first in the narrow docs footer
  • cover the 40×15 keyboard flow and normal-width footer labels with TUI tests

Testing

  • python -m pytest tests/tui -q — 36 passed
  • pythonlings --root tests/fixtures/passing_curriculum verify — 2 passed
  • PYTHONUTF8=1 python -m pytest -q — 187 passed; 5 Windows-only failures remain in untouched manifest tests due to path separators and unavailable symlink privileges
  • git diff --check — passed

Closes #79

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2f34815b-c103-4b2a-ab3e-b34076f88bf2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@abhiksark abhiksark left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking on #79, @xjcway123. The new pilot coverage is helpful, and the isolated TUI suite, full suite, and passing-curriculum verification all pass.

I am requesting three focused updates before merge:

  1. Preserve the normal binding order: F1, F2, F3, F4, F5, then quit. Essential bindings may be prioritized in the narrow presentation, but the full-width footer should not be globally reordered.
  2. Base the docs footer copy on the actual laid-out footer width. At 41 columns the current code selects the long label, but the modal footer is only 23 columns wide and renders O Open official docs |, hiding Esc Close.
  3. Attach a current 40 by 15 screenshot or GIF covering the track, docs, and topic-picker flow, as required for TUI changes.

Please add boundary coverage for the 41-column docs case and assert the intended binding order at normal width. Thank you for another pass.

Comment thread pythonlings/screens/track.py Outdated
Binding("f1", "toggle_hint", "Hint"),
Binding("f2", "reset", "Reset"),
Binding("f3", "toggle_list", "List"),
Binding("f4", "topics", "Topics"),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please preserve the normal logical order: F1, F2, F3, F4, F5, then quit. Moving F4, F5, and Escape to the front makes the footer read out of sequence at every width and solves narrow clipping by changing the full-width presentation. Keep the existing order at normal widths and prioritize the essential actions only in the narrow presentation. Please add an order assertion to the normal-width test.

Comment thread pythonlings/screens/docs.py Outdated

def on_resize(self, event: events.Resize) -> None:
self.query_one("#docs-footer", Static).update(
self._footer_text(event.size.width)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses the screen width, but the docs modal is only 72% wide and also has padding and a border. At 41 by 15, the footer region is 23 columns wide, the long label is selected, and the rendered line is only O Open official docs |, so Esc Close is hidden. Please choose the compact label from the laid-out footer content width and add a 41-column boundary test.

@xjcway123

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed review. I addressed all three requested updates in dcc65ac:

  1. Restored the normal-width binding order to F1, F2, F3, F4, F5, then quit. The custom footer only prioritizes Topics, Docs, and Quit in the narrow presentation.
  2. Changed the docs footer to select its copy using the footer widget’s actual laid-out width. I also added boundary coverage for the 41-column case, where the modal footer is 23 columns wide.
  3. Added a current 40×15 GIF covering the track, docs, and topic-picker flow.

Local validation:

  • python -m pytest tests/tui -q — 37 passed
  • passing curriculum verification — 2 passed
  • full suite in a UTF-8 Windows environment — 188 passed; the remaining 5 failures are Windows-specific (one path-separator assertion and four tests requiring symlink privileges)

Could you please take another look when convenient? Thank you.

pythonlings-pr118-40x15-flow

Brings in the Windows and macOS CI matrix (abhiksark#126) so this TUI change is
exercised on Windows before merge, plus the ASCII-locale CLI fix (abhiksark#125).
@abhiksark

Copy link
Copy Markdown
Owner

Thanks @xjcway123 — reviewed and this looks good to merge.

I've merged current dev into your branch so it picks up the CI matrix from #126, which added Windows and macOS. Your original checks predate that and only ran Python 3.11–3.13 on Ubuntu, and a footer that reacts to terminal width is exactly the kind of change where Windows console behaviour could differ. Worth knowing before merge rather than after.

What I verified locally on Python 3.9 with your branch merged onto current dev: 37 TUI tests pass, 215 pass overall, no conflicts. I also probed the two things that looked fragile and both hold on Textual 8.2.8 — the footer yields children whose .action values include topics/docs/quit, so your priority sort resolves; and text_for_width picks the long label at 80 columns and the compact one at 23 and 31.

Two non-blocking observations for a future pass, not asks:

  • _DocsFooter is constructed with the compact text, so if on_resize ever stopped firing the wide case would silently show the short label — and no test asserts the long label at normal width, so that regression would stay green.
  • The priority sort reads FooterKey.action, a Textual internal. If it's ever renamed the sort silently no-ops rather than failing, which is the quieter failure mode.

Once the Windows jobs come back green I'll merge.

@abhiksark
abhiksark merged commit 51dda35 into abhiksark:dev Aug 21, 2026
9 checks passed
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.

2 participants