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

Inconsistent with terminal of vim.fn.screen* function #2569

Open
xzbdmw opened this issue May 19, 2024 · 6 comments
Open

Inconsistent with terminal of vim.fn.screen* function #2569

xzbdmw opened this issue May 19, 2024 · 6 comments
Labels
bug Something isn't working neovim-upstream Requires/is blocked on a change in Neovim itself

Comments

@xzbdmw
Copy link
Contributor

xzbdmw commented May 19, 2024

Describe the bug
vim.fn.screen* function only return statusline result

To Reproduce
Steps to reproduce the behavior:
repro.lua

vim.keymap.set("n", "gt", function()
    local col = vim.fn.screencol()
    local row = vim.fn.screenrow()
    local char = vim.fn.screenstring(row, col)
    -- __AUTO_GENERATED_PRINT_VAR_START__
    print([==[function#if#function char:]==], vim.inspect(char)) -- __AUTO_GENERATED_PRINT_VAR_END__
end)

move cursor to a char and type gt, the result is random string from statusline
Expected behavior
the result should be the same as cursor char
Desktop (please complete the following information):
macos 14.1
neovim 0.10 stable
neovide 13.0

Please run neovide --log and paste the contents of the .log file created in the current directory here:
neovide_rCURRENT.log.zip

Additional context
Add any other context about the problem here.

@xzbdmw xzbdmw added the bug Something isn't working label May 19, 2024
@fredizzimo
Copy link
Member

I think this might be related to this bug we reported to Neovim a while ago:

Does it work properly if you jump using the keyboard?

@xzbdmw
Copy link
Contributor Author

xzbdmw commented May 19, 2024

Yes, mouse and keyboard is the same, and row and col is correct, only char is wrong

@fredizzimo
Copy link
Member

I assume that you have tested this in the Neovim terminal app? It sounds strange that this is brokens, since Neovide does not manipulate any screen and cursor positions itself.

@xzbdmw
Copy link
Contributor Author

xzbdmw commented May 19, 2024

Yes, kitty print correct cursor char

@yasen-pavlov
Copy link
Contributor

yasen-pavlov commented May 26, 2024

Just wanted to chime in that I think I ran into this or a similar bug while I was trying to debug an issue I was having with the statuscol plugin. It uses vim.fn.screenstring to determine the sign in the folding column (link to relevant code) when you click on it and it's working in the terminal, but I was getting some weird behaviour in neovide.

What I managed to figure out so far is that for some reason vim.fn.screenstring always returns an empty string for me in neovide. I was able to reproduce this on a clean nvim config by running the following lua code :

for row = 1, 3, 1 do
	for column = 1, 10, 1 do
		local char = vim.fn.screenstring(row, column)
		print("row: " .. row .. " column: " .. column .. " char: " .. char)
	end
end

on this test file:

ABCDEFGHIJ
KLMNOPQRST
UVWXYZABCD

This is what I get in nvim running inside a terminal:

terminal

And this is what I got when I ran it inside neovide:

neovide

Starting neovide with --no-multigrid fixes this for me which leads me to believe that this behaviour is related to multigrid.

I have the same setup as @xzbdmw btw, MacOS Sonoma 14.5, nvim 0.10 stable and neovide 0.13.1, terminal is alacritty. I've had this issue since I started using the statuscol plugin (around neovide version 0.10 or 0.11) but I only very recently noticed that I can't reproduce it in the terminal.

@fredizzimo
Copy link
Member

I reported a Neovim issue here:
neovim/neovim#29135

@fredizzimo fredizzimo added the neovim-upstream Requires/is blocked on a change in Neovim itself label Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working neovim-upstream Requires/is blocked on a change in Neovim itself
Projects
None yet
Development

No branches or pull requests

3 participants