Skip to content

Commit

Permalink
Merge pull request #21696 from juliangilbey/fix-renamed_tree
Browse files Browse the repository at this point in the history
PR: Improve `renamed_tree` method (Editor)
  • Loading branch information
ccordoba12 authored Jan 21, 2024
2 parents 5ae26aa + 75477ac commit 256de5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion spyder/plugins/editor/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2539,7 +2539,9 @@ def renamed_tree(self, source, dest):
tofile = to_text_string(dest)
for fname in self.get_filenames():
if osp.abspath(fname).startswith(dirname):
new_filename = fname.replace(dirname, tofile)
source_re = "^" + re.escape(source)
dest_quoted = dest.replace("\\", r"\\")
new_filename = re.sub(source_re, dest_quoted, fname)
self.renamed(source=fname, dest=new_filename)

#------ Source code
Expand Down

0 comments on commit 256de5f

Please sign in to comment.