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

BUG: Non-ascci file names being cut randomly if don't fit #1619

Open
3 tasks done
Emptyfruit opened this issue Dec 23, 2024 · 0 comments · May be fixed by #1623
Open
3 tasks done

BUG: Non-ascci file names being cut randomly if don't fit #1619

Emptyfruit opened this issue Dec 23, 2024 · 0 comments · May be fixed by #1623
Assignees
Labels
bug Something isn't working

Comments

@Emptyfruit
Copy link

Emptyfruit commented Dec 23, 2024

Did you check docs and existing issues?

  • I have read all the docs.
  • I have searched the existing issues.
  • I have searched the existing discussions.

Neovim Version (nvim -v)

NVIM v0.10.3

Operating System / Version

MacOS 14.6.1

Describe the Bug

If the file name is not in ASCII (Cyrillic, in my case) and it does not fit in the tree buffer, it gets cut very roughly and often with artifacts. See screenshots with different width (i keep a nvim-tree version on the left for comparison).

  1. File name format (spaces, etc) does not seem to affect the issue.
  2. The only component config i use is enable_character_fade, the issue is present with both true and false.

Screenshots, Traceback

image image image

Steps to Reproduce

  1. Use neo-tree
  2. Make a long file name using non-ascii characters
  3. Make neotree buffer (sidebar) smaller than the file name length

Expected Behavior

Names should be cut right by the edge of the buffer, without artifacts or waste of space.

Your Configuration

return {
  "nvim-neo-tree/neo-tree.nvim",
  branch = "v3.x",
  dependencies = {
    "nvim-lua/plenary.nvim",
    "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
    "MunifTanjim/nui.nvim",
    "3rd/image.nvim",              -- Optional image support in preview window: See `# Preview Mode` for more information
  },
  config = function()
    local events = require("neo-tree.events")
    local function on_move(data)
      Snacks.rename.on_rename_file(data.source, data.destination)
    end
    require "neo-tree".setup({
      event_handlers = {
        { event = events.FILE_MOVED,   handler = on_move },
        { event = events.FILE_RENAMED, handler = on_move },
      },
      git_status_async = false,
      close_if_last_window = true,
      filesystem = {
        follow_current_file = {
          enabled = true
        },
        filtered_items = {
          visible = false, -- when true, they will just be displayed differently than normal items
          hide_dotfiles = false,
          hide_gitignored = false,
          -- hide_hidden = true, -- only works on Windows for hidden files/directories
          hide_by_name = {
            "node_modules",
            ".git",
            ".idea",
          },
          hide_by_pattern = { -- uses glob style patterns
            --"*.meta",
            --"*/src/*/tsconfig.json",
          },
          always_show = { -- remains visible even if other settings would normally hide it
            --".gitignored",
          },
          never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
            ".DS_Store",
            -- "thumbs.db"
          },
          never_show_by_pattern = { -- uses glob style patterns
            --".null-ls_*",
          },
        },
        use_libuv_file_watcher = true,
      },
      default_component_configs = {
        container = {
          enable_character_fade = false,
        },
      },
      window = {
        auto_expand_wdith = false,
        mappings = {
          ["<bs>"] = "",
          ["<C-u>"] = "navigate_up",
          ["h"] = function(state)
            local node = state.tree:get_node()
            if node.type == 'directory' and node:is_expanded() then
              require 'neo-tree.sources.filesystem'.toggle_directory(state, node)
            else
              require 'neo-tree.ui.renderer'.focus_node(state, node:get_parent_id())
            end
          end,
          ["l"] = function(state)
            local node = state.tree:get_node()
            if node.type == 'directory' then
              if not node:is_expanded() then
                require 'neo-tree.sources.filesystem'.toggle_directory(state, node)
              elseif node:has_children() then
                require 'neo-tree.ui.renderer'.focus_node(state, node:get_child_ids()[1])
              end
            else
              state.commands['open'](state)
              vim.cmd('Neotree reveal')
            end
          end,

          ['<tab>'] = function(state)
            local node = state.tree:get_node()
            if require("neo-tree.utils").is_expandable(node) then
              state.commands["toggle_node"](state)
            else
              state.commands['open'](state)
              vim.cmd('Neotree reveal')
            end
          end,
        }
      }
    })
  end
}
@Emptyfruit Emptyfruit added the bug Something isn't working label Dec 23, 2024
@Emptyfruit Emptyfruit changed the title BUG: Non-ascci file names being cut randomly if not fit BUG: Non-ascci file names being cut randomly if don't fit Dec 23, 2024
@pynappo pynappo self-assigned this Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants