From b3ec594dd44727296266a7d97c0899ad07a35efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Sat, 8 May 2021 16:31:48 +0200 Subject: 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/stanza.lua b/util/stanza.lua index 3d4e9e5a..8ec49a39 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -136,6 +136,10 @@ function stanza_mt:up() 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; -- cgit v1.2.3