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

Typz thetypz at gmail.com
Fri Nov 30 15:43:04 CET 2012


+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 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.

I'll try to clean this up and provide a patch against master, for people to
try it.
Best regards,

-- 
Francois


On Fri, Nov 30, 2012 at 2:01 PM, Cristian Tibirna <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 .. http://www.kde.org
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20121130/c7ffcdf1/attachment.html>


More information about the Qt-creator mailing list