You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While writing tests for the editor stack save functions for issue #5703, I noticed a separate issue in the way that the return value from has_filename was being used. has_filename returns a list index for the location of the file in self.data, which can include 0 as a valid value. If the file is not found, then the function returns None.
In some of the code that calls has_filename (including code from the save functions), the code was written as if not has_filename(fname). I believe the intention was to skip the code when the file wasn't found, but an unintentional side effect is that it was skipping the code when the index was 0.
During save_as and save_copy_as, this skipped code was used to close a file if the new, selected save as name was the same as an existing, open file.
Here's another way to see a side-effect of skipping index 0:
Open 2 or 3 files from the Recent files list. When a file is opened, it is removed from recent files.
Notice, however, that the file on tab 0 remains on the recent file list.
Swap tab 0 and tab 1 in the editor.
Look at recent files again. Notice now that the filename for the file that had been in position 1 is now on recent files and that the file moved to position 1 has been removed from recent files.
The text was updated successfully, but these errors were encountered:
While writing tests for the editor stack save functions for issue #5703, I noticed a separate issue in the way that the return value from
has_filename
was being used.has_filename
returns a list index for the location of the file inself.data
, which can include0
as a valid value. If the file is not found, then the function returnsNone
.In some of the code that calls
has_filename
(including code from the save functions), the code was written asif not has_filename(fname)
. I believe the intention was to skip the code when the file wasn't found, but an unintentional side effect is that it was skipping the code when the index was 0.During
save_as
andsave_copy_as
, this skipped code was used to close a file if the new, selectedsave as
name was the same as an existing, open file.Here's another way to see a side-effect of skipping index 0:
Recent files
list. When a file is opened, it is removed from recent files.The text was updated successfully, but these errors were encountered: