Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8819
    Meir
    Participant

    Currently the three case-modifying menu commands are three different and distinct commands, albeit grouped under Edit -> Convert selection sub-menu.

    My proposal is to have a fourth one, “Toggle Case”, working as follows:

    * Like the other, existing three it will be available only when some text is selected.

    * When invoked, it will cycle through these three commands in the order “Lowercase” -> “Uppercase” -> “Capitalize” and back to “Lowercase”.

    * It will start in this cycle from the closest to these three states. The obvious next when all characters are lowercase is “Uppercase”, then “Capitalize” and then “Lowercase” again, and so on. The rule could be simple: when the majority of the characters are capitals, the next state is “Capitalize”; when the majority are lowercase, the next state is “Uppercase”. (In the special case of a word like “mIXUP” the next state might be “Capitalize”, as this was obviously a “Caps-lock” unintentionally left active.)

    * The default keyboard shortcut might be ALT-C (for “case”)

    Microsoft’s “WORD” is using this kind of cycling the word (and even a complete sentence) case, although there the shortcut key is the SHIFT-F3. It is very handy and it is easier to use since it involves just a single command and key.

    Regards,
    Meir

    P.S.: Can that be implemented by a macro???
    (Sorry, I never tried one… :-( )

    #8820
    Yutaka Emura
    Keymaster

    Hello Meir,

    You can easily do this using a macro. Here is an example but not including the Capitalize command. You can use this as a start to make it better.


    s = document.selection.Text;
    if( s.length != 0 ){
    n = s.charCodeAt(0);
    if( n >= 0x41 && n <= 0x5a ){
    s = s.toLowerCase();
    }
    else {
    s = s.toUpperCase();
    }
    document.selection.Text = s;
    }

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.