aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-06-03 13:12:55 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2023-06-03 13:12:55 +0200
commit484c35b7ac117cce7d37c2f3e6edc8f79e41eaf4 (patch)
treeafbe23df32c7111a78c0712c42d21c898cef5ad4
parent5445cb30171a01a247e5c59a572b5ba2f355eb7c (diff)
downloadwee-slack-484c35b7ac117cce7d37c2f3e6edc8f79e41eaf4.tar.gz
Only modify a single chat line for one message in WeeChat 4.0.0
Since WeeChat now has multiline support, the whole message is in one chat line. This means that we don't need to look for all the lines belonging to a message and modify them, we can just modify the line for the message directly. This has the benefit of making it possible to increase and decrease the number of lines for a message, rather than having to join extra lines or get blank lines.
-rw-r--r--wee_slack.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index c3d2a73..6ffc994 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -4954,6 +4954,11 @@ def modify_buffer_line(buffer_pointer, ts, new_text):
is_last_line = False
line_pointer = w.hdata_move(hdata.line, line_pointer, -1)
+ if weechat_version >= 0x04000000:
+ data = w.hdata_pointer(hdata.line, line_pointer, "data")
+ w.hdata_update(hdata.line_data, data, {"message": new_text})
+ return w.WEECHAT_RC_OK
+
# Find all lines for the message
pointers = []
while line_pointer and hdata_line_ts(line_pointer) == ts: