telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

Bizarre rendering after showing binary file content in Telescope preview

Open miEsMar opened this issue 2 years ago • 0 comments

Description

I noticed this issue accidentally. I had called either find_files or git_files (I guess it'd manifest with whatever Telescope command showing the preview window). For some reasons, this search included some binary file, that being .png or whatever. Something like this: immagine Already, you cold see that some characters are rendered on top of the file preview window borders. But that'ok. The thing is, after changing file, the preview window borders don't update and recover, but any character that was overlapping, remains there. Something like: immagine

But, there's more. In some cases, the binary file preview renders character even outside the borders of its window. Something like: immagine You can see at mid-height, <82>, with the > falling une chasr-box outside the preview window. That's fine, except if this happens whan calling Telescope from a window split whose limits don't contain such left-over characters. Say for example, you call Telescope from the left-window split where you have either netrw or nvim-tree or whatever. After you close Telescope you'd remain with something like: immagine I made it this broad to show that focus is on the left window, while in the other window split where those characters where localised, since they where falling outside the Telescope borders, didn't get "updated" after closing telescope. They will get removed once focus is gained by the window slipt "hosting" them (maybe because a redraw of the visible buffer content is called?).

I have been suggested to open an issue. So here I am.

PS: I'd have two more comments alongside:

  1. preview syntex highlighting works differently whether calling find_files or git_files.
  2. I noticed that syntax highlighting for Fortran files does not work at all. IN the preview, they are shown as plain text.

Neovim version

NVIM v0.9.2
Build type: RelWithDebInfo
LuaJIT 2.1.1694082368

Operating system and version

Win 10 Pro version 10.0.19045 N/D build 19045

Telescope version / branch / rev

telescope 0.1.x

checkhealth telescope

==============================================================================
telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- WARNING nvim-treesitter not found. 

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0 (rev af6b6c543b)
- WARNING fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

===== Installed extensions ===== ~

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Steps to reproduce

  1. Install Telescope
  2. Launch find_files from a directory containing some binary file (png, jpeg etc)
  3. See what heppens in rendering. Either:
  • Preview windows borders are overridden.
  • In the worst case, some characters will be renbdered even outside the preview window borders.

Expected behavior

Even when rendering a binary file, no characters are rendered neither on the preview window borders, nor outside of them.

Actual behavior

When displaying binary file content, characters are rendered either on the preview window borders, or even outside of it, causing some left-overs after quitting Telescope, if it was called from a window slipt which didn't contain those characters in its limits (so a redraw does not update that part of the screen).

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'nvim-telescope/telescope.nvim',
        requires = {
          'nvim-lua/plenary.nvim',
          { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' },
        },
      },
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('telescope').setup()
  require('telescope').load_extension('fzf')
  -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing Telescope and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]

miEsMar avatar Nov 10 '23 09:11 miEsMar