fix: keep the copy hint whole under a long list

The browser hint goes below the list, which scrolls: three folders at
40x12 cut it. The test browses a folder of its own, not the host's /home.
This commit is contained in:
Abdessamad Derraz committed 2026-10-27 12:47:54 +01:00
1 parent 6fd831fc67
commit e2bc06f216
5 files changed
+29 -17

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@
$ErrorActionPreference = "Stop"
$defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
$defaultInstallSha256 = "db262525b78f1a627d711bdfdaecd7774d9589db9b0f0aa62dd4d64f60948f70"
$defaultInstallSha256 = "0a21af2ef15c0ff2d97e76c0d65bad4595ae9f7857c0703963e408bb0a48d3f1"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
+9 -6
View File
@@ -15405,19 +15405,22 @@ def _status_after(state: TuiState) -> list[str]:
def _view_browse(state: TuiState, width: int, height: int) -> tuple:
where = "Drives" if state.browse_dir is None else middle(str(state.browse_dir), width)
after = _status_after(state)
hint: list = []
if state.browse_for == "from":
# Two lines at 40 columns: the long form was cut after "copied,".
whole = ("Choose the old card, a backup folder or a ZIP: its BIOS files are "
"copied, each one checked, nothing on it is changed.")
after.insert(0, whole if len(_wrap(whole, width)) <= 2
else "Choose the old card, a backup folder or a ZIP.")
hint = [whole if len(_wrap(whole, width)) <= 2
else "Choose the old card, a backup folder or a ZIP."]
elif state.browse_for == "save":
after.insert(0, f"Choose {display_name(state.platform)}'s save directory: some "
"cores read files there.")
hint = [f"Choose {display_name(state.platform)}'s save directory: some "
"cores read files there."]
# The hint is kept whole under the list, which scrolls: three folders at
# 40x12 cut it to "Choose the old card, a backup folder".
return ("Copy from" if state.browse_for == "from"
else "Save folder" if state.browse_for == "save" else "Browse for a folder",
_compose(state, width, height, [where], tui_rows(state), after),
_compose(state, width, height, [where], tui_rows(state), _status_after(state),
hint),
("A/Enter Open", "B/Esc Back", "? Help"))
+1 -1
View File
@@ -18,7 +18,7 @@ esac
TEMP_INSTALLER=""
TEMP_DIRECTORY=""
DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
DEFAULT_INSTALL_SHA256="db262525b78f1a627d711bdfdaecd7774d9589db9b0f0aa62dd4d64f60948f70"
DEFAULT_INSTALL_SHA256="0a21af2ef15c0ff2d97e76c0d65bad4595ae9f7857c0703963e408bb0a48d3f1"
MAX_INSTALLER_BYTES=2097152
cleanup() {
+8 -8
View File
@@ -27,8 +27,8 @@
{
"dest": "roms/ports/retrobios/install.py",
"repo_path": "install.py",
"size": 774796,
"sha256": "db262525b78f1a627d711bdfdaecd7774d9589db9b0f0aa62dd4d64f60948f70",
"size": 774938,
"sha256": "0a21af2ef15c0ff2d97e76c0d65bad4595ae9f7857c0703963e408bb0a48d3f1",
"executable": false
},
{
@@ -71,8 +71,8 @@
"muos": {
"archive": {
"dest": "ARCHIVE/RetroBIOS.muxapp",
"size": 827345,
"sha256": "1c4e3b27bbd9159fb529820b73530cb72166d92d0098bf224266e40b29e04bce"
"size": 827487,
"sha256": "f10183e9aab6eb74f2e3e0cc12998af2cc53ece5cff4a1251dffa6b22c748bc3"
},
"members": [
{
@@ -92,8 +92,8 @@
{
"name": "RetroBIOS/install.py",
"repo_path": "install.py",
"size": 774796,
"sha256": "db262525b78f1a627d711bdfdaecd7774d9589db9b0f0aa62dd4d64f60948f70",
"size": 774938,
"sha256": "0a21af2ef15c0ff2d97e76c0d65bad4595ae9f7857c0703963e408bb0a48d3f1",
"executable": false
},
{
@@ -166,8 +166,8 @@
{
"dest": ".config/modules/retrobios/install.py",
"repo_path": "install.py",
"size": 774796,
"sha256": "db262525b78f1a627d711bdfdaecd7774d9589db9b0f0aa62dd4d64f60948f70",
"size": 774938,
"sha256": "0a21af2ef15c0ff2d97e76c0d65bad4595ae9f7857c0703963e408bb0a48d3f1",
"executable": false
},
{
+10 -1
View File
@@ -8184,13 +8184,22 @@ class AuditSixteenAndNineScreens(unittest.TestCase):
self.assertIn("X, Space, Right/Left", " ".join(text.split()))
def test_the_copy_hint_fits_at_40_columns(self):
"""tui_audit_9 P3-16: cut after "copied,"."""
"""tui_audit_9 P3-16: cut after "copied,". On the CI runner /home
held three folders, and the list cut the hint: it is kept whole,
the list scrolling, from a folder of this test's own."""
home = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
self.addCleanup(shutil.rmtree, home, True)
for name in ("linuxbrew", "packer", "runner"):
(home / name).mkdir()
state = checked_state()
state.home = home
with mock.patch.object(install, "_mounted_cards", return_value=[]), \
mock.patch.object(install, "_listed", return_value=[]):
install._open_from_browser(state)
self.assertEqual(state.browse_dir, home)
text = " ".join(_screen_text(state, 40, 12).split())
self.assertIn("Choose the old card, a backup folder or a ZIP.", text)
self.assertIn("> Use this folder", text)
def test_the_miyoo_bar_says_what_a_does(self):
"""tui_audit_9 P3-17: A Tick on All and None, where A unticks."""