util.stanza: add at_top helper
authorJonas Schäfer <jonas@wielicki.name>
Sat, 08 May 2021 16:31:48 +0200
changeset 11578 21217f7e82b9
parent 11577 cb5748f94840
child 11579 76d32b2ca5eb
util.stanza: add at_top helper This allows the user to detect whether the cursor is currently at the top of the stanza. This will be used by util.xmppstream to be able to port it over.
util/stanza.lua
--- a/util/stanza.lua	Thu May 20 14:00:54 2021 +0200
+++ b/util/stanza.lua	Sat May 08 16:31:48 2021 +0200
@@ -136,6 +136,10 @@
 	return self;
 end
 
+function stanza_mt:at_top()
+	return self.last_add == nil or #self.last_add == 0
+end
+
 function stanza_mt:reset()
 	self.last_add = nil;
 	return self;