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

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

Closed
lalitmee opened this issue Mar 23, 2022 · 2 comments
Closed

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

lalitmee opened this issue Mar 23, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@lalitmee
Copy link

lalitmee commented Mar 23, 2022

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

  • OS: linux
  • Neovim version:
NVIM v0.7.0-dev+1287-g315858bf6
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by lalitmee@pop-os

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:
-- 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.

@lalitmee lalitmee added the bug Something isn't working label Mar 23, 2022
@stevearc
Copy link
Owner

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
Copy link
Author

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

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

No branches or pull requests

2 participants