fix(pager): set LESS=FRX unless hyperlinks are forced

Summary

StartPager previously set LESS=FrX (lowercase -r, all raw control chars) whenever shouldDisplayHyperlinks() returned true. With the recent change to default displayHyperlinks to auto, that branch is now taken on essentially every pager invocation — but in auto mode, shouldDisplayHyperlinks() returns false once pagerProcess != nil, so OSC 8 hyperlinks are never actually emitted to the pager. The -r flag was therefore pointless in the common path, but still allowed unexpected escape sequences to reach less. On some terminals/less versions this leaves the tty with -icanon -echo after the user quits the pager (typed input invisible, requires reset).

This MR restricts the -r form to displayHyperlinks == "always" — the only mode where the user has explicitly opted in to forwarding hyperlinks through the pager. Every other case gets -R (color escapes only), the long-standing safe default.

Why this matches the reported symptoms

  • The user’s split of working vs broken commands isn’t actually view vs list — it’s fits-in-one-screen vs doesn’t. With LESS=FrX, the F flag means less quits immediately for one-screen output and never enters interactive mode, so terminal state isn’t mutated. The commands the user marked as broken (mr list, issue list, release list, cluster agent list, runner list) are exactly the ones likely to overflow the screen and force less into interactive mode.
  • stripControlCharacters in the pager pipe already strips non-SGR CSI sequences, so the actual breakage surface from -r is narrow — but evidently non-empty on Pop!_OS 22.04 / less 590 (and reproduced on less 692).
  • Reverts the practical behavior to what it was prior to !{hyperlinks-default} (LESS=FRX) for all default users, without affecting users who force hyperlinks on.

Closes #8320 (closed)

Test plan

  • Manual: on the reporter's setup (Pop!_OS 22.04, less 590/692), confirm glab mr list against a repo with many MRs no longer leaves stty in -icanon -echo after quitting the pager.
  • Manual: confirm glab mr view and other one-screen commands still behave correctly.
  • Manual: with FORCE_HYPERLINKS=1, confirm OSC 8 hyperlinks still display correctly in less when piping through the pager.
  • CI: go test ./internal/iostreams/... passes locally.

Merge request reports

Loading