New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
History: update on renaming/moving a folder #10999
Conversation
local file, count = v.file:gsub(old_path, new_path) | ||
if count == 1 then | ||
self.hist[i].file = file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the :gsub(), I guess you should try to match at start, and limit the nb of replacements to 1 (4th parameter, or no need if matching at start).
So sick cases like renaming bits of /mnt/onboard/Library/Fiction/mnt/onboard/Library/myfile.epub
are supported :)
@@ -199,6 +200,22 @@ function ReadHistory:updateItemByPath(old_path, new_path) | |||
end | |||
end | |||
|
|||
--- Updates the history list after renaming/moving a folder. | |||
function ReadHistory:updateItemsByPath(old_path, new_path) | |||
old_path = "^"..old_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof, this was so confusing to me. I think it'd be much clearer straight in the gsub, heh. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
straight in the gsub
It's in the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or old_path_pattern instead of just old_path
Closes #10995.
(Doesn't update sdr with "dir" setting, but that's another story)
This change is