Closed kmoschcau closed 10 months ago
Seems like an upstream issue. We have no file format, or encoding detection yet, but I see that the BOM character is still rendered even when these options are set correctly for the diff buffer. We only use the file bytes exactly as they are given to us from Git (we do strip carriage return chars though).
As far as I understand there's nothing I should do about this here in a plugin. You should discuss this upstream. Closing.
@sindrets Who do you mean by upstream in this case? Git or Neovim?
Description
I already filed a similar issue with the gitsigns plugin over here: https://github.com/lewis6991/gitsigns.nvim/issues/875
Basically diffview.nvim has a similar thing going on and almost the same repro steps. You only need to replace step 9 with changing the file in any way without committing, doing a
:DiffviewOpen
and observing the change in the first line. Though here we can see that the buffer for the previous file version shows an<feff>
Unicode code-point, which is likely causing the change in the first line. Otherwise vim's diff algo would not mark this as changed.We can run
:%!xxd
in both buffers and see that they both start with the UTF-8 bytes for a BOM (EF BB BF
), only that the old state buffer even has two of them, Causing the code-point to show up.Expected behavior
The old buffer should not have two BOMs.
Actual behavior
The old buffer has two BOMs.
Steps to reproduce
Please see https://github.com/lewis6991/gitsigns.nvim/issues/875 and the description above.
Health check
Output of
``` ============================================================================== diffview: require("diffview.health").check() Checking plugin dependencies ~ - OK nvim-web-devicons installed. Checking VCS tools ~ - The plugin requires at least one of the supported VCS tools to be valid. - OK Git found. - OK Git is up-to-date. (2.42.0.windows.2) - WARNING Configured `hg_cmd` is not executable: 'hg' ```:checkhealth diffview
Log info
Relevant info from
``` [INFO 2023-09-09 13:20:55.466 +0200] .../Local/nvim-data/lazy/diffview.nvim/lua/diffview/lib.lua:24: [command call] :DiffviewOpen [INFO 2023-09-09 13:20:56.180 +0200] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:483: [DiffView] Completed update for 1 files successfully (331.835 ms) ```:DiffviewLog
Neovim version
Operating system and version
MS Win 22H2 (OS Build 22621.2134)
Minimal config