Here's my original, which does mess up "undo", but it's a start. I use
Command-Shift-<char> to trigger the actions. Cmd-Shift-space, for
example, picks up the text under the mouse and puts it into the current
selection. I use that almost exclusively instead of copy/paste to enter
variable names without typos. Quotes, brackets, and a few other things
are covered. In the case of quotes and parentheses where there is no
selection, it places a paired set of characters and moves the insertion
point between them.
on commandKeyDown whichKey
if ("editor field" is not in the name of the target and "script" is
not in the name of the target) \
or the shiftkey is not down
then pass commandKeyDown
switch whichKey
case quote
case "'"
get the selection
put quote & it & quote into the selection
if it = "" then
put the selectedchunk into tSel
put word 4 of tSel into word 2 of tSel
put (word 4 of tSel) - 1 into word 4 of tSel
select tSel
end if
break
case "v" -- paste only plain text
put the clipboardData["text"] into the selection
break
case "9"
case "0"
case "("
case ")"
get the selection
put "(" & it & ")" into the selection
if it = "" then
put the selectedchunk into tSel
put word 4 of tSel into word 2 of tSel
put (word 4 of tSel) - 1 into word 4 of tSel
select tSel
end if
break
case "["
case "]"
case "{"
case "}"
get the selection
put "[" & it & "]" into the selection
if it = "" then
put the selectedchunk into tSel
put word 4 of tSel into word 2 of tSel
put (word 4 of tSel) - 1 into word 4 of tSel
select tSel
end if
break
case " " -- scriptPaint
put the mousetext into the selection
break
default
pass commandKeyDown
end switch
setEditorDirty
end commandKeyDown
private command setEditorDirty -- make the editor know things changed
type space
delete char (word 4 of the selectedchunk) of the target
end setEditorDirty
--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode