From 538115cde9cec0108a6fc532377275f9517c425b Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Fri, 14 Mar 2025 09:27:25 -0500 Subject: [PATCH] fix: actually fix markread_on_focus --- src/app.zig | 10 ++++++++-- src/lua.zig | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app.zig b/src/app.zig index ab8deaf..4b2a9b8 100644 --- a/src/app.zig +++ b/src/app.zig @@ -287,8 +287,14 @@ pub const App = struct { .focus_in => { if (self.config.markread_on_focus) { - // TODO: implement this - + if (self.selectedBuffer()) |buffer| { + switch (buffer) { + .client => {}, + .channel => |channel| { + channel.last_read_indicator = channel.last_read; + }, + } + } } self.has_focus = true; ctx.redraw = true; diff --git a/src/lua.zig b/src/lua.zig index 066efae..d5bb9c7 100644 --- a/src/lua.zig +++ b/src/lua.zig @@ -221,7 +221,7 @@ const Comlink = struct { const field_enum = std.meta.stringToEnum(comlink.Config.Fields(), field) orelse continue; switch (field_enum) { - .markread_on_focus => app.config.markread_on_focus = lua.toBoolean(1), + .markread_on_focus => app.config.markread_on_focus = lua.toBoolean(-1), } } return 0; -- 2.51.2