Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config to use a pager in the staging panel #4332

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stefanhaller
Copy link
Collaborator

  • 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.

Problems:
- sometimes the wrapping is off; I suspect Decolorize is missing some cases
- in the patch building panel, only shows the formatted diff as long as nothing
  has been staged, because then it wants to color the line starts of the
  included lines
- with delta, selection is almost invisible because we are only changing the
  background color, but delta colors the background too (diff-so-fancy doesn't)
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 4e38a941 36.36%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (4e38a94) Report Missing Report Missing Report Missing
Head commit (6fbd99a) 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

Footnotes

  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.

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.

Support diff-so-fancy patch mode by using --patch when building code sets
1 participant