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

Bug: cursor movements aren't updated until after leaving mode #24

Closed
mawkler opened this issue Mar 2, 2024 · 4 comments · Fixed by #27
Closed

Bug: cursor movements aren't updated until after leaving mode #24

mawkler opened this issue Mar 2, 2024 · 4 comments · Fixed by #27
Assignees
Labels
bug Something isn't working

Comments

@mawkler
Copy link

mawkler commented Mar 2, 2024

Hi! First of all, thank you for making this super cool plugin!

I'm trying to create a custom mode using nvim-libmodal in which the cursor moves. However, the cursor movement isn't actually rendered until after leaving the mode.

Here's just a small example setup to illustrate the issue:

local libmodal = require 'libmodal'

vim.o.cursorline = true
vim.o.showmode   = false

local my_mode = {
  g = function() vim.api.nvim_win_set_cursor(0, { 1, 0 }) end,
}

vim.keymap.set('n', 'M', function()
  libmodal.mode.enter('my_mode', my_mode)
end)

To reproduce:

  1. Move to the bottom of a file
  2. Press M to enter my_mode
  3. Press g to trigger custom action
  4. Notice how cursorline moves to the top of the file, but the cursor is still drawn in the same spot as it were before you pressed g

I'm on Neovim nightly v0.10.0-dev-2355+g1c7b0b9d5

@Iron-E Iron-E added the bug Something isn't working label Mar 3, 2024
@Iron-E
Copy link
Owner

Iron-E commented Mar 4, 2024

Thanks for the report! I'll take a look at this.

Two small workarounds I thought of for now:

  1. Use cursorcolumn and cursorline
  2. Use a layer instead of a mode

@mawkler
Copy link
Author

mawkler commented Mar 4, 2024

@Iron-E Ok, thank you!

@Iron-E
Copy link
Owner

Iron-E commented Mar 7, 2024

I opened a PR to close this. Let me know if this will work for your purposes :)

@mawkler
Copy link
Author

mawkler commented Mar 8, 2024

Yes, your PR seems to fix my issue. Thank you very much!

@Iron-E Iron-E closed this as completed in #27 Mar 8, 2024
@Iron-E Iron-E self-assigned this Mar 8, 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants