lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Add config to use a pager in the staging panel

Open stefanhaller opened this issue 9 months ago • 2 comments

  • PR Description

Very rough, preliminary prototype of enabling a pager in the staging panel. It adds a separate config option for this, because the staging pager likely needs special command-line options (e.g. --patch in case of diff-so-fancy, --color-only in case of delta).

This is not for real use yet, it doesn't work well enough; it's just to see what problems we would have to solve if we wanted this.

Some of the problems:

  • When line wrapping is on (default), there's sometimes a discrepancy between what's selected and what it acts on (can be seen when jumping between hunks with arrow left/right, it doesn't select the first changed line of the hunk, but one before). I suspect this may be caused by the Decolorize function not working well enough. For testing it's probably a good idea to disable wrapping (gui.wrapLinesInStagingView: false) to work around this.
  • In the patch building panel it stops using the pager as soon as you stage a line. This is because it wants to color the line starts of the lines included in the patch; we'd need to figure out some other way of visualizing this.
  • For delta, the highlighted line is almost invisible on added or deleted lines, because highlighting changes only the background color, but delta paints over the entire background for added and deleted lines. diff-so-fancy doesn't do this, so it works a little better there.

Would fix #4201, #2117, and #1939 if we got this to work for real.

stefanhaller avatar Feb 26 '25 20:02 stefanhaller

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 4e38a941de3baf9e50d3fd5432933d6efccff091[^1] :white_check_mark: 36.36%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (4e38a941de3baf9e50d3fd5432933d6efccff091) Report Missing Report Missing Report Missing
Head commit (6fbd99a127867cd612bc2103805576bfbab32f38) 53129 45994 86.57%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4332) 44 16 36.36%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more [^1]: Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

codacy-production[bot] avatar Feb 26 '25 20:02 codacy-production[bot]

Any updates on this ?

aecsar avatar May 30 '25 17:05 aecsar