SUMMARY When double clicking on a search result in the "search in files" results panel, it always activates the first unsaved document instead of the one which have the search results. STEPS TO REPRODUCE 1. Have two (or more) unsaved documents, and select any other tab which is not created firstly. 2. Open the "Edit->Search in files" 3. Select "in Current File" 4. Populate the result list (tree) by filling the search field and clicking on the search button 5. Double click on a search result OBSERVED RESULT The first unsaved document get activated, and the caret jumps to the line where the result was found in the document. (Regardless if there is any mach on the first document) EXPECTED RESULT The document should activated which the search results belongs to, and the caret should jump to the proper line. SOFTWARE/OS VERSIONS I'm using version 21.03.70 (flatpak release: 20.12.2) on Ubuntu KDE Frameworks 5.78.0 Qt 5.15.2 ADDITIONAL INFORMATION I was not able to reproduce it on the Windows (10) store version of Kate (20.08.2)
I actually noticed this too just some days ago....
Hmm, I can't reproduce this with the master version of Kate..
The secret is to create two new documents (not saved) add text to them and then search in them....
Hmm, isn't the problem that we match url => document? For untitled stuff that will fail, I guess we need to use there the document pointer. Similar to the fixes for quick open here: https://invent.kde.org/utilities/kate/-/merge_requests/400
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/554
Git commit 3ff6e15eca384f9300bfb31c3edc299fd10e7c91 by Waqar Ahmed. Committed on 10/01/2022 at 19:04. Pushed by cullmann into branch 'master'. Fix search for unsaved files Search for unsaved files doesn't work because we don't have QUrl's for them. Instead use KTextEditor::Document pointer for such files. Included is a small fix that I noticed while working on this. If you try to replace checked after searching, the file that you have opened doesn't get highlights as it should. Possible further improvements: - Ask main window for the "tab title" of the doc so that we can use that in the search tree view. Otherwise its kind of really ambigous Signed-off-by: Waqar Ahmed <waqar.17a@gmail.com> A +0 -0 addons/katebuild-plugin/highlighter.cpp [License: Trivial file] A +21 -0 addons/katebuild-plugin/highlighter.h [License: LGPL(v2.0)] M +58 -26 addons/search/MatchModel.cpp M +18 -7 addons/search/MatchModel.h M +11 -6 addons/search/Results.cpp M +4 -3 addons/search/Results.h M +1 -1 addons/search/SearchDiskFiles.h M +34 -16 addons/search/plugin_search.cpp M +1 -1 addons/search/plugin_search.h M +2 -2 addons/search/search_open_files.cpp M +1 -1 addons/search/search_open_files.h https://invent.kde.org/utilities/kate/commit/3ff6e15eca384f9300bfb31c3edc299fd10e7c91