Bug 237296 - KTextEdit: 'Start of Line' regular expression search fails
Summary: KTextEdit: 'Start of Line' regular expression search fails
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdeui (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 205485 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-05-11 22:08 UTC by Sabine Faure
Modified: 2010-05-21 00:17 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sabine Faure 2010-05-11 22:08:56 UTC
Version:            (using Devel)
Compiler:          gcc 4.3.2 
OS:                Linux
Installed from:    Compiled sources

- Launch Kmail
- Click on 'New' button
- In the text editor, type:
*test
*testing
*hello test
*test
- Go to Edit menu/Find...
- A 'Find Text' dialogue opens. In it check the Regular expression' check box, click on the 'Edit...' button and select 'Start of Line' from the combo box
- a '^' is displayed in the 'Text to find:' line edit
- Add a 't'
- Click on the 'Find' button
- The first word is a match and its 't' is highlighted to show that
- Press F3 to search for other matches
- A pop up message appears saying: '1 match found.'

Whatever you do only the first match is shown whereas they are other matches according to the list.

Also the start of line and letter are only found if they are on the first line of text.
If you add an empty first line in the text editor then the pop up message is 'No matches found for '^t' instead.

Trunk Svn Rev 1125510
Comment 1 Sabine Faure 2010-05-11 22:18:36 UTC
The same thing happens with the 'end of line' functionality:
- Launch Kmail
- Click on 'New' button
- In the text editor, type:
*test
*testing
*hello test
*test (without going to the next line afterward)
- Go to Edit menu/Find...
- A 'Find Text' dialogue opens. In it check the Regular expression' check box,
click on the 'Edit...' button and select 'End of Line' from the combo box
- a '$' is displayed in the 'Text to find:' line edit
- Before it add 'test'
- Click on the 'Find' button
- The last line is found and highlighted
- Press F3 to search for other matches
- A pop up message appears saying: '1 match found.'

Whatever you do only that match is shown whereas they are other matches
according to the list.

Trunk, Svn Rev 1125510
Comment 2 Laurent Montel 2010-05-12 11:53:36 UTC
I don't think that it's a specific kmail bug.
But a kdelibs/.../kfind.cpp bug.
(But we didn't test it before I think :) )
Comment 3 Thomas McGuire 2010-05-12 17:02:40 UTC
Yes, I can confirm the bug here, with ktextedittest from kdelibs.
So moving the bug to kdelibs.
Comment 4 David Faure 2010-05-18 18:37:01 UTC
SVN commit 1128196 by dfaure:

Fix "start of line" (^) and "end of line" ($) regular expressions when the whole text is fed to KFind rather than line by line.

This is basically hitting a documented limitation of QRegExp (no support for the equivalent of perl's /m) and splitting
the text into lines in the case where the regexp starts with ^ or ends with $.

BUG: 237296
Fixed-In: 4.5


 M  +57 -4     findreplace/kfind.cpp  
 M  +7 -3      tests/kfindtest.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1128196
Comment 5 David Faure 2010-05-19 01:20:40 UTC
*** Bug 205485 has been marked as a duplicate of this bug. ***
Comment 6 Sabine Faure 2010-05-21 00:17:11 UTC
Cannot test because I am using 4.4 branch kdelibs instead of trunk there.

I'll try retesting this later if trunk is stable enough.

Trunk, Svn Rev 1128989