apprt/gtk: fix selected search label off by one

pull/9756/head
Mitchell Hashimoto 2025-11-29 15:33:05 -08:00
parent eebce6a78c
commit 56a76cc174
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
1 changed files with 2 additions and 1 deletions

View File

@ -172,9 +172,10 @@ pub const SearchOverlay = extern struct {
}
fn closureMatchLabel(_: *Self, selected: i64, total: i64) callconv(.c) ?[*:0]const u8 {
if (total <= 0) return glib.ext.dupeZ(u8, "0/0");
var buf: [32]u8 = undefined;
const label = std.fmt.bufPrintZ(&buf, "{}/{}", .{
if (selected >= 0) selected else 0,
if (selected >= 0) selected + 1 else 0,
if (total >= 0) total else 0,
}) catch return null;
return glib.ext.dupeZ(u8, label);