notepad4 icon indicating copy to clipboard operation
notepad4 copied to clipboard

Replace : match destination casing

Open meteorquake opened this issue 10 months ago • 2 comments

It would be helpful if the Replace dialog had an option to adjust the casing of the replacement text to the destination. So in "This and this and THIS" a replacement of this -> that would yield "That and that and THAT" I suspect this would actually be the normal requirement for all replacements (where Match Case is not ticked, where it is ticked there will naturally be no adjustments occurring anyway) so it's quite possible this could be done as a general option defaulting to on. That said, people can be lazy to put case matching on for a replacement they know is unique where it should strictly be used so I suspect it would arguably best be an option in the Replace dialog itself. Cheers, David

meteorquake avatar Feb 17 '25 08:02 meteorquake

What if the replacement string has different length? it's easy to construct replacement string (from search string) in editor window with existing case mapping menus.

zufuliu avatar Feb 17 '25 09:02 zufuliu

I should clarify there, that in this concept the length doesn't matter. Basically -

  • found word is all upper case then replacement becomes all upper case
  • found word has just first letter capitalised, the replacement has first letter capitalised
  • found word all lower case, the replacement is all lower case
  • found word is some weird combination of casing which is unlikely then it could probably go in unaltered

The above applies when the replacement string is all lower case; if the replacement string has any upper casing, it does a straightforward replacement without regard to the target casing found...

meteorquake avatar Feb 17 '25 11:02 meteorquake