8000 Alpha TUI: fixes from the owner's trial of flahax mix by rafatahmed · Pull Request #136 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

Alpha TUI: fixes from the owner's trial of flahax mix - #136

Merged
rafatahmed merged 4 commits into
mainfrom
fix/windows-arrow-keys
Oct 23, 2026
Merged

rafatahmed merged 4 commits into
mainfrom
fix/windows-arrow-keys

Conversation

@rafatahmed
@rafatahmed rafatahmed commented Oct 23, 2026 •
Copy link
Copy Markdown
Owner

What changes

In Windows Terminal, the arrow keys in the full-screen flahax mix typed àP / àH instead of moving the highlight. In the crop-formula list they filled the filter; in other lists they seemed to do nothing. This PR fixes that.

Root cause

  • Windows sends an arrow key as two codes: the prefix 0xE0 (or 0x00), then H, P, K or M.
  • The mix TUI on Windows: typing "à" swallows the next key #127 change read the second code only when msvcrt.kbhit() reported it as waiting, so that the letter à (also 0xE0) would stand alone.
  • Windows Terminal reports False between the two codes, so each arrow became à plus a letter.

The fix

Checks

tests.test_terminal and tests.test_mix_tui pass. ruff check and ruff format --check pass, and the files use LF line endings.

Also: readable key help on every theme

The key help ("Q Quit", Tab), the inactive tab names, the "Sheets:" line and the "Filter:" label were drawn faint (ANSI SGR 2) and vanished on the owner's translucent grey theme. They now use the terminal's normal colour; test_no_faint_text (wizard and results) failed before the change.

Also: leaving the results asks first (#138)

Q or Esc on the results screen now asks "Leave the results? The sheets are saved in . Y/N"; Y leaves, any other key stays. Ctrl+C still leaves at once.

Also: findings of the screen-by-screen audit (#139-#146)

The real code was driven with keystrokes through a full batch (new well-water analysis, formula, ticked fertilizers, new acid) at 80 x 24 and 120 x 30, and every screen was reviewed:

Full suite 616 tests OK (PHREEQC included); the 97-result behaviour baseline is identical.

Owner check

Reinstall from this branch:

python -m pip install --force-reinstall --no-deps "git+https://github.com/rafatahmed/Flahax.git@fix/windows-arrow-keys"

Then run flahax mix in Windows Terminal: ↑/↓ should move the highlight in the water list and the crop-formula list, and the key help line ("Q Quit") should be readable at the bottom.

Closes #135
Closes #137
Closes #138
Closes #139
Closes #140
Closes #141
Closes #142
Closes #143
Closes #144
Closes #145
Closes #146

The #127 change read an arrow key's second code only when kbhit() reported it, which Windows Terminal does not, so arrows typed 'àH'/'àP'. #127 is reopened for a ReadConsoleInputW-based fix.
@rafatahmed rafatahmed self-assigned this Oct 23, 2026
Faint text (SGR 2) vanished on a translucent grey Windows Terminal theme, hiding Q Quit.
@rafatahmed rafatahmed changed the title Fix arrow keys in Windows Terminal for flahax mix Fix arrow keys and readable key help for flahax mix in Windows Terminal Oct 23, 2026
@rafatahmed rafatahmed changed the title Fix arrow keys and readable key help for flahax mix in Windows Terminal Alpha TUI: fixes from the owner's trial of flahax mix Oct 23, 2026
@codecov-commenter
codecov-commenter commented Oct 23, 2026 •
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.43750% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.83%. Comparing base (ac68c01) to head (48cf334).

Files with missing lines Patch % Lines
src/flahax/terminal.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #136      +/-   ##
==========================================
+ Coverage   89.78%   89.83%   +0.05%     
==========================================
  Files          54       54              
  Lines        7281     7322      +41     
==========================================
+ Hits         6537     6578      +41     
  Misses        744      744              
Flag Coverage Δ
unittests 89.83% <98.43%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Space ticks only while the filter is empty; while filtering, Space types and Tab
  ticks, and the key help says so (#139).
- Rounding noise below 1e-9 prints as 0; nutrient columns keep a space apart (#140).
- Tank card headings and the Tanks footer wrap instead of being cut (#141).
- Grower words where growers read: NO3-N in the formula prompts, "Warning: the
  formula is ...", and readable notes on the screen, the sheet and the terminal
  (#142). summary.json is unchanged.
- "Added <acid> for the pH plan." and "Name of this acid" (#143).
- The lab values typed so far show above each lab-value question (#144).
- The Tanks answer takes two lines in "Your batch" (#145).
- A view that continues above or below the window says so (#146).

The line-mode transcript fixture changes only in the acid name prompt, the new
"Added ..." line and "Formulation:" for "formulation:".
@rafatahmed
rafatahmed merged commit c6b3f2e into main Oct 23, 2026
8 checks passed
@rafatahmed
rafatahmed deleted the fix/windows-arrow-keys branch October 23, 2026 18:28
rafatahmed added a commit that referenced this pull request Nov 7, 2026
Alpha TUI: fixes from the owner's trial of flahax mix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
0