KateSearchBar: ignore block mode if selectionOnly option is disabled
Bug
This bug affects "find all" and "replace all" KateSearchBar actions.
It happens when all these conditions are met :
- block selection mode is enabled
- option "search in the selection only" is disabled
- some text is selected
In this case it should find/replace all occurrences in the whole document but it finds "0 occurrences".
Internal cause
When "search in the selection only" option is disabled, the whole document range is used as inputRange
by KateSearchBar::findOrReplaceAll()
method.
However, when block selection mode is used, it can lead to an empty range because inputRange
is still interpreted as a "block" range.
For example, if the last document line is empty, we have: inputRange = {{0, 0}, {line_count-1, 0}}
.
- In normal selection mode, it correctly defines the whole document.
- In bloc selection mode, it's en empty range.
Fix
The fix consist in ignoring block mode in KateSearchBar::findOrReplaceAll()
method if "search in the selection only" option is disabled.
A (failing) autotest has been added to reproduce the bug, which passes after the bug fix.