[ENH] Assignment shortcut
Michael Rueger
Michael.Rueger.-ND at disney.com
Sat Oct 30 01:43:19 UTC 1999
--------------D95A04927960248B21133C33
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi all,
for all those people using e.g. VisualWorks I added the ctrl-g shortcut
to the paragraph editor generating the ":=" assignment operator.
Well, maybe I should have added back the left arrow in VisualWorks
though ;-)
Happy Halloween
Michael
--
"To improve is to change, to be perfect is to change often."
Winston Churchill
+------------------------------------------------------------+
| Michael Rueger |
| Phone: ++1 (818) 623 3283 Fax: ++1 (818) 623 3559 |
+--------Michael.Rueger.-ND at online.disney.com----------------+
--------------D95A04927960248B21133C33
Content-Type: text/plain; charset=us-ascii;
name="Assignment-mir.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Assignment-mir.cs"
"Change Set: Assignment short cut
Date: 29 Oct 1999
Author: Michael Rueger (michael.rueger.-nd at online.disney.com)
Adds the shortcut ctrl-g to the paragraph editor generating the := assignment operator"!
!ParagraphEditor methodsFor: 'typing/selecting keys' stamp: 'mir 10/29/1999 18:33'!
displayAssignment: characterStream
"Replace the current text selection with the text ':='--initiated by
ctrl-g."
sensor keyboard. "flush character"
characterStream nextPutAll: ':='.
^false! !
!ParagraphEditor class methodsFor: 'keyboard shortcut tables' stamp: 'mir 10/29/1999 18:32'!
initializeShiftCmdKeyShortcuts
"Initialize the shift-command-key (or control-key) shortcut table."
"NOTE: if you don't know what your keyboard generates, use Sensor kbdTest"
"wod 11/3/1998: Fix setting of cmdMap for shifted keys to actually use the
capitalized versions of the letters.
TPR 2/18/99: add the plain ascii values back in for those VMs that don't return the shifted values."
| cmdMap cmds |
"shift-command and control shortcuts"
cmdMap _ Array new: 256. "use temp in case of a crash"
cmdMap atAllPut: #noop:.
cmdMap at: ( 1 + 1) put: #cursorHome:. "home key"
cmdMap at: ( 4 + 1) put: #cursorEnd:. "end key"
cmdMap at: ( 8 + 1) put: #forwardDelete:. "ctrl-H or delete key"
cmdMap at: (13 + 1) put: #crWithIndent:. "ctrl-Return"
cmdMap at: (27 + 1) put: #selectCurrentTypeIn:. "escape key"
cmdMap at: (28 + 1) put: #cursorLeft:. "left arrow key"
cmdMap at: (29 + 1) put: #cursorRight:. "right arrow key"
cmdMap at: (30 + 1) put: #cursorUp:. "up arrow key"
cmdMap at: (31 + 1) put: #cursorDown:. "down arrow key"
cmdMap at: (45 + 1) put: #changeEmphasis:. "cmd-sh-minus"
cmdMap at: (61 + 1) put: #changeEmphasis:. "cmd-sh-plus"
cmdMap at: (127 + 1) put: #forwardDelete:. "del key"
"Note: Command key overrides shift key, so, for example, cmd-shift-9 produces $9 not $("
'9[,''' do: [ :char | cmdMap at: (char asciiValue + 1) put: #shiftEnclose: ]. "({< and double-quote"
"Note: Must use cmd-9 or ctrl-9 to get '()' since cmd-shift-9 is a Mac FKey command."
cmdMap at: (27 + 1) put: #shiftEnclose:. "ctrl-["
cmds _ #(
$a argAdvance:
$b browseItHere:
$c compareToClipboard:
$d duplicate:
$e methodStringsContainingIt:
$f displayIfFalse:
$g displayAssignment:
$j doAgainMany:
$k changeStyle:
$n referencesToIt:
$r indent:
$l outdent:
$s search:
$t displayIfTrue:
$u changeLfToCr:
$v pasteInitials:
$w methodNamesContainingIt:
$x makeLowercase:
$y makeUppercase:
$z makeCapitalized:
).
1 to: cmds size by: 2 do: [ :i |
cmdMap at: ((cmds at: i) asciiValue + 1) put: (cmds at: i + 1). "plain keys"
cmdMap at: ((cmds at: i) asciiValue - 32 + 1) put: (cmds at: i + 1). "shifted keys"
cmdMap at: ((cmds at: i) asciiValue - 96 + 1) put: (cmds at: i + 1). "ctrl keys"
].
ShiftCmdActions _ cmdMap.! !
ParagraphEditor initializeShiftCmdKeyShortcuts!
--------------D95A04927960248B21133C33--
More information about the Squeak-dev
mailing list
|