Bug 456367 - Replace All feature not works in block mode
Summary: Replace All feature not works in block mode
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 21.12.3
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-05 20:40 UTC by Alain Laporte
Modified: 2023-11-08 18:57 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.113


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alain Laporte 2022-07-05 20:40:15 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Create a file with multiple occurrence of a word to replace 
2. Switch in block mode
3. Select the word to replace
4. Type Ctrl+R to replace the word
5. Type the new word which must replace the selected one
3. Click on "Replace All" button

OBSERVED RESULT

No replacements made (the popup "0 replacements made" appear)

EXPECTED RESULT

All occurrences was replaced.

SOFTWARE/OS VERSIONS
Windows: N/A
macOS: N/A
Linux/KDE Plasma: 5.15.0-40-generic
(available in About System)
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION

Also reproduced on the master.
Comment 1 Waqar Ahmed 2022-07-21 12:33:57 UTC
This is unlikely to change. If someone wants to a replace only in a particular part of the document, they can select that part and do replace.

Best we can do is to show a warning that replace will not work or disable the UI.
Comment 2 remipch 2023-11-07 15:41:26 UTC
I can reproduce this bug.

It happens when all these conditions are met :
- block selection mode is checked
- option "search in the selection only" is not checked
- some text is selected

In this case it should find/replace all occurrences in the whole document but it finds "0 occurrences".

Following actions are affected :
- find all
- replace all

It works correctly if selection mode is normal (no block mode)
It works correctly if option "search in the selection only" is checked
It works correctly selection is empty

Note : "search in the selection only" is automatically checked when a text is selected, it must be explicitly unchecked to reproduce this bug.

I'm trying to add an autotest to reproduce this bug.
Comment 3 Bug Janitor Service 2023-11-07 18:27:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/631
Comment 4 Christoph Cullmann 2023-11-08 18:57:43 UTC
Git commit 5c6f373e307d981935ddd14a27addec8aca29bc9 by Christoph Cullmann, on behalf of Rémi Peuchot.
Committed on 08/11/2023 at 19:48.
Pushed by cullmann into branch 'master'.

KateSearchBar: ignore block mode if selectionOnly option is disabled
FIXED-IN:5.113

M  +2    -1    src/search/katesearchbar.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/5c6f373e307d981935ddd14a27addec8aca29bc9