fzf-lua icon indicating copy to clipboard operation
fzf-lua copied to clipboard

[BUG] Unicode `REPLACEMENT CHARACTER`(efbfbd) in Buffers

Open icefed opened this issue 1 year ago • 13 comments

Info

  • Operating System: MacOS
  • Shell: zsh
  • Terminal: Iterm2
  • nvim --version: v0.8.2
  • fzf --version: 0.37.0 (brew)
  • [ ] The issue is reproducible with mini.sh
fzf-lua configuration
require('fzf-lua').setup({
    winopts = {
      height = 0.85, -- window height
      width = 0.85, -- window width
      preview = {
        horizontal = "right:50%",
        scrollbar = false,
      },
    },
    files = {
      prompt = "Files> ",
      rg_opts = "--color=never --files --follow -g '!.git'",
      fd_opts = "--color=never --type f --follow --exclude .git",
    },
    grep = {
      prompt = "Rg> ",
      input_prompt = "Grep For> ",
    },

})

Description

Sometimes it comes, sometimes it doesn't.

icefed avatar Mar 02 '23 06:03 icefed

I noticed that too with buffers, there’s a good chance this is an upstream bug.

ibhagwan avatar Mar 02 '23 07:03 ibhagwan

@icefed, I haven’t encountered this issue in months, I have a feeling this was upstream (this character isn’t anywhere in fzf-lua’s code), although I can’t pin point the exact issue it does seem fixed on my end.

If you find a semi consistent way of reproducing this issue please reopen and I’ll take another look.

ibhagwan avatar May 25 '23 18:05 ibhagwan

I also encountered this one many times. I think it has something to do with the transparent/blend of the floating window:

  1. When the line under the current floating window that contains efbfbd matches a certain pattern, this just happened.
  2. It's probably not related to the input method being used, since we all in this thread have this problem.
  3. It's probably not related to the terminal emulator we used since I'm using Alacritty and I encountered this problem too.

But IIRC, some older version of fzf-lua doesn't have this problem.

nyngwang avatar May 26 '23 04:05 nyngwang

When the line under the current floating window that contains efbfbd matches a certain pattern, this just happened.

If that’s the case that would be an upstream bug, fzf-lua doesn’t use this character at all in the code, where would it appear from?

Can you reproduce this consistently and let me know the steps?

ibhagwan avatar May 26 '23 09:05 ibhagwan

Hi @ibhagwan

I might have a consistent repro. I guess the issue is related to how brackets are parsed, but didn't get a chance to dig deep.

To repro, copy the below config to somewhere like ~/.config/bug-report/init.lua, then NVIM_APPNAME="bug-report" nvim, then press fk and you will see the issue.

Env: NVIM v0.10.0-dev-1884+ga05bbc60e-Homebrew, latest fzf-lua, macos, alacritty.

local map = vim.keymap.set

-- Install Lazy when first opening nvim. Use ':Lazy' to install/update plugins.
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "--single-branch",
    "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

local plugins = {
  { "nvim-tree/nvim-web-devicons", config = true, }, -- File type icons
  {
    "ibhagwan/fzf-lua",                              -- Fuzzy search everything
    config = function()
      require('fzf-lua').setup({})
      require("fzf-lua").register_ui_select() -- Use fzf for vim.ui.select, such as code actions, etc
      local f = "f"
      local F = "F"

      map("n", f .. "<space>", require('fzf-lua').builtin, { desc = "[f] All fzf commands" })
      map("n", f .. "a", require("fzf-lua").tabs, { desc = "[f] Tabs" })
      map("n", f .. "b", require("fzf-lua").buffers, { desc = "[f] Buffesr" })
      map("n", f .. "c", require("fzf-lua").git_bcommits, { desc = "[f] Commits for current file" })
      map("n", F .. "C", require("fzf-lua").git_commits, { desc = "[f] Commits for repo" })
      map("n", f .. "d", require("fzf-lua").diagnostics_document, { desc = "[f] Diagnostics in buffer" })
      map("n", F .. "D", require("fzf-lua").diagnostics_workspace, { desc = "[f] Diagnostics in workplace" })
      map("n", f .. "e", require('fzf-lua').changes, { desc = "[f] Edits (change list)" })
      map("n", f .. "f", require('fzf-lua').files, { desc = "[f] Files in cwd" })
      map("n", F .. "F", require('fzf-lua').git_files, { desc = "[f] Files in repo" })
      map("n", f .. "g", require('fzf-lua').live_grep_glob, { desc = "[f] Grep" })
      map("n", F .. "G", require('fzf-lua').grep_project, { desc = "[f] Fuzzy search project" })
      map("n", f .. "h", require("fzf-lua").git_status, { desc = "[f] Hunks (git status)" })
      map("n", f .. "j", require('fzf-lua').jumps, { desc = "[f] Jumps" })
      map("n", f .. "k", function() require('fzf-lua').keymaps({ query = "[]" }) end, { desc = "[f] Keybindings" })
      map("n", f .. "l", require('fzf-lua').loclist, { desc = "[f] Loclist" })
      map("n", F .. "L", require('fzf-lua').loclist_stack, { desc = "[f] Loclist history" })
      map("n", f .. "o", function() require("fzf-lua").lsp_document_symbols({ symbol_fmt = false, symbol_style = 2 }) end,
        { desc = "[f] Symbols in buffer" })
      map("n", F .. "O", require("fzf-lua").lsp_workspace_symbols, { desc = "[f] Symbols in repo" })
      map("n", f .. "q", require('fzf-lua').quickfix, { desc = "[f] Quickfix" })
      map("n", F .. "Q", require('fzf-lua').quickfix_stack, { desc = "[f] Quickfix history" })
      map("n", f .. "r", function() require("fzf-lua").oldfiles({ cwd_only = true }) end,
        { desc = "[f] Recent files in cwd" })
      map("n", F .. "R", require("fzf-lua").oldfiles, { desc = "[f] Recent files" })
      map("n", f .. "t", require("fzf-lua").btags, { desc = "[f] Tags in buffer" })
      map("n", F .. "T", require("fzf-lua").tags, { desc = "[f] Tags in repo" })
      map("n", f .. "w", require('fzf-lua').grep_cword, { desc = "[f] Grep cursor word" })
      map("n", F .. "W", require('fzf-lua').grep_cWORD, { desc = "[f] Grep cursor WORD" })

      map("n", f .. ".", require("fzf-lua").resume, { desc = "[f] Continue last fzf session" })
      map("n", f .. ";", require('fzf-lua').commands, { desc = "[f] Commands" })
      map("n", F .. ":", require('fzf-lua').command_history, { desc = "[f] Command history" })
      map("n", f .. "'", require('fzf-lua').marks, { desc = "[f] Marks" })
      map("n", F .. "\"", require('fzf-lua').registers, { desc = "[f] Registers" })
      map("n", f .. "/", require('fzf-lua').search_history, { desc = "[f] Search history" })
      map("n", f .. "1", require('fzf-lua').help_tags, { desc = "[f] Help tags" })

      map("n", "z=", require("fzf-lua").spell_suggest, { desc = "[f] Spell suggestion" }) -- Override the default ":h z="
    end
  },
}

require("lazy").setup(plugins)

liangxianzhe avatar Jun 20 '23 22:06 liangxianzhe

@liangxianzhe, just tried with latest nightly and the provided init.lua and no success in repro: image

ibhagwan avatar Jun 21 '23 02:06 ibhagwan

@liangxianzhe, what version of fzf are you using btw?

ibhagwan avatar Jun 21 '23 02:06 ibhagwan

0.42.0, which is latest. I noticed that it repros consistently on alacritty, but not on wezterm (though my full config, which has more key bindings, repros on wezterm too). If it doesn't repro for you, I will try debug on my side when I got some time.

liangxianzhe avatar Jun 21 '23 05:06 liangxianzhe

New finding, it only repros for certain terminal window's size. Try zoom in and out a few times.

liangxianzhe avatar Jun 21 '23 05:06 liangxianzhe

image

liangxianzhe avatar Jun 21 '23 05:06 liangxianzhe

@liangxianzhe Hi, really thank you for creating the repo of the issue!

nyngwang avatar Jun 21 '23 11:06 nyngwang

New finding, it only repros for certain terminal window's size. Try zoom in and out a few times.

Ty @liangxianzhe, reopened the issue but unfortunately I still cannot reproduce this using both alacritty and fzf 0.42.

Also, given that fzf-lua doesn't draw anything when zooming in/out I stand by my initial analysis that this is an upstream issue.

My suggestions is we try to reproduce it in the shell and once we have decent repro steps open an issue upstream.

ibhagwan avatar Jun 21 '23 20:06 ibhagwan

Following the discussion in #791, @liangxianzhe identified this issue as https://github.com/neovim/neovim/issues/16245, it seems there is not much we can do from fzf-lua’s side without the upstream being fixed.

ibhagwan avatar Jun 22 '23 14:06 ibhagwan

FYI, the issue was resolved upstream in https://github.com/neovim/neovim/pull/27922.

Can anyone who had this easily reproduced try this out once the next nightly is released?

ibhagwan avatar Mar 19 '24 15:03 ibhagwan

I've been using it for a few minutes, it looks like the problem is gone.

Open same session(nightly left): image

icefed avatar Mar 20 '24 08:03 icefed

Ty for the update @icefed, I also feel confident this issue can be closed, ty everyone for your efforts troubleshooting this!

ibhagwan avatar Mar 20 '24 14:03 ibhagwan