stevearc / dressing.nvim

Neovim plugin to improve the default vim.ui interfaces
MIT License
1.73k stars 32 forks source link

`vim.ui.input` is showing listchars after the available width #28

Closed lalitmee closed 2 years ago

lalitmee commented 2 years ago

Describe the bug vim.ui.input shows listchars eol when the width of the text goes beyond the available width of the input.

image

System information

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

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

Run :checkhealth for more info

- Is this related to a specific `vim.ui.select` backend? If so, which one? No.
- Dressing config: 

```lua
-- Paste your call to require("dressing").setup(...) in here
dressing.setup({
  input = { insert_only = false, winblend = 2 },
  select = {
    winblend = 2,
    telescope = require("telescope.themes").get_cursor({
      layout_config = {
        -- NOTE: the limit is half the max lines because this is the cursor theme so
        -- unless the cursor is at the top or bottom it realistically most often will
        -- only have half the screen available
        height = function(self, _, max_lines)
          local results = #self.finder.results
          local PADDING = 4 -- this represents the size of the telescope window
          local LIMIT = math.floor(max_lines / 2)
          return (results <= (LIMIT - PADDING) and results + PADDING or LIMIT)
        end,
      },
    }),
  },
})

To Reproduce Steps to reproduce the behavior:

  1. find something which is big in width more than the vim.ui.input width
  2. open to rename or open nvim-tree.lua to rename or create a file

If possible, provide a minimal file that will trigger the issue (see tests/manual for examples of short ways to call vim.ui.*):

-- minimal code not required

Screenshots dressing

Additional context I tried to setup setlocal noeol in the DressingInput on the basis of Filetype in an autocmd but it didn't work.

stevearc commented 2 years ago

My first note is that I don't think this is the eol listchar. It looks like the line-wrap characters from showbreak, and that's confirmed by your dotfiles https://github.com/lalitmee/dotfiles/blob/f6f24c61cb146d45557ff65b9785bca80cab2275/nvim/.config/nvim/plugin/options.lua#L222

Since this buffer is a single line, it shouldn't be wrapping at all. I pushed up a change that sets nowrap in the input window by default. See if that makes a difference for you.

Unfortunately I'm not able to reproduce the issue as stated, so if that commit doesn't fix it you'll need to either debug more yourself or come up with a minimal repro. Try a clean config with just dressing.nvim installed, and run the snippet below. Then add back your config until you find what options/plugins cause the bad interaction.

vim.ui.input({
  prompt = "Big: ",
  default = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque eget ipsum vel dui rhoncus ullamcorper at mattis turpis. Pellentesque finibus lacinia purus vel pellentesque. Vivamus sed metus varius purus gravida placerat in nec ex. Maecenas sagittis, lorem sit amet dictum sodales, leo mi rutrum erat, vel pretium tortor mi et metus. Vivamus eu orci consectetur, elementum neque quis, dapibus odio. Curabitur laoreet gravida ante, vel porttitor ante efficitur vitae. Fusce mattis diam in nisl efficitur, et auctor risus iaculis. Pellentesque sagittis mollis egestas.",
  width = 0.2,
}, function() end)

Also worth noting that setlocal noeol won't work because that option is totally unrelated (see :help eol). You would want setlocal listchars+=eol:\ or setlocal showbreak=NONE.

lalitmee commented 2 years ago

@stevearc, thanks for telling me the problem. Actually the problem was the line which you mentioned in my config.