[code] Small addition to snippets

From: Pedro Andres Aranda Gutierrez <paaguti.att.gmail.com>
Date: Mon, 12 Nov 2018 11:59:50 +0100

Hi,

maybe because I'm caĆ³tico, I sometimes quit a snippet prematurely. This
blocks the editor with a message of the likes that ph is nil and can't be
indexed in the message buffer.

Here's a quick&dirty fix for it:
+++ snippets.lua 2018-11-12 11:47:57.000000000 +0100
--- snippets.lua.orig 2018-11-12 11:52:51.000000000 +0100
@@ -551,14 +551,9 @@
         end
         local id = buffer:indicator_value_at(M.INDIC_PLACEHOLDER, s)
         local ph = snapshot.placeholders[id]
+ if not ph then
+ -- ui.print(string.format("snapshot.placeholders doesn't have %s as
index", id))
+ return nil, nil
+ else
+ if (not index or ph.index == index) and (not type or ph[type]) then
+ return s, ph
+ end
+ end
- if (not index or ph.index == index) and (not type or ph[type]) then
- return s, ph
- end
         s = buffer:indicator_end(M.INDIC_PLACEHOLDER, i)
       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 Mon 12 Nov 2018 - 05:59:50 EST

This archive was generated by hypermail 2.2.0 : Mon 12 Nov 2018 - 06:26:47 EST