fj default pager (less) lacks --quit-if-one-screen: short list/view output hangs in the pager #156

Open
opened 2026-06-11 04:23:07 +00:00 by stephen · 0 comments
Owner

Symptom

fj pr list (and other list/view table commands) appear to "hang" / not resolve in an interactive terminal. Root cause: with PAGER/FJ_PAGER unset, fj pipes output through plain less, which opens a full-screen pager and waits for q even when the output is a few rows (or empty). To the user it looks like the command never returned.

Expected

Match git/gh: only page when output exceeds the terminal height. Invoke the default pager with --quit-if-one-screen --no-init (i.e. less -FRX, or set LESS=-FRX for the spawned pager), so short results print and return immediately and long results still page.

Fix

  • When falling back to the built-in default pager (less), pass -F (quit if one screen) and -R (raw control chars), and -X/--no-init so it doesn't clear the screen for short output.
  • Respect an explicitly-set FJ_PAGER/PAGER as-is (user's choice).
  • --no-pager already works as the escape hatch; this just fixes the default.

Env

  • fj 0.2.0, headless Linux; PAGER/FJ_PAGER unset → defaults to less with no flags.
## Symptom `fj pr list` (and other list/view table commands) appear to "hang" / not resolve in an interactive terminal. Root cause: with `PAGER`/`FJ_PAGER` unset, `fj` pipes output through plain `less`, which opens a full-screen pager and waits for `q` **even when the output is a few rows (or empty)**. To the user it looks like the command never returned. ## Expected Match `git`/`gh`: only page when output exceeds the terminal height. Invoke the default pager with `--quit-if-one-screen --no-init` (i.e. `less -FRX`, or set `LESS=-FRX` for the spawned pager), so short results print and return immediately and long results still page. ## Fix - When falling back to the built-in default pager (`less`), pass `-F` (quit if one screen) and `-R` (raw control chars), and `-X`/`--no-init` so it doesn't clear the screen for short output. - Respect an explicitly-set `FJ_PAGER`/`PAGER` as-is (user's choice). - `--no-pager` already works as the escape hatch; this just fixes the default. ## Env - fj 0.2.0, headless Linux; `PAGER`/`FJ_PAGER` unset → defaults to `less` with no flags.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rasterstate/fj#156
No description provided.