Snippets bug

From: Robert <ro....at.web.de>
Date: Fri, 21 May 2010 13:22:35 +0200

I think there is a bug when leaving placeholders empty in snippets.
With the built-in "key" snippet I get
...rt/bin/textadept_2.2/modules/textadept/lsnippets.lua:208: bad
argument #2 to 'text_range' (start > end)
when I leave the first placeholder empty (pressing tab again without
typing anything).
[''] = { %2(func)%3(, %4(arg)) }

A possible fix could be something like
-- l. 208 in lsnippets.lua
-- local ph_text = buffer:text_range(snippet.ph_pos, caret)
if caret > snippet.ph_pos then
  local ph_text = buffer:text_range(snippet.ph_pos, caret)
else
  ph_text = ""
end

But I'm not sure, because
snippets.test1 = '%1 = -%1-'
works,
but
snippets.test2 = '%1 = %1'
works only without my changes above, but only after pressing tab again
the mirroring is done.

Robert

-- 
You received this message because you are subscribed to the Google Groups "textadept" group.
To post to this group, send email to textadept.at.googlegroups.com.
To unsubscribe from this group, send email to textadept+unsubscribe.at.googlegroups.com.
For more options, visit this group at http://groups.google.com/group/textadept?hl=en.
Received on Fri 21 May 2010 - 07:22:35 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:46:24 EST