On Thu, Feb 27, 2014 at 5:54 AM, Reinhard Engel
<[email protected]> wrote:
>
> There seems to be a subtle bug in leoGlobals.py:
>
> In the 'globalDirectiveList', the directive 'command' is missing.

@command is not a directive for this purpose.

> This seems not to cause problems, because of the way 'aList' in 
> 'compute_directives_re' is constructed.

I agree that there is a problem if a plugin adds items to g.globalDirectiveList.

> Then in 'get_directives_dict' the directive is silently skipped.
>
> The following pattern in 'compute_directives_re' solves this problem::

  aList = [x for x in globalDirectiveList if z != 'others']
  aList.sort(lambda a, b: len(b) - len(a))    # Sort by length, longest first
  pat = "^@(%s)(?=( |\t|\n)+)" % "|".join(aList)

My guess is that sorting as you suggest is correct.  However,
returning pat rather than the present code::

   return '|'.join(aList)

seems like a separate issue.  Care to comment?

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.

Reply via email to