@@ -73,6 +73,8 @@ local POLL_INTERVAL = 55
73
73
-- Floating values like 0.4 should work too.
74
74
local timeout = 5 * 1000 -- overriden by w.config_get_plugin later
75
75
76
+ local current_buffer
77
+
76
78
local default_color = w .color (' default' )
77
79
-- Cache error variables so we don't have to look them up for every error
78
80
-- message, a normal user will not change these ever anyway.
@@ -2695,7 +2697,7 @@ function Room:ParseChunk(chunk, backlog, chunktype)
2695
2697
-- luacheck: ignore 542
2696
2698
elseif chunk [' type' ] == ' m.receipt' then
2697
2699
-- TODO: figure out if we can do something sensible with read receipts
2698
- elseif chunk [' type' ] == ' m.fully_read' and self .buffer ~= w . current_buffer () then
2700
+ elseif chunk [' type' ] == ' m.fully_read' and self .buffer ~= current_buffer then
2699
2701
-- we don't want to update read line for the current buffer
2700
2702
-- TODO: check if read marker correspond to the last event in the room
2701
2703
w .buffer_set (self .buffer , " unread" , " " )
@@ -3290,7 +3292,14 @@ end
3290
3292
function buffer_switch_cb (data , signal , sig_type )
3291
3293
-- Update bar item
3292
3294
w .bar_item_update (' matrix_typing_notice' )
3293
- local current_buffer = w .current_buffer ()
3295
+ if current_buffer then
3296
+ local room = SERVER :findRoom (current_buffer )
3297
+ if room then
3298
+ room :MarkAsRead ()
3299
+ end
3300
+ end
3301
+
3302
+ current_buffer = w .current_buffer ()
3294
3303
local room = SERVER :findRoom (current_buffer )
3295
3304
if room then
3296
3305
room :MarkAsRead ()
@@ -3299,7 +3308,6 @@ function buffer_switch_cb(data, signal, sig_type)
3299
3308
end
3300
3309
3301
3310
function typing_bar_item_cb (data , buffer , args )
3302
- local current_buffer = w .current_buffer ()
3303
3311
local room = SERVER :findRoom (current_buffer )
3304
3312
if not room then return ' ' end
3305
3313
local typing_ids = table.concat (room .typing_ids , ' ' )
0 commit comments