Count wrapped rows when clearing a shown password or seed on Linux
I maintainer di solito rispondono entro 1 giorno
@dotnetdork ci sta già lavorando.
Dal 2/11/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Read first
- Design 04, section 2.3 (a new password is shown once, then cleared from the screen)
- Design 16, section 4.1 (a new decoy seed is shown the same way)
- Issue #140 and PR #143: the same fix on Windows.
Read these before starting. If this issue and the spec disagree, the spec wins; say so in the pull request.
Summary
On Linux, the screen that shows a new password or decoy seed once moves the cursor up a fixed number of lines and clears from there. On a narrow terminal, a long line (the prompt, or a long seed) wraps onto two or more rows, so the count is too small and the top of the block, including the secret, can stay on screen. Count rows, not lines, as the Windows version now does.
Depends on
Nothing.
Location & Context
core/secret/secret.sh,lab_secret_show:lines=6, plus one per repeated prompt, thenlab_tty_write $'\r\033['"$lines"$'A\033[J'.core/seed/seed.sh,lab_seed_show: the same pattern.- The Windows version (
Get-LabTerminalRowCountandGet-LabClearRowincore/secret/Secret.ps1, from PR #143) counts each line asfloor(length / width)wrapped rows plus one, which is the model to follow.
Current Behavior
The count assumes every line fits on one row. The seed prompt ("Type 'recorded' once it is in the offline record and the team chat: ") is about 70 characters plus the operator's answer, so on a terminal narrower than that, or after a long wrong answer, it takes two rows. Each extra row leaves one more row of the block uncleared at the top, and the secret sits three rows from the top.
Risk: the screen promises "shown once", but on a narrow window (a split pane or a small SSH console) the secret can stay visible.
Plan
- Read the terminal width when showing the block (
tput colson the terminal, orstty size; fall back to 80 when neither works). - Count the rows written: for each line written (including each prompt plus the typed answer),
floor(length / width) + 1. - Move up by that row count and clear to the end of the screen, as now.
- Share one helper between
lab_secret_showandlab_seed_show.
Acceptance tests
- A bats test of the row count: a line exactly the width, one longer than the width, and a long wrong answer, at widths 80 and 25.
-
lab_secret_showandlab_seed_showmove up by the counted rows (the test double for the terminal records the escape sequence). - Existing secret and seed tests still pass.
Done when
- The fix is merged with CI green.
Out of scope
- Clearing the terminal's own scrollback history.
- The Windows version (#140, done).
- Lingua principale
- PowerShell
- Stelle
- 0
- Fork
- 0
- Merge medio
- 2h 7m
- PR unite (30g)
- 53
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di dotnetdork/Labyrinth
-
area: accounts area: core type: docs
Difficoltà 3/5 1-2 giorni Idoneità per principianti 75/100
dotnetdork/Labyrinth#137 ·
I maintainer di solito rispondono entro 1 giorno
-
area: command-line platform: linux platform: windows type: docs
Difficoltà 4/5 3-5 giorni Idoneità per principianti 70/100
dotnetdork/Labyrinth#125 ·
I maintainer di solito rispondono entro 1 giorno
-
area: tests-ci platform: windows type: build
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
dotnetdork/Labyrinth#124 ·
I maintainer di solito rispondono entro 1 giorno
-
area: command-line platform: linux platform: windows type: feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 70/100
dotnetdork/Labyrinth#120 ·
I maintainer di solito rispondono entro 1 giorno
-
area: command-line platform: linux platform: windows type: feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 70/100
dotnetdork/Labyrinth#119 ·
I maintainer di solito rispondono entro 1 giorno