[Qt-creator] Search and replace behavior with respect to case in editor

Ziller Eike Eike.Ziller at digia.com
Fri Nov 30 16:20:52 CET 2012


On 30.11.2012, at 16:04, Harri Pasanen <harri at mpaja.com>
 wrote:

> On 11/30/2012 03:43 PM, Typz wrote:
>> +1
>> 
>> I started implementing something like this some time, but could not 
>> get it complete due to regexp.
>> This was limited to the following use cases:
>>      - All upper-case match is replaced with the upper-case replace text;
>>      - All lower-case match is replaced with the lower-case replace text;
>>      - Capitalized match is replace with the capitalized text;
>>      - Otherwise, use the provided replace text directly.
>> 
>> Implementing the 'normal' case is easy, but I had a few issues:
>>      - I could not find a simple way to make it work for regexp
> 
> I very seldom use regexp replacements, so for me it would be ok if it 
> does not cover regexp replacements.
> 
>>      - I struggled with the UI to enable this feature: it is easy to 
>> add an extra icon/menu in the search box, but this is not logical (as 
>> it does not affect search)... Also, it seemed better to have the 
>> option in the search result widget, but this did not work.
>> 
> 
> How about just adding a global setting (checkbox) to 
> Tools->Options->Text Editor->Behavior pane?
> 
> Something like:
> 
>            Misc                     (new section under "Typing")
> 
> "Search and replace follows case [x]"

I'd certainly not do that by default.
It can simply be just another FindFlag (textfindconstants.h) that is switched like all the others (case sensitive, regexp, whole words).
Make it exclusive without regexp and case sensitive.

Or something like that ;)

>> I'll try to clean this up and provide a patch against master, for 
>> people to try it.
>> 
> 
> I'll be happy to try it.
> 
> Harri
> 
> 
> 
>> Best regards,
>> -- 
>> Francois
>> 
>> 
>> On Fri, Nov 30, 2012 at 2:01 PM, Cristian Tibirna <tibirna at kde.org 
>> <mailto:tibirna at kde.org>> wrote:
>> 
>>    On Friday 30 November 2012 12:23:53 Harri Pasanen wrote:
>>> It would be cool if search and replace would preserve case, in
>>    the same
>>> way as Emacs does.
>>> 
>>> So
>>> 
>>> Search:  testpad
>>> Replace: numpad
>>> 
>>> would produce these replacements:
>>> 
>>> testpad -> numpad
>>> TESTPAD -> NUMPAD
>>> Testpad  -> Numpad
>> 
>>    +1
>> 
>>> 
>>> 
>>> Bonus points for exceeding Emacs AI in the following cases:
>>> 
>>> TestPad -> NumPad    (emacs gives Numpad)
>>> testPad  -> numPad    (emacs gives numpad)
>> 
>>    +100
>> 
>>    To be noticed that this can be done (in a limited way) with
>>    regexps, but
>>    having the regular s&r do this automatically is something I had
>>    taken for
>>    granted with XEmacs and would be a nice (and rather powerful) tool
>>    to have.
>> 
>>    Brownie points to Harri for gathering up the energy to write this
>>    (I had
>>    noticed it since a few years already but never pushed myself all
>>    the way
>>    through to writing here or in bugreports.qt-project about it).
>> 
>>    --
>>    Cristian Tibirna
>>    KDE developer .. tibirna at kde.org <mailto:tibirna at kde.org> ..
>>    http://www.kde.org
>> 
>>    _______________________________________________
>>    Qt-creator mailing list
>>    Qt-creator at qt-project.org <mailto:Qt-creator at qt-project.org>
>>    http://lists.qt-project.org/mailman/listinfo/qt-creator
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Qt-creator mailing list
>> Qt-creator at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/qt-creator
> 
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

-- 
Eike Ziller, Senior Software Engineer - Digia, Qt
 
Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Anja Wasenius
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B




More information about the Qt-creator mailing list