dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
21.36k stars 360 forks source link

🐛 Weird/unexpected output on VS Code with 0.17.0 #1735

Open kfkonrad opened 6 days ago

kfkonrad commented 6 days ago

When running delta version 0.17.0 on a terminal in VS Code I get the following ouput:

bash-5.2$ delta
^[]11;rgb:1818/1818/1818^[\The main way to use delta is to configure it as the pager for git: see https://github.com/dandavison/delta#get-started. You can also use delta to diff two files: `delta file_A file_B`.
^[]11;rgb:1818/1818/1818^[\^[[?1;2cbash-5.2$ 11;rgb:1818/1818/18181;2c

Running delta in another terminal emulator such as iTerm or Terminal on my Mac yields the desired output. Due to this buggy ouput delta 0.17.0 is unusable on VS Code right now, at least on my machine.

I also did a cargo build --release to verify that the bug is still in the code base on main as of commit id f5b3717. The bug also comes up using zsh and fish as the shell btw

The bug does not occur with 0.16.5 so my quickfix for the meantime is to just use this older version.

bash commented 6 days ago

The sequences stem from delta's background/foregreound color detection. The weird output is the terminal's response which you should normally not see.

You can disable the automatic detection by explicitly specifying --dark / --light (or dark = true / light = true in the config file) See https://dandavison.github.io/delta/choosing-colors-styles.html for details.

What version of VSCode are you running? Is delta also quite slow by any chance?

kfkonrad commented 5 days ago

I can confirm using the --dark or --light flag or respective config also prevents the weird output I'm on the latest VS Code version: 1.90.2 delta isn't slow, not that I could tell anyway.

bash commented 5 days ago

Unfortunately I can't reproduce this on my own mac or @janhohenheim's mac with VSCode 1.90.2 and delta 0.17.0.

Follow-up questions:

I came up with a list of things that you could try to help figure out why this happens if you're up for it 😃

janhohenheim commented 5 days ago

Note that we are both running Intel macs. I don't expect this to make a difference, but I've seen very weird issues come from different architectures in the past.

kfkonrad commented 3 days ago

I can't replicate the bug anymore. I don't know what changed about my system because I don't recall running updates in the last two days. I'm sorry if that means I/we pinpoint the error further if/when it reappears elsewhere.

Here's the answers to your questions in case that's still relevant:

I don't use a multiplexer and my delta config is as follows:

[delta]
    navigate = true    # use n and N to move between diff sections
    hunk-header-decoration-style = yellow box
    hyperlinks = true
    hyperlinks-file-link-format = "vscode://file/{path}:{line}"

    # delta detects terminal colors automatically; set one of these to disable auto-detection
    # dark = true
    # light = true

I'm not sure which parts of my VS Code settings are relevant so here's everything starting with terminal.integrated:

    "terminal.integrated.fontSize": 14,
    "terminal.integrated.experimentalImageSupport": true,
    "terminal.integrated.tabs.enabled": true,
    "terminal.integrated.sendKeybindingsToShell": true,
    "terminal.integrated.defaultProfile.windows": "Git Bash",
    "terminal.integrated.scrollback": 1000000,
    "terminal.integrated.enableMultiLinePasteWarning": false,
    "terminal.integrated.shellIntegration.decorationsEnabled": "never",
    "terminal.integrated.shellIntegration.enabled": false,
    "terminal.integrated.gpuAcceleration": "on"

I tried compiling the version on your branch @bash and it worked fine (just like 0.16.5 and 0.17.0 do now).

The output of your printf-Snippet is ^[]10;rgb:cccc/cccc/cccc^[\^[]11;rgb:1818/1818/1818^[\^[[?1;2c.

I also ran your example program and its output is dark, fg: 82, bg: 8

bash commented 3 days ago

@kfkonrad Thank you so much for working through my pinpoint steps 💛 I'll try to apply your settings, maybe I'll find a way to reproduce it on my machine.

I can't replicate the bug anymore. [..] I'm sorry if that means I/we pinpoint the error further if/when it reappears elsewhere.

No worries :) Let me know if the issue reappears.