changeCase()

11 views
Skip to first unread message

seasoned_geek

unread,
Jan 14, 2022, 8:56:33 AM1/14/22
to scintilla-interest
All,

Finally getting back to work on the last of the examples for the csScintilla port and wanted to ask about changeCase(). EDT has forever had a "change case" key on the numeric keypad. It actually gets used a lot in the world where EDT is used. It works on single characters and entire selections, just flipping each character to the "other." Very handy if you are keying stuff in from a printout and didn't notice CAPS LOCK was on so now your CamelCase is now cAMELcASE.

The lowerCase() and upperCase() methods listed in cpp header files only work on selections. I ham fist in the single character support, no problem there. Given the wide range of selections Scintilla has though, I didn't want to:

  1. pull all of the selctions out into a safety copy somewhere.
  2. clear the selections
  3. walk through the saved selections char by char changing case
  4. reset the selections
I could do that, but first wanted to see how much pain it would be to bury it deeper in Scintilla so others might use it?

I poked around looking at the code (not deeply mind you) and noticed this:

CaseConverter caseConvFold;
CaseConverter caseConvUp;
CaseConverter caseConvLow;

in CaseConvert.cxx

Is caseConvFold just an odd name for caseConvOther? Is this functionality already baked in at the low level and I just need to figure out how to expose at the C++ level?

I guess what I'm really asking is can someone point me to a guide/tutorial for adding a new keyboard command so I can add SCI_CHANGECASE to complement SCI_LOWERCASE and SCI_UPPERCASE? Better yet, if this is partially done, where it got left off at?

Thanks,
Roland


Neil Hodgson

unread,
Jan 14, 2022, 4:03:56 PM1/14/22
to Scintilla mailing list
seasoned_geek:

> in CaseConvert.cxx
>
> Is caseConvFold just an odd name for caseConvOther?

Case folding is the process of removing case distinctions so that case-insensitive comparisons can be made. Scintilla uses it for the case-insensitive option of searching.

https://metacpan.org/pod/Unicode::CaseFold

Neil

Roland Hughes

unread,
Jan 14, 2022, 4:19:08 PM1/14/22
to scintilla...@googlegroups.com
Neil,

Thanks. I figured that out a bit ago. Just have to test this change now
and you should see a pull request.

Roland
--
Roland Hughes, President
Logikal Solutions
(630)-205-1593

http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
http://www.logikalblog.com
http://www.interestingauthors.com/blog

seasoned_geek

unread,
Jan 16, 2022, 3:14:16 PM1/16/22
to scintilla-interest
No. That change has to go back to GLIB. Scintilla shouldn't maintain a merge of real_tolower() and real_toupper() into a real_changecase() that supports 3 different transforms.

Well, that was a day spent making something I'm not going to keep. Thankfully it was off in its own little directory. For Qt and CopperSpice such a thing is "simple" assuming one trusts the underlying libraries.

Sorry to have taken up bandwidth.
Reply all
Reply to author
Forward
0 new messages