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

Formatting plugins insert garbage color codes at beginning of file in foot terminal #18172

Closed
fauu opened this issue Apr 19, 2022 · 6 comments
Closed
Labels
closed:invalid Issues that are closed as "invalid"

Comments

@fauu
Copy link

fauu commented Apr 19, 2022

Neovim version (nvim -v)

0.7.0 / 0.8.0-dev+6-gae325e6274 (tested both)

Vim (not Nvim) behaves the same?

no (tested :RustFmt on 8.2.4651)

Operating system/version

Arch Linux 5.17.3-lqx1-1-lqx

Terminal name/version

foot 1.11.0

$TERM environment variable

foot / xterm-256color (tested both)

Installation

Arch Community Repository

How to reproduce the issue

Set up example formatting plugins:

init.lua:

local install_path = vim.fn.stdpath"data" .. "/site/pack/packer/opt/packer.nvim"

if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
  vim.api.nvim_command("!git clone https://github.com/wbthomason/packer.nvim " ..
                         install_path)
  vim.api.nvim_command"packadd packer.nvim"
end

vim.cmd"packadd packer.nvim"

return require "packer".startup(function(use)
  use {"mhartington/formatter.nvim", config = function()
      require"formatter".setup {
        filetype = {
          go = {
            function()
              return {exe = "gofmt", stdin = true}
            end,
          },
        },
      }
    end
  }
  use {"rust-lang/rust.vim"} -- Fixes https://github.com/rust-lang/rust.vim/issues/460 over the built in version
end)

Case A:

src/test.rs:

fn main() {
println!("Hello World!");
}

$ nvim src/test.rs

:RustFmt

Case B:

test.go:

package main

import "fmt"

func main() {
fmt.Println("Hello World!")
}

$ nvim test.go

:Format

Expected behavior

(alacritty 0.10.1)

Case A:

fn main() {
    println!("Hello World!");
}

Case B:

package main

import "fmt"

func main() {
	fmt.Println("Hello World!")
}

Actual behavior

(foot 1.11.0)

Case A:

]4;1;rgb:cc/24/1d��]4;2;rgb:98/97/1a��]4;3;rgb:d7/99/21��]4;4;rgb:45/85/88��]4;5;rgb:b1/62/86��]4;6;rgb:68/9d/6a��]11;rgb:28/28/28��]10;rgb:eb/db/b2��]4;0;rgb:28/28/28��]4;7;rgb:a8/99/84��]4;8;rgb:92/83/74��]4;9;rgb:fb/59/34��]4;10;rgb:b8/bb/26��]4;11;rgb:fa/bd/2f��]4;12;rgb:83/a5/98��]4;13;rgb:d3/86/9b��]4;14;rgb:8e/c0/7c��]4;15;rgb:eb/db/b2��]4;236;rgb:32/30/2f��]4;234;rgb:1d/20/21��]4;235;rgb:28/28/28��]4;237;rgb:3c/38/36��]4;239;rgb:50/49/45��]4;241;rgb:66/5c/54��]4;243;rgb:7c/6f/64��]4;244;rgb:92/83/74��]4;245;rgb:92/83/74��]4;228;rgb:f2/e5/bc��]4;230;rgb:f9/f5/d7��]4;229;rgb:fb/f1/c7��]4;223;rgb:eb/db/b2��]4;250;rgb:d5/c4/a1��]4;248;rgb:bd/ae/93��]4;246;rgb:a8/99/84��]4;167;rgb:fb/49/34��]4;142;rgb:b8/bb/26��]4;214;rgb:fa/bd/2f��]4;109;rgb:83/a5/98��]4;175;rgb:d3/86/9b��]4;108;rgb:8e/c0/7c��]4;208;rgb:fe/80/19��]4;88;rgb:9d/00/06��]4;100;rgb:79/74/0e��]4;136;rgb:b5/76/14��]4;24;rgb:07/66/78��]4;96;rgb:8f/3f/71��]4;66;rgb:42/7b/58��]4;130;rgb:af/3a/03fn main() {
    println!("Hello World!");
}

Case B:

�]4;1;rgb:cc/24/1d��]4;2;rgb:98/97/1a��]4;3;rgb:d7/99/21��]4;4;rgb:45/85/88��]4;5;rgb:b1/62/86��]4;6;rgb:68/9d/6a��]11;rgb:28/28/28��]10;rgb:eb/db/b2��]4;0;rgb:28/28/28��]4;7;rgb:a8/99/84��]4;8;rgb:92/83/74��]4;9;rgb:fb/59/34��]4;10;rgb:b8/bb/26��]4;11;rgb:fa/bd/2f��]4;12;rgb:83/a5/98��]4;13;rgb:d3/86/9b��]4;14;rgb:8e/c0/7c��]4;15;rgb:eb/db/b2��]4;236;rgb:32/30/2f��]4;234;rgb:1d/20/21��]4;235;rgb:28/28/28��]4;237;rgb:3c/38/36��]4;239;rgb:50/49/45��]4;241;rgb:66/5c/54��]4;243;rgb:7c/6f/64��]4;244;rgb:92/83/74��]4;245;rgb:92/83/74��]4;228;rgb:f2/e5/bc��]4;230;rgb:f9/f5/d7��]4;229;rgb:fb/f1/c7��]4;223;rgb:eb/db/b2��]4;250;rgb:d5/c4/a1��]4;248;rgb:bd/ae/93��]4;246;rgb:a8/99/84��]4;167;rgb:fb/49/34��]4;142;rgb:b8/bb/26��]4;214;rgb:fa/bd/2f��]4;109;rgb:83/a5/98��]4;175;rgb:d3/86/9b��]4;108;rgb:8e/c0/7c��]4;208;rgb:fe/80/19��]4;88;rgb:9d/00/06��]4;100;rgb:79/74/0e��]4;136;rgb:b5/76/14��]4;24;rgb:07/66/78��]4;96;rgb:8f/3f/71��]4;66;rgb:42/7b/58��]4;130;rgb:af/3a/03package main

import "fmt"

func main() {
	fmt.Println("Hello World!")
}
@fauu fauu added the bug issues reporting wrong behavior label Apr 19, 2022
@clason
Copy link
Member

clason commented Apr 19, 2022

This is very likely a bug in foot. Try the latest nightly of foot (if available) or build from master.

@fauu
Copy link
Author

fauu commented Apr 19, 2022

It's the same when built from master. I'll try reporting it to foot then.

@clason clason added the environment user system environment (terminal, shell, tmux) label Apr 19, 2022
@dnkl
Copy link

dnkl commented Apr 19, 2022

Looks like foot is sending replies to OSC-4 queries, but neovim isn't recognizing them?

@fauu
Copy link
Author

fauu commented Apr 19, 2022

Turns out the codes were being printed by a fish shell theme (Jomik/fish-gruvbox#7). The issue can be circumvented entirely by disabling the theme in non-interactive sessions:

if status is-interactive
        theme_gruvbox dark medium
end

@justinmk
Copy link
Member

So why is this issue still open?

@dundargoc
Copy link
Member

Yes, this seems unrelated to neovim. Let's close this. If I misunderstood something and this is in fact a neovim bug let us know and we can reopen this.

@seandewar seandewar added closed:invalid Issues that are closed as "invalid" and removed bug issues reporting wrong behavior environment user system environment (terminal, shell, tmux) labels Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed:invalid Issues that are closed as "invalid"
Projects
None yet
Development

No branches or pull requests

6 participants