On 30.11.2012, at 14:01, Cristian Tibirna <[email protected]> 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).
There's a task for it https://bugreports.qt-project.org/browse/QTCREATORBUG-2106 Actually I'd require the case of the replace string (numpad in your case) to decide the camel case situation. Search: testpad Replace: foobar (testpad -> foobar, TESTPAD -> FOOBAR, Testpad -> Foobar, tESTPAD -> fOOBAR, TestPad -> Foobar, testPad -> foobar, TeStPad -> Foobar, tESTpAD -> foobar) Search: testpad Replace: FooBar (testpad -> foobar, TESTPAD -> FOOBAR, Testpad -> Foobar, tESTPAD -> fOOBAR, TestPad -> FooBar, testPad -> fooBar, TeStPad -> FooBar, tESTpAD -> fooBar) I.e. something like 1) all upper/lower case -> all upper/lower case 2) first letter upper/lower case, rest lower/upper case -> first letter upper/lower case, rest lower/upper case 3) other mixed case: first letter upper/lower case -> first letter upper/lower case, rest as specified Maybe it would also be possible to take the case of the last character into account, to do something like tESTpAD -> fOObAR, but my brain doesn't manage to wrap around that just now (what "tESTpAD" would be replaced with if the replace string is "FooBaR" , and such ;) ). And it sounds a bit pathological to have both tESTpAD and TestPad in your code anyhow. Br, Eike -- 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 _______________________________________________ Qt-creator mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/qt-creator
