Repository navigation
fix: Select File/Folder starts in the real path's folder instead of the caption - #3806
Merged
Merged
Conversation
…he caption The path bar's "Select File/Folder..." took the initial folder from the window text, which can be a custom caption (/dl, /dr, ...) or a path compacted by PathCompactPath. Use m_sFilepath when it is set, as Copy Full Path and Copy Filename already do (WinMerge#3791, WinMerge#3795).
Member
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #3791 and #3795, same root cause in another entry of the path bar's context menu: "Select File/Folder..." now opens the dialog in the folder of the real path, not in a folder derived from the displayed text.
WinMergeU.exe /dl "Left" /dr "Right" C:\work\a.txt C:\work\b.txt, as VCS tools do): the initial folder was computed fromLeft, so the dialog did not start next to the compared file. It now starts inC:\work.PathCompactPath(C:\...\proj\a.txt), so the initial folder wasC:\...\proj, which does not exist. It now uses the full path.Cause:
CFilepathEdit::OnContextMenuSelected(ID_EDITOR_SELECT_FILE) calledGetWindowText()and passed that text topaths::GetParentPath. The window text is the caption or the compacted display text set byRefreshDisplayText, while the real path is kept inm_sFilepath(already used by Copy Full Path / Copy Filename since #3791/#3795, and by Edit Path).Fix: when
m_sFilepathis set, the initial folder ispaths::GetParentPath(m_sFilepath); otherwise the previous window-text logic (including stripping the leading*modified mark) is kept unchanged.Test: the control is MFC (Windows-only) with no unit-test harness, so the initial-folder logic was checked in a standalone C++ program using
paths::GetParentPathcopied from the source. Before the change 4 of 6 cases fail (custom caption, caption with the modified mark, compacted path, folder caption); after it all 6 pass, including a plain uncaptioned path and a control without a real path (fallback unchanged).Disclosure: this change was prepared with the assistance of an AI coding agent (Claude) and has not been compiled or exercised in the GUI on Windows.