add elipsization to lsp_progress mzte-nv module

This commit is contained in:
LordMZTE 2024-05-05 09:50:05 +02:00
parent c974057a57
commit fc49a634a8
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6

View file

@ -70,18 +70,25 @@ fn lFormatClient(l: *c.lua_State) !c_int {
try del.print("%#Special#[{s}] %#Comment#{s}", .{ client_name, spinner });
const max_msgs = 2;
const nmsgs = c.lua_objlen(l, 3);
for (1..nmsgs + 1) |i| {
const nshown = @min(nmsgs, max_msgs);
for (1..nshown + 1) |i| {
_ = c.lua_rawgeti(l, 3, @intCast(i));
defer c.lua_pop(l, 1);
const msg = ffi.luaToString(l, -1);
try del.push(msg);
if (i != nmsgs) {
if (i != nshown) {
try del.writer.writeAll("%#Operator#,");
}
}
if (nmsgs > max_msgs) {
try del.push("%#Comment#󰇘");
}
ffi.luaPushString(l, buf.slice());
return 1;
}