mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 17:28:23 +00:00

Problem: TextChangedT fires depending on whether Nvim needs to update_screen while in terminal mode. This makes little sense as redraws can be completely unrelated to the terminal. Also, TextChanged could be fired from changes in terminal mode after returning to normal mode. Solution: trigger it when b:changedtick changes, like other such events. Happens when invalid cells are refreshed, though is no longer affected by cursor changes. Don't fire TextChanged from changes in terminal mode after leaving. Unlike the other TextChanged* events, I've elected to not have it be influenced by typeahead. Plus, unlike when leaving insert mode when no TextChangedI events are defined, I don't trigger TextChanged when returning to normal mode from changes in terminal mode (is that a Vim bug?) Curiously, Vim's TextChangedT is different; it's tied to its terminal cursor redraws, which triggers pretty eagerly (but is unaffected by unrelated redraws) - usually *twice* when data is sent to the terminal (regardless of whether it causes any visible changes, like incomplete escape codes; wasn't true for Nvim). Not clear to me how this event was actually intended to work, but this seems to make the most sense to me.