Diff

util/stanza.lua @ 11574:21217f7e82b9

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.
author Jonas Schäfer <jonas@wielicki.name>
date Sat, 08 May 2021 16:31:48 +0200
parent 11264:2cdcf55c6dd5
child 11639:ad39528e647d
line wrap: on
line diff
--- 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;