This rev makes minimal changes to the existing (very complex) code.
Please report any problems immediately.
Here are the highlights:
- Match longest prefix first: e;; no longer interferes with date;;
- Predefine 'x' as the empty string before executing abbreviation
scripts.
- Split @data abbreviations-subst-env into separate nodes.
- Defined do() and insert() functions in @data abbreviations-subst-env
as follows:
def do(commandName):
'''Execute a command by name.'''
c.k.simulateCommand(commandName,event=None)
def insert(s):
'''Insert the string s in the current widget.'''
try:
w = c.abbrevCommands.w
if w:
i = w.getInsertPoint()
w.insert(i,s)
except AttributeError:
pass
*Note*: Because of a glitch in how abbreviations scripts are created, you
can't do::
do(['command1','command2'])
even though c.k.simulateCommand allows list arguments. Instead, do this::
do('command1');do('command2');
The following abbreviations insert matching characters (no need to do x=''
in them)::
(={|{insert('()');do('back-char')}|}
[={|{insert('[]');do('back-char')}|}
{={|{insert('{}');do('back-char')}|}
This is an implementation of auto-close-quotes
<https://groups.google.com/forum/#!msg/leo-editor/yJLz-p3I4mY/Pqa1phYN_10J>,
done entirely with abbreviations! For example, typing '(' inserts '()' and
puts the cursor *between* the parens.
I personally dislike these abbreviations. I find it harder to skip past
the ')' than to type it later. ymmv.
Your comments please, Amigos.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.