Closed davidolrik closed 4 years ago
Sublime Text's encoding names are very different from Python's. sublime_lib
has a bidirectional mapping for those, but I believe the "read file from disk" solution to be very fragile in the first place. I don't see why getting the text from view.substr
isn't an option.
@FichteFoll reading file from disk is used for the "show only trailing spaces in modified lines" feature. Do you see any other way of implementing it? I don't immediately see any API we could use for that.
I was thinking of loading the file into memory using view.substr
when the file is loaded or first activated, but I just realized that this assumption fails when recovering a hot-exited session. I presume reading from the file is still necessary in that case, but using the encoding mapping provided by sublime_lib instead.
TrailingSpaces fails to run on non UTF-8 files.
This small fix extracts the encoding from the view(current file), and uses that encoding for opening the file.