Bug 369104

Summary: [Regression] Selected text is not pasted in search field when search is initiated
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: Martin Kostolný <clearmartin>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: c16b7d71, colin, florian.brandner, houz, kde2, simonandric5, subdiff, TedFedora, toddrme2178, vascom2
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
URL: https://git.reviewboard.kde.org/r/128859/
Latest Commit: Version Fixed In: KDE Frameworks 5.27
Sentry Crash Report:

Description Martin Kostolný 2016-09-20 08:12:45 UTC
Since KF 5.26 when I want to search (Ctrl+F) in text editor, I have to copy the selected text, press Ctrl+F and paste the copied text in order to search for it in document.

Reproducible: Always

Steps to Reproduce:
1. Open a text document in any KDE text editor (e.g. Kate)
2. Select a portion of text and press Ctrl+F
3. Select another portion of text and press Ctrl+F

Actual Results:  
Search field is filled by the first portion of text.

Expected Results:  
Search field should be filled by the lastly selected portion of text.

Downgrading to ktexteditor 5.25 fixes this issue.
Comment 1 Christoph Feck 2016-09-26 21:12:54 UTC
*** Bug 369149 has been marked as a duplicate of this bug. ***
Comment 2 c16b7d71 2016-09-27 08:20:47 UTC
Also happens on Gentoo. Downgrading also fixes the problem for me.
Comment 3 Brandner 2016-10-06 11:41:03 UTC
Some additional observations:
- the selection is correctly copied into the text field on the first search
- the selection is correctly copied into the text field when alternating between different modes
of the search bar (e.g., CTRL-F then CTRL-R then again CTRL-F).

The problem appears to be in the method KateNormalInputMode::searchBar. On the first search, the selection is copied into the text field within the constructor of KateSearchBar, which actually invokes KateSearchBar::enterIncrementalMode.

On subsequent searches, the constructor is not called anymore. Consequently,  KateSearchBar::enterIncrementalMode is not invoked unless the mode variable switches between the "power" and "incremental" search modes.

Calling KateSearchBar::enterIncrementalMode within GDB at this moment fixes the problem. So, an obvious fix might be to always invoke KateSearchBar::enterIncrementalMode/ KateSearchBar::enterPowerMode independent from mode changes?
Comment 4 Dominik Haumann 2016-10-06 17:56:12 UTC
I thought this was fixed with KF 5.27, or is it not fixed ?
Comment 5 Christoph Feck 2016-10-07 01:47:27 UTC
*** Bug 369883 has been marked as a duplicate of this bug. ***
Comment 6 Martin Kostolný 2016-10-13 22:19:35 UTC
I cannot replicate it in KF 5.27 -> closing. Thanks for fixing this! :-)
Comment 7 Dominik Haumann 2016-10-23 09:45:04 UTC
*** Bug 371498 has been marked as a duplicate of this bug. ***