Closed dnicolson closed 2 years ago
I believe this is not entirely the right place for the fix. The old
argument is passed the value of the on_disk
global. Why is it None
in your case? I can see that this can be the case if the initial file opened on ST start is a scratch file and we try to delete trailing spaces in it. I would rather change the place that calls modified_lines_as_numbers
to pass on_disk or []
.
Also I can see that we don't always properly reset on_disk
on switching from files saved on disk to scratch files so that can result in broken behavior when trying to delete trailing spaces in scratch files.
This pull request checks if the
old
value isNone
and sets it to[]
, which prevents the following error: "TypeError: object of type 'NoneType' has no len()"The issue can be reproduced by entering the following text and saving: "a "