Summary: | support on-the-fly case conversion in Search & Replace plugin | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | Patrick Roye <patrick.roye> |
Component: | search | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | jonathan, kare.sars, loh.tar |
Priority: | NOR | ||
Version First Reported In: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Microsoft Windows | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Patrick Roye
2016-05-18 13:43:02 UTC
good idea! A related request, possibly different enough to make a entry, but let's start by putting it here. I'd like to propose a 'smart case match' option for search-and-replace that would make the case in the replaced text match the case in the search text. The reason is that I often find myself having to repeat search-and-replace functions to cover the same word written in different case styles. For instance if I want to rename an object 'foo' to the name 'bar', I typically need to do some or all of the following: 'foo' -> 'bar' 'Foo' -> 'Bar' 'FOO' -> 'BAR" and it seems that a single smart search-and-replace could do all three at once by taking note of the case specified in the search and replace boxes. Jonathan: The idea is not bad, but it would probably complicate the code quite much. How would you capitalize the following: foo -> baar but how about: FOO -> BAAr or FOO -> BAAR And how do you convert all instances of Foo, foo, FOO and fOO to Foo? I think the replace needs to be case sensitive except if you have explicit \U, \L or \I. Unfortunately I don't think this reaches very high on my priority list. Sorry :( ('\U\1' and friends is on my TODO) All it would have to do is three case-sensitive search-and-replace operations: 1. Exactly as the user entered; 2. Substituting both fields with lower case; 3. Substituting both fields with upper case. I can't see much sense in trying to be smarter than that. Anyway I see that it is quite a different problem from the one you are setting out to solve, but I'm happy to write it myself and propose it as a patch. If no-one but me likes it I'll keep it as a personal fork, wouldn't be the first time. :) Can this be closed? Now is the mentioned \U available The feature does appear to be implemented now. I didn't do much testing, but I did get the expected behavior using the steps I submitted in the original request. I'm good with closing this issue. Thanks! |