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

nvim_win_set_cursor() doesn't redraw for cursorcolumn #19063

Closed
echasnovski opened this issue Jun 23, 2022 · 4 comments · Fixed by #21072
Closed

nvim_win_set_cursor() doesn't redraw for cursorcolumn #19063

echasnovski opened this issue Jun 23, 2022 · 4 comments · Fixed by #21072
Labels
api libnvim, Nvim RPC API bug issues reporting wrong behavior complexity:low Low-risk, self-contained. Do NOT ask "can I work on this", just read CONTRIBUTING.md

Comments

@echasnovski
Copy link
Member

Neovim version (nvim -v)

NVIM v0.8.0-dev+441-ge651ae586

Vim (not Nvim) behaves the same?

No

Operating system/version

EndeavourOS 5.18.3-arch1-1

Terminal name/version

xfce4-terminal 1.0.4 (Xfce 4.16)

$TERM environment variable

xterm-256color

Installation

appimage

How to reproduce the issue

  1. Create 'init-cursorline.lua' with the following content:
    -- Make cursorline and cursorcolumn more visible
    vim.cmd('hi CursorColumn ctermbg=1')
    vim.cmd('hi CursorLine ctermbg=1')
    
    vim.cmd('belowright wincmd v')
    
    vim.api.nvim_buf_set_lines(0, 0, -1, true, { 'aaa', 'bbb', 'ccc' })
    for _, win_id in ipairs(vim.api.nvim_list_wins()) do
      vim.api.nvim_win_set_option(win_id, 'cursorline', true)
      vim.api.nvim_win_set_option(win_id, 'cursorcolumn', true)
    end
  2. nvim -u init-cursorcolumn.lua
  3. Execute :lua vim.api.nvim_win_set_cursor(1001, {3, 2}). This changes cursor position in the non-current window, redraws cursorline, but not cursorcolumn. Explicit call :redraw places cursorcolumn where it should be.

This seems to be known about (#17414). Decided to make the issue so that this less likely get forgotten.

Expected behavior

Cursorcolumn is updated immediately. Like with windo call cursor(3, 3) but only for specified window.

Actual behavior

neovim-issue_cursorcolumn.mp4
@echasnovski echasnovski added the bug issues reporting wrong behavior label Jun 23, 2022
@zeertzjq zeertzjq added the api libnvim, Nvim RPC API label Jun 23, 2022
@zeertzjq zeertzjq added the complexity:low Low-risk, self-contained. Do NOT ask "can I work on this", just read CONTRIBUTING.md label Oct 9, 2022
@Jlll1
Copy link
Contributor

Jlll1 commented Nov 14, 2022

I'd be happy to tackle this one. Would this be good as a first issue? Any directions to get me going?

@zeertzjq
Copy link
Member

Probably just need to call validate_cursor()

@Jlll1
Copy link
Contributor

Jlll1 commented Nov 14, 2022

Well, that seems to be correct. validate_cursor() needs to be called in similar fashion to how update_topline_win does update_topline when the updated window is not current one.

neovim/src/nvim/move.c

Lines 337 to 343 in 2685d27

void update_topline_win(win_T *win)
{
switchwin_T switchwin;
switch_win(&switchwin, win, NULL, true);
update_topline(curwin);
restore_win(&switchwin, true);
}

I'll make sure to have a PR for this tomorrow, then. Thank you!

@zeertzjq
Copy link
Member

Or maybe just calling check_cursor_moved() and curs_columns() with wp.

Jlll1 added a commit to Jlll1/neovim that referenced this issue Nov 15, 2022
… window

fix neovim#19063
this fixes the cursorcolumn not being redraw for non-current windows in `nvim_win_set_cursor()`
Jlll1 added a commit to Jlll1/neovim that referenced this issue Nov 15, 2022
… window

fix neovim#19063
this fixes the cursorcolumn not being redrawn for non-current windows in `nvim_win_set_cursor()`
Jlll1 added a commit to Jlll1/neovim that referenced this issue Nov 16, 2022
… window

fix neovim#19063
this fixes the cursorcolumn not being redrawn for non-current windows in `nvim_win_set_cursor()`
zeertzjq pushed a commit to Jlll1/neovim that referenced this issue Nov 16, 2022
… window

fix neovim#19063
this fixes the cursorcolumn not being redrawn for non-current windows in `nvim_win_set_cursor()`
zeertzjq pushed a commit that referenced this issue Nov 16, 2022
…dow (#21072)

fix #19063
this fixes the cursorcolumn not being redrawn for non-current windows in `nvim_win_set_cursor()`
yesean pushed a commit to yesean/neovim that referenced this issue Mar 25, 2023
…dow (neovim#21072)

fix neovim#19063
this fixes the cursorcolumn not being redrawn for non-current windows in `nvim_win_set_cursor()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api libnvim, Nvim RPC API bug issues reporting wrong behavior complexity:low Low-risk, self-contained. Do NOT ask "can I work on this", just read CONTRIBUTING.md
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants