zed icon indicating copy to clipboard operation
zed copied to clipboard

Terminal Pager is blank when using `delta` as pager for `git diff`

Open fitzy1321 opened this issue 9 months ago • 1 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

Zed Terminal Pager does not work with git-delta as a replacement for the default git diff pager. This tool works in Vscode Terminal, and all my other shells.

Steps to Reproduce:

  • Install delta
    • I used cargo install git-delta
    • Available in most package managers, install it
  • Use delta as pager in git conifg
  • Open a git repo in Zed
  • Make local changes to a file and save file
  • Enter git diff in Zed terminal

Expected Results:

  • Terminal should show delta style git diff, based on git config
    • Pager should "exit" early for short changes, i.e. no prompt or navigation needed because it fits on a "single page"
    • Longer changes should show diff and nav prompt, i.e. : at the bottom

Actual Results:

  • Terminal flashes for split second
  • Pager doesn't show any text
  • The only thing shown is the prompt at the bottom

I like to use delta, instead of the default pager, for my git diffs. I use it throughout my personal and professional dev envs, and it works well with other terminals and shells. But in Zed Terminal, when I enter git diff and delta is the pages in git config, the terminal goes blank. The only thing I can see is the : prompt at the bottom of the terminal.

The default git diff pager works in Zed Terminal.

I've used delta and my current config in Alacritty, Gnome Shell, Macos Terminal and iTerm, Kitty, and Vscode terminal without issues.

Not sure if it's relevant, but I use fish with starship.rs, instead of bash or zsh But the bug occurs in all 3 shells, and with or without starship shell active.

Config lives in git config file at ~/.config/git/config and looks like this:

[user]
	name = ...
	email = ...
[fetch]
	prune = true
[pull]
	ff = only
[init]
	defaultBranch = main

# delta config
# To Install: cargo install git-delta
[core]
	pager = delta
[delta]
	line-numbers = true
	file-style = bold yellow ul
	file-decoration-style = none
[interactive]
	diffFilter = delta --color-only

Environment

Zed: v0.134.4 (Zed) OS: macOS 14.4.1 Memory: 16 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

vscode example with delta Screenshot 2024-05-11 at 7 58 03 AM

zed example with delta Screenshot 2024-05-11 at 7 58 51 AM

zed example with default git config image

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

Zed.log

fitzy1321 avatar May 11 '24 14:05 fitzy1321

I just updated Zed and did a fresh install of delta, still using cargo.

The diff now appears, but looks like some color strings are showing too?

image

fitzy1321 avatar May 11 '24 21:05 fitzy1321

I'm experiencing this as well, albeit with different config for delta. I don't get the diff at all; just the color strings.

mgoodness avatar May 21 '24 21:05 mgoodness

Looks like a bug introduced into delta. Relevant issue

mgoodness avatar Jun 05 '24 19:06 mgoodness

Adding this line to my git config fixed this issue for me, as suggested in the linked issue here.

[core]
	pager = delta --dark

And it doesn't seem to negatively impact my other shells / terminals as well 👍

fitzy1321 avatar Jun 23 '24 18:06 fitzy1321