[code] suspected bug in snippets.lua

From: Pedro Andres Aranda Gutierrez <paaguti.att.gmail.com>
Date: Sun, 1 Mar 2020 09:06:46 +0100

Hi,

after the last mods in snippets.lua, I have started to get error messages.
Investigating a bit, it seems that the first entry in the snippets table is
a number and not a string. Attached is a patch with a work-around for this:

Best regards, /Pedro A.

diff -r d72b7f24f8db modules/textadept/snippets.lua
--- a/modules/textadept/snippets.lua Sat Feb 22 19:54:25 2020 -0500
+++ b/modules/textadept/snippets.lua Sun Mar 01 09:03:10 2020 +0100
@@ -158,9 +158,11 @@
       return trigger, v[trigger]
     elseif grep then
       for name, text in pairs(v) do
- if name:find(name_patt) and
- (type(text) == 'string' or type(text) == 'function') then
- matching_snippets[name] = tostring(text)
+ if type(name) == 'string' then
+ if name:find(name_patt) and
+ (type(text) == 'string' or type(text) == 'function') then
+ matching_snippets[name] = tostring(text)
+ end
         end
       end
     end

Best, /PA

-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellet zu werden
Georg Kreisler
-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sun 01 Mar 2020 - 03:06:46 EST

This archive was generated by hypermail 2.2.0 : Sun 01 Mar 2020 - 06:42:25 EST