weirongxu / coc-explorer

📁 Explorer for coc.nvim
MIT License
1.14k stars 45 forks source link

Closing the explorer says: No write since last change #522

Open cpfaff opened 2 years ago

cpfaff commented 2 years ago

Sometimes it happens to me that when I close the buffer of the explorer then it gives me the wraning "No write since last change". That might be caused as the explorer relies on the buffer being "modifyable" and sometimeds the changes may not yet written when I want to exit my editor.

weirongxu commented 2 years ago

This issue does not seem to be stably reproduced, I suspect that some exceptions occur in nvim_buf_set_lines. I try to fix it by this patch https://github.com/weirongxu/coc-explorer/commit/3992e5dcafc90c982f6123207c3770fbc8b5b705

cpfaff commented 2 years ago

Just updated and tried again. I still see that message every now an then. However I guess it happens just in a really specific edge case. I had no time yet to figure out reliable steps to reproduce it. I am on it.

cpfaff commented 2 years ago

Sometimes it happens when i do this:

  1. Open vim in a project folder
  2. Open the explorer
  3. Open a file from the explorer
  4. Edit the file and save it
  5. :bd! close the file buffer
  6. Switch back to the explorer buffer
  7. :bd! close the explorer buffer
  8. Exit vim :q!

Then I get the warning. And when I then hit q then I end up in the explorer again

weirongxu commented 2 years ago

I guess other plugins have modified the coc-explorer buffer, then caused this issue. I have frequently encountered this recently, I will follow up on this.