sethen / line-number-change-mode.nvim

A Neovim plugin that allows you to change the color and text decoration of a line number when the mode changes
MIT License
25 stars 2 forks source link

Insert mode color displayed when opening a file from telescope #7

Open cameronr opened 17 hours ago

cameronr commented 17 hours ago

Steps to reproduce:

  1. Start with a buffer open
  2. Open another buffer via :Telescope find_files (either the cmd or a keymap)

Expected: the new buffer is opened and the normal mode CursorLineNr highlight is displayed Actual: the new buffer is opened but the insert mode CursorlineNr highght is displayed.

Oct-24-2024 11-14-56

This happens because nvim sends a ModeChanged event to insert mode for typing into the Telescope window, as expected. However, there doesn't seem to be a ModeChanged event back to normal mode when the Telescope window closes and the new buffer is opened.

I have a workaround and will submit a PR shortly.

sethen commented 16 hours ago

Does this behavior only happen with telescope? Is it reproducible with other kinds of windows like this??

cameronr commented 16 hours ago

I've only noticed it when opening things (buffers, help windows with Telescope though I suspect it would happen for any plugin that opens another window while in insert mode. It's possible it's an underlying Telescope or nvim bug but still figured it was worth working around.