While investigating #39, I realized that when switching tabs/opening a new file/whatever changes the view, the old file descriptor (coming from the cached on_disk value) used for comparing versions is messed up: it describes the first opened file, not the currently active view. This results in all trailing spaces being deleted, defeating the very purpose of the MLO setting.
The on_disk cache should be overwritten when hitting the on_activated hook, so that the proper, active file is considered. This may be an issue when switching back and forth between files though (we don't want to erase a valid old/on_disk descriptor. Maintaining an array of descriptors under the on_load hook may then be smarter. Plus, populating the cache if no matching descriptor for the current, active view is found at diff time.
While investigating #39, I realized that when switching tabs/opening a new file/whatever changes the view, the old file descriptor (coming from the cached
on_disk
value) used for comparing versions is messed up: it describes the first opened file, not the currently active view. This results in all trailing spaces being deleted, defeating the very purpose of the MLO setting.The
on_disk
cache should be overwritten when hitting theon_activated
hook, so that the proper, active file is considered. This may be an issue when switching back and forth between files though (we don't want to erase a validold
/on_disk
descriptor. Maintaining an array of descriptors under theon_load
hook may then be smarter. Plus, populating the cache if no matching descriptor for the current, active view is found at diff time.