[mini.diff] API to refresh mini.diff for a buffer #2502
Contributing guidelines
Module(s)mini.diff Questionfirst off, thank you a lot for your plugins! i really appreciate their small size and extensibility! now, i'm leveraging mini.diff's extensibility for my own needs: i find it useful to see in the telescope buffer picker whether i have changes in individual buffers. I can leverage mini.diff's cache for that, since obviously the buffers are loaded. there is a downside: when i commit, the changes should clear, now everything is clean. but the changes remain displayed in the telescope buffers picker until i manually reopen each buffer. i think i could fix this if i had access to mini.diff's i can easily fork mini.diff for my own needs (i routinely do that for other plugins), i think just exporting the function would be enough. But i'm wondering whether you see another way i could handle this or whether you'd be prepared to accept a PR to export that function? thank you again for your work! |
Replies: 3 comments 7 replies
|
Another similar use case: I'm using mini.diff stats to display in lualine diff stats for each window, with the same concern: on commit, only the current window has its stats updated, I must focus each window in turn to update its display. But at least there are less windows than open buffers. |
I am not quite sure where the problem is exactly. With default Git source executing This is the case thanks to the created file watchers which watch any change in Git index and react with My suspicion is that the observed behavior might be not due to 'mini.diff' not updating its data but from its consumers not updating (or redrawing) to show the relevant data. There is a I am afraid I can not help any further without explicit reproduction steps. To answer the specific question in the title about refreshing: I think either Also, if all you need is diff summary, using
Thanks for using them! |
|
interesting, i had only briefly checked but i missed the file watchers. the set_ref_text is also a good suggestion that seems likely to work. i'll check this out further and update here with my findings, thank you for your answer so far 👍 |
Yes, this is exactly what happens. The
git stashchanges the file on disk but the Neovim buffer used to show the file is not yet updated. As 'mini.diff' is designed around "compare buffer text with its reference text" and the Neovim's buffer watcher doesn't notify it about the changes (since there are none), the summary is the same (because the buffer is the same).Using
git add *instead ofgit stashhere works because of how 'mini.diff' watches Git index. It can detect the change via file watcher and adjust reference text o…