nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.99k stars 836 forks source link

When `layout_strategy = 'vertical'` and `border = false` are set, there are two transparent lines between three floating windows. #2329

Closed reglin2000 closed 10 months ago

reglin2000 commented 1 year ago

Description

Hello. As the title, when I set layout_strategy = 'vertical' and border = false simultaneously, there are two transparent lines. The first transparent line is between preview window and result window while the second one is between result window and prompt window.

Neovim version

NVIM v0.8.0-1210-gd367ed9b2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by runner@fv-az505-656

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

Operating system and version

Debian 11 on WSL

Telescope version / branch / rev

0.1.1

checkhealth telescope

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - OK: rg: found ripgrep 12.1.1
  - OK: fd: found fd 8.2.1

## ===== Installed extensions =====

## Telescope Extension: `file_browser`
  - INFO: No healthcheck provided

Steps to reproduce

  1. nvim -nu minimal.lua
  2. run :Telescope find_file

Expected behavior

There is not any transparent line between each window. Maybe like this: (Note: prompt_position = 'top' is set in this picture)

圖片

Actual behavior

圖片

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{
      border = false,
      layout_strategy = 'vertical',
    }

  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()]]
l-kershaw commented 1 year ago

I think you can achieve this behaviour (or something close to it), by leaving the border as true and setting borderchars to be a table with 8 values of " ".

reglin2000 commented 1 year ago

Thanks, I had known this configuration before creating this issue. However, I still prefer border = false when I write some code on my notebook to get more candidate item or more lines in preview window.

rieje commented 1 year ago

Can confirm, if border is set to false the ideal solution is to expand either the preview or the results window. I too prefer border = false because the borders take up unnecessary screen real estate and removing them should free up a couple of lines for preview/results window.

l-kershaw commented 1 year ago

If there is a particular behaviour that you want, then you can define a custom layout strategy with that behaviour. I would suggest looking at how vertical is defined (as it seems to be closest to what you want) and how center is defined (as it puts the prompt window directly next to the results when border is disabled)

unphased commented 11 months ago

I am leaning towards just putting up with this behavior, because I think I value having the extra real estate for content more than the ugliness of seeing spurious characters appear in the gaps.

That said, agreed that the solution is probably to eliminate these gaps and then to possibly give different background colors to different telescope UI elements.

Meanwhile turning off borders and linking the TelescopeNormal hl to NormalFloat gets me to something usable for now.

jamestrew commented 11 months ago

this PR https://github.com/nvim-telescope/telescope.nvim/pull/2572 (on master branch) adds support for fully customizable themes including a "compact"/"fused" theme without gaps between the telescope windows.

Here's some code to get started. https://github.com/nvim-telescope/telescope.nvim/wiki/Configuration-Recipes#fused-layout