Skip to content

fix(diff): keep diff pager open on short diffs#51

Merged
mathix420 merged 1 commit into
mathix420:masterfrom
AbysmalBiscuit:fix/diff-pager-quit
Jul 13, 2026
Merged

fix(diff): keep diff pager open on short diffs#51
mathix420 merged 1 commit into
mathix420:masterfrom
AbysmalBiscuit:fix/diff-pager-quit

Conversation

@AbysmalBiscuit

@AbysmalBiscuit AbysmalBiscuit commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

This PR fixes the bug where delta closes instantly on some diffs.

Cause

git exports LESS=FRX to its pager. The F (quit-if-one-screen) flag makes delta's less exit the moment a diff fits the pane, the diff session exits with it, and reap_exited_sessions closes the tab before the user can read anything. Longer diffs are unaffected, which is why this reads as a length-dependent glitch.

Fix

This PR makes it pass LESS=RX (git's other defaults without the F), so the pager waits for q regardless of diff length. A LESS the user set via [env] still wins, since the value is only inserted when the key is empty/missing.

git exports LESS=FRX to its pager, and the F (quit-if-one-screen) flag
makes delta's less exit as soon as a diff fits the pane. The diff
session then exits and reap_exited_sessions closes the tab before the
user can read it, so any diff shorter than one screen flashed and
vanished while longer diffs stayed open.

Set LESS=RX (git's defaults without F) for diff sessions so the pager
always waits for q. A LESS set by the user via [env] still wins.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@AbysmalBiscuit AbysmalBiscuit marked this pull request as ready for review July 13, 2026 09:41
@mathix420 mathix420 merged commit c6d0226 into mathix420:master Jul 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants