sindrets / diffview.nvim

Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Other
3.6k stars 101 forks source link

[Bug] Umlauts like ä in file names lead to empty diffs #419

Closed kekscode closed 10 months ago

kekscode commented 10 months ago

Description

Umlauts (and most likely other non-ascii chars) seem to break diffview's core functionality.

Expected behavior

Display umlauts and other non ascii chars properly without breaking functionality.

Actual behavior

My get repo for notetaking contains "german file names" using the characters ä, ö, ü and ß resulting in this screenshot and not displaying the diff:

image

FWIW: Neovim shows them, but displays escape sequences (i can live with that):

image

The Oil file manager plugin for neovim shows them like i would expect them:

image

Steps to reproduce

A file called for example 202307051457 Gesunde Ernährung.md should suffice for testing. (If it is not immediately reproduceable, let me know. I will provide a detailed config and investigate possible side effects).

Health check

Output of :checkhealth diffview ``` ============================================================================== 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.39.2) - WARNING Configured `hg_cmd` is not executable: 'hg' ```

Log info

Relevant info from :DiffviewLog [INFO 2023-09-17 13:12:09.208 +0200] ...local/share/nvim/lazy/diffview.nvim/lua/diffview/lib.lua:24: [command call] :DiffviewOpen b495f51^! [INFO 2023-09-17 13:12:09.495 +0200] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:483: [DiffView] Completed update for 1 files successfully (43.862 ms) [ERROR 2023-09-17 13:22:43.990 +0200] ...lazy/diffview.nvim/lua/diffview/vcs/adapters/hg/init.lua:53: [HgAdapter] Configured `hg_cmd` is not executable: 'hg'

Neovim version

NVIM v0.9.2
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

Darwin 22.6.0 arm64 Darwin

Minimal config

-- #######################################
-- ### USAGE: nvim --clean -u mini.lua ###
-- #######################################

local root = vim.fn.stdpath("run") .. "/nvim/diffview.nvim"
vim.fn.mkdir(root, "p")

-- set stdpaths to use root
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
   {
    "sindrets/diffview.nvim",
    dependencies = { "nvim-lua/plenary.nvim" },
    config = function()
      local actions = require 'diffview.actions'
      require('diffview').setup {
        keymaps = {
          view = {
            -- instead of closing one buffer, do `DiffviewClose`
            ['q'] = actions.close,
          },
          file_history_panel = {
            ['q'] = "<Cmd>tabc<CR>",
          },
          file_panel = {
            -- just select them when moving
            ['j'] = actions.select_next_entry,
            ['k'] = actions.select_prev_entry,
            ['<down>'] = actions.select_next_entry,
            ['<up>'] = actions.select_prev_entry,
            -- all of them to just go to the diff2 (right panel) so you can edit right at the Diffview tab
            ['<Tab>'] = actions.focus_entry,
            ['gf'] = actions.focus_entry,
            ['<cr>'] = actions.focus_entry,
            -- these are extra that also makes sense to me
            ['h'] = actions.toggle_flatten_dirs,
            ['l'] = actions.focus_entry,
            ['q'] = "<Cmd>tabn # | tabc #<CR>",
          },
        },
      }
    end
  },

  -- ##################################################################
  -- ### ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
  -- ##################################################################
}
require("lazy").setup(plugins, { root = root .. "/plugins" })
require("lazy").sync({ show = false, wait = true })

vim.opt.termguicolors = true
vim.cmd("colorscheme " .. (vim.fn.has("nvim-0.8") == 1 and "habamax" or "slate"))

-- ############################################################################
-- ### ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
-- ############################################################################
sindrets commented 10 months ago

Fixed in the latest commit.