lazygit
lazygit copied to clipboard
How to enable pager while interactive staging
Topic When I enable pager as delta or diff-so-fancy as described, syntax highlighting enables only when staging a file. When I want to stage line by line, pager doesnt affects stage and unstage area. How can I enable pager for both file and line staging?
Facing the same issue.
@jesseduffield Is the below given function causing this behavior? Not sure if this kind of interactive staging is even possible using delta.
https://github.com/jesseduffield/lazygit/blob/ef82f394312e6f1c100f5153187d5537d701384f/pkg/commands/git_commands/working_tree.go#L295-L314
Facing a similar issue when trying to scroll the diffs of a file with the 'j' and 'k' keys. When I'm just using the files section to browse I can see the delta diff view as expected. Yet when I hit enter the delta pager view is replaced with the default giff pager view.
Also when I just git diff on the command line I can scroll up and down the delta pager view as expected.
I'm wondering if this has to do with delta using less for presentation somehow.
There's two things to discuss here. The first is that we do not support using arbitrary pagers in our staging mode. The second is that we don't allow focusing the main panel for a file without switching to staging mode.
If we added the ability to focus the main panel for a file without switching the staging mode, that would allow you to easily scroll through the delta diff. This would be a much easier change than supporting the delta diff when you're actually staging a file line-by-line.
At any rate at the moment you can still scroll the main panel using pgup/pgdown
it looks like there is a similar or related issue: #1939
@jesseduffield Hi, just ran into this after starting to use the awesomness that is lazygit and wanted to let you know that delta pager in particular has an option that does not modify diff, but colors it only. It’s typically used with interactive staging for git according to the docs. I wonder if this could be an option to integrate into the current logic without changing too much…
https://github.com/dandavison/delta#get-started
[interactive]
diffFilter = delta --color-only
--color-only
Do not alter the input structurally in any way.
But color and highlight hunk lines according to your delta configuration. This is mainly intended for other tools that use delta.
Also, for reference, from the git man page:
interactive.diffFilter
When an interactive command (such as git add --patch) shows a
colorized diff, git will pipe the diff through the shell
command defined by this configuration variable. The command
may mark up the diff further for human consumption, provided
that it retains a one-to-one correspondence with the lines in
the original diff. Defaults to disabled (no filtering).
So maybe we can have something equivalent, like:
- define a new option
interactiveDiffFilter
(or some name) that users can configure todelta --color-only
- if configured, pass the output of https://github.com/jesseduffield/lazygit/blob/ef82f394312e6f1c100f5153187d5537d701384f/pkg/commands/git_commands/working_tree.go#L310 through this command.
Since the pager issue cannot be solved temporarily, can we some how at least be able to scroll custom_pager to preview all changes when there're too much changes in one file? Currently we can only preview the most top changes in one file, which depends on the size of the window and cannot scroll.
Huh? We used to have a bug that prevented scrolling in the diff view, but it was fixed back in 0.37. I can definitely scroll the diff to see all changes. Can you explain this more?
@stefanhaller Oh sorry! I realized that it's an issue with my terminal Warp, it's ok in iTerm.