Bug 44422 - [find/replace] 'Find/Replace...', 'Find Next', etc. should escape selection if regex search enabled
Summary: [find/replace] 'Find/Replace...', 'Find Next', etc. should escape selection i...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 enhancement (vote)
Target Milestone: 3.4 M1   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 44799 129764 (view as bug list)
Depends on:
Blocks: 132833
  Show dependency tree
 
Reported: 2003-10-08 08:44 EDT by Markus Keller CLA
Modified: 2007-07-15 10:30 EDT (History)
2 users (show)

See Also:


Attachments
Fix (6.48 KB, patch)
2007-06-15 10:45 EDT, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2003-10-08 08:44:44 EDT
M4 testpass on I20031007 + plugin-export 20031008_1008

- do an Edit > Find/Replace with regular expressions
- do something else
- select a text range with regexp special characters in a text editor (e.g.:
".setText(")
- press Ctrl+F

-> the selected text is entered in the "Find:" field
-> clicking "Find" will fail since the text is not a valid regular expression

=> I suggest unchecking "Regular expressions" when a text selection is taken
over as search pattern
Comment 1 Dani Megert CLA 2003-10-08 09:01:10 EDT
The dialog is shared between editors and switching would always reset. We could
uncheck it the very first time the dialog gets opened with a selection.

Kai?

Comment 2 Markus Keller CLA 2004-05-24 05:06:29 EDT
Actually, my original request was not so clever. The right approach is to
*escape* the taken-up selection if regex search is enabled (insert '\' before
special characters). This should be done for 'Find Next' (Ctrl+K), 'Find
Previous', and the 'Find/Replace...' (Ctrl+F) dialog.

Another failing case: if regex search is enabled in the Find/Replace dialog,
selecting something like "update(true)" and pressing Ctrl+K does not find the
next "update(true)" since the parenthesis are interpreted as regex capturing group.

Changing title from 'Find/Replace dialog should uncheck "Regular expressions"
when taking text selection'.
Comment 3 Dani Megert CLA 2006-02-28 10:37:51 EST
*** Bug 129764 has been marked as a duplicate of this bug. ***
Comment 4 Markus Keller CLA 2007-06-14 13:27:01 EDT
*** Bug 44799 has been marked as a duplicate of this bug. ***
Comment 5 Markus Keller CLA 2007-06-15 10:45:37 EDT
Created attachment 71464 [details]
Fix

The fix implements comment 2.

It contains this workaround for bug 192837 in two places (workaround can be removed when bug 192837 is fixed):
	if (fullSelection == null) // workaround for bug 192837
		fullSelection= ""; //$NON-NLS-1$
Comment 6 Dani Megert CLA 2007-07-15 10:30:58 EDT
Thanks Markus.
Committed to HEAD.
Available in builds > N20070715-0010.