Command and Option modifiers with Arrow Keys

Here is where the magnanimous folks that create externals post them (.zip archives only please).

Command and Option modifiers with Arrow Keys

Postby codegreen » Tue Dec 01, 2015 6:16 pm

The recent discussion of this topic got me to thinkin' there was probably a sneaky way to hack this in after the fact.
Here's what I came up with... :twisted:

fletch.sc45.zip
(5.75 KiB) Downloaded 169 times

HTH,
-Mark
codegreen
 
Posts: 1517
Joined: Mon Jul 14, 2008 11:03 pm

Re: Command and Option modifiers with Arrow Keys

Postby tetsuo29 » Sat Dec 05, 2015 8:04 pm

Hi. Thank you. This is a great start. It's really, really close to providing the standard behavior. (Shift +) Option/Command + Left/Right and (Shift +) Option/Command + Left/Right work like one would expect. However, these modifier keys in conjunction with Up/Down don't always work as expected.

For instance, Shift + Up/Down acts a little differently than it does in say, TextEdit. Shift + Up/Down in TextEdit tries to stay approximately where the end of selection was as you grab more lines. Fletch, once seems to grab all the way to the end of a line and once it has done that stays there as you grab more lines.

Shift + Option + Up/Down in TextEdit starts grabbing all the way to ends of lines. In Fletch this grabs all the way to the beginning or end of the text (like what you would expect Shift + Command + Up/Down to do).

Shift + Command + Up/Down in TextEdit grabs all the way to the end from the current insertion point. Repeating this with the opposite direction will then grab all text. Fletch alternates between grabbing from the insertion point to the top when Up is pressed or grabbing from the insertion point to the bottom when down is pressed. Fletch's behavior might actually make more sense but it's not the standard. Also, Fletch's behavior here is the exact same whether you use Shift + Command + Up/Down or Shift + Option + Up/Down- seems like it would be better if Fletch had different behavior for the Shift + Command or Shift + Option Up/Down use cases.

Anyway, it's a great start and we beggars shouldn't be choosers but, if you did decide to release a new version with more standard behavior that would be super extra cool.
tetsuo29
 
Posts: 13
Joined: Wed Nov 18, 2015 12:10 pm

Re: Command and Option modifiers with Arrow Keys

Postby codegreen » Sat Dec 05, 2015 10:15 pm

This is a great start. It's really, really close to providing the standard behavior.

FWIW this XRtn isn't actually implementing the revised behavior itself. Instead it's just intercepting low level events associated with arrow keys (via XRtn callbacks, which get first crack at them) and slipping them directly to WASTE (the text engine SC uses) if an editable field is open, thus sidestepping a passel of intervening code that would otherwise provide the familiar legacy behaviors.

Those 'non-standard' conventions mirror ones found in SC's script and user prop editors (and hundreds of other WASTE-based apps), and entirely predate both TextEdit and OS X.

So like 'em or not, they're already baked into the 4.7 app -- fletch just lets you turn them on in fields. Technically it might be possible to replace them with something that mirrors Cocoa's mappings, but it would take a LOT more than the paragraph of simple glue code in this sneaky hack...

-Mark
codegreen
 
Posts: 1517
Joined: Mon Jul 14, 2008 11:03 pm


Return to XCmds, XFcns, and XRtns

Who is online

Users browsing this forum: No registered users and 1 guest

cron