There is already a function "Toggle Case" (Control-Alt-U), which excanges upper and lower case in the selection. It would also be great to have a function, which converts all characters to upper case.
"Toggle Case" does not invert case of mixed text (which is pretty rarely needed AFAICT).
What it actually does to set all to lower case if the selection has mixed case, otherwise it toggles the case once everything is the same case, so using it twice will give you all upper.
Closed #3336 as completed.
I see. I was mislead by the description: I'm using the German version of Geany, and the menu item explicitly states that it inverts mixed case to the respective opposite case. Admittedly, the actual behaviour is a bit tricky to express in German.
Admittedly, the actual behaviour is a bit tricky to express in German.
And in English, which is probably why its simply called "Toggle Case", "If selection is mixed case set to lower case else if selection is all same case toggle case" is a bit long for the menu :-)
And its probably only reliable in ASCII, eg is upper case of ß SS or ẞ? Unicode allows either. Or Greek lowercase of Σ which depends on where in the word it comes and Turkish I etc etc
Well, the problem with Σ is whether the letter is at the end of a word or inside a word; otherwise it would be unique. But I agree that it is sufficient to restrict it to the ASCII subset. A formulation in English would perhaps be "cycle case"....
Well, the problem with Σ is whether the letter is at the end of a word or inside a word; otherwise it would be unique.
Correct, but since the case change is only done on the selection it may not be able to tell end of word when just a contiguous sequence of word characters is selected (which is also the default if there is no selection) since then the selection contains nothing to indicate end of word, or similarly if only one character is selected.
But I agree that it is sufficient to restrict it to the ASCII subset.
Yeah, IIUC most coding is done in English since the common (programming) languages have English keywords and in older languages identifiers are limited to ASCII.
The use-case of Geany's "Toggle case" is lost in the mists of time but I would guess its to correct shift key errors (on English keyboards many operator characters are shifted, so shift key lead/lag capitalises the previous/next character too) like `misseD(` and `*Missed`.
I would guess non-ASCII use would only be in documentation or translations, and I'm not sure how often it would be used then, so it should be ok to leave it unrestricted since (hopefully) the edge cases won't happen very often.
A formulation in English would perhaps be "cycle case"....
Of the editors/IDEs I have here only Geany has a "toggle case", Scite and Eclipse have "to upper" and "to lower" as two commands and Xed, Gedit, Vscode have no case handling. I think "toggle case" comes from word processors, certainly MS Word and Libre Office have "toggle case" (as well as "upper case" and "lower case"). I don't think inventing a new term is really necessary, and "toggle case" is pretty entrenched, all the translations would need to be changed, but if somebody makes a PR it might be considered.
I agree to most of your comments, except that, for instance, in Ruby
Σ = あ * x
would be perfectly legal code. However, I don't think many users would worry about toggling the case in such situations.
BTW (since in Ruby, the case of an identifier mattres), Ruby does treat Σ as uppercase and あ as lower case in the Ruby-sense of naming entities.....
github-comments@lists.geany.org