[ANN] Release 9.0.0 DP-8

Mark Wieder ahsoftware at sonic.net
Tue Jul 18 13:58:34 EDT 2017

On 07/18/2017 06:46 AM, Bob Hall via use-livecode wrote:
> I’ve had the completion capability on my local dev environment for a couple of years via a plugin that I wrote. I wrestled with these same problems years ago. I actually find that it is benefitial to have BOTH completion and no completion. Having a setting to change this is combersome. It is an on-the-fly desire.

Here's my take on that... with a simple addition you can bracket 
existing text as well as inserting a pair in one place.

on rawKeyDown pKey
    local tBookmarks
    local tChunk

    if optionkey() = "down" then
       switch pKey
          case 34 # ok
             put quote&quote into tBookmarks
          case 39 # ok
             put "''" into tBookmarks
          case 57 #?
          case 40
             put "()" into tBookmarks
          case 91 # ok
             put "[]" into tBookmarks
          case 123 # ok
             put "{}" into tBookmarks
       end switch
    end if

    # see if we want to insert a pairing
    if tBookmarks is not empty then
       # this allows bracketing existing text
       put the selectedChunk into tChunk
       put char 2 of tBookmarks after the selectedChunk
       select tChunk
       put char 1 of tBookmarks before the selectedChunk
       pass rawKeyDown
    end if
end rawKeyDown

Also, if the script editor is already in memory you don't need to insert 
a frontscript - just

set the behavior of stack "revSEEditorBehavior" to the long id of 
<button with this script>

but if the script editor hasn't already been loaded into memory I don't 
think you can do this without monkeypatching the SE startup script.

  Mark Wieder
  ahsoftware at gmail.com

More information about the Use-livecode mailing list