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

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

Open
kfkonrad opened this issue Jul 1, 2024 · 6 comments
Open

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

kfkonrad opened this issue Jul 1, 2024 · 6 comments

Comments

@kfkonrad
Copy link

kfkonrad commented Jul 1, 2024

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
Copy link
Contributor

bash commented Jul 1, 2024

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
Copy link
Author

kfkonrad commented Jul 2, 2024

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
Copy link
Contributor

bash commented Jul 2, 2024

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:

  • Are you using a multiplexer (tmux, screen, zellij)?
  • Do you have any interesting settings set for the integrated terminal (Settings starting with terminal.integrated)?
  • What are your delta settings?

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 😃

  • Does the issue persist with the updated version of terminal-colorsaurus (That's the library that does the color detection)? Update terminal-colorsaurus #1699
  • What's the output of the following command (basically what happens when delta tries to detect the terminal's theme):
    printf '\e]10;?\e\\' && printf '\e]11;?\e\\' && printf '\e[c' && cat -v
    #      ^^^^^^^^^^^^^           ^^^^^^^^^^^^^            ^^^^
    #   ask for the fg color   ask for the bg color    ask for some basic info
  • What happens when you run the theme example from terminal-colorsaurus (only if you're comfortable running code from outside this repo).

@janhohenheim
Copy link

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
Copy link
Author

kfkonrad commented Jul 4, 2024

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
Copy link
Contributor

bash commented Jul 4, 2024

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

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

No branches or pull requests

3 participants