Re: Moving text-insertion point?
Re: Moving text-insertion point?
- Subject: Re: Moving text-insertion point?
- From: Allan Odgaard <email@hidden>
- Date: Mon, 3 May 2004 21:15:45 +0200
On 3. May 2004, at 20:46, Jim Witte wrote:
Are you aware of key binding files?
http://developer.apple.com/documentation/Cocoa/Conceptual/
InputManager/Concepts/KeyBindings.html
Thanks. That looks like what I'd need to modify. But how do I
modify the <key> attribute of the dictionary? In the dictionary
editor dev app, all the keys are displayed as a funny little keycap
symbol, or by their Unicode equivalent - neither of which is to
helpful. And if the key-bindings are based on the Unicode
*character*, then what, say, maps Cmd-Opt-<right-arrow> to whatever
Unicode bit-string it is)?
well... Property List Editor is not the tool you want to use for the
editing task ;) I keep my key bindings in the old plist format. You can
convert XML to that with the 'pl' command, e.g. "pl <
/System/Library/Frameworks/AppKit.framework/Resources/
StandardKeybinding.dict" (although this won't produce a useful file,
since pl doesn't handle utf8 gracefully).
The key code is what is sent to the application, so for left/right:
% egrep '(Left|Right)Arrow' NSEvent.h
NSLeftArrowFunctionKey = 0xF702,
NSRightArrowFunctionKey = 0xF703,
Modifiers are:
Command: @
Shift: $
Control: ^
Alt: ~
So a minimal ~/Library/KeyBindings/DefaultKeyBinding.dict would contain:
{ "~\UF702" = "moveToBeginningOfLine:"; "~\UF703" = "moveToEndOfLine:";
}
To map option left/right to bel/eol.
A key-bindings dict editor that would work like the keyboard
shortcuts in Panther would be nice - would that be possible to write
(I'm thinking it would depend on the translation table of
modifiers-keys to Unicode, as well as the keyBindings file)
Yes, that would probably be quite easy to write, but using the
old-style plist format, it's no real hassle to edit the file manually.
You can btw add key bindings for some of the other NSResponder action
methods, here's some of mine:
"~p" = "selectParagraph:";
"~l" = "selectLine:";
"~w" = "selectWord:";
"^t" = "transpose:";
"^u" = "uppercaseWord:";
"^U" = "lowercaseWord:";
"~u" = "capitalizeWord:";
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.