This thread contains a patchset. You're looking at the original emails,
but you may wish to use the patch review UI.
Review patch
3
2
[PATCH] ui: set window title to current channel
---
src/App.zig | 12 ++++++++++ --
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/App.zig b/src/App.zig
index 7e7e0c1..5169ab2 100644
--- a/src/App.zig
+++ b/src/App.zig
@@ -1532,7 +1532,9 @@ fn draw(self: *App) !void {
self.loop.?.postEvent(.redraw);
}
}
- var chan_style: vaxis.Style = if (row == self.state.buffers.selected_idx)
+
+ const is_current = row == self.state.buffers.selected_idx;
+ var chan_style: vaxis.Style = if (is_current)
.{
.fg = if (client.status == .disconnected) .{ .index = 8 } else .default,
.reverse = true,
@@ -1590,7 +1592,7 @@ fn draw(self: *App) !void {
.style = chan_style,
},
);
- if (row == self.state.buffers.selected_idx) {
+ if (is_current) {
var write_buf: [128]u8 = undefined;
if (channel.has_unread) {
channel.has_unread = false;
@@ -1618,6 +1620,12 @@ fn draw(self: *App) !void {
};
_ = try topic_win.print(&topic_seg, .{ .wrap = .none });
+ {
+ var buf: [64]u8 = undefined;
+ const title = try std.fmt.bufPrint(&buf, "{s} - comlink", .{channel.name});
+ try self.vx.setTitle(self.tty.anyWriter(), title);
+ }
+
if (hasMouse(member_list_win, self.state.mouse)) |mouse| {
switch (mouse.button) {
.wheel_up => {
--
2.45.2
On Tue Jul 16, 2024 at 3:28 PM CDT, Gregory Anders wrote:
> ---
> src/App.zig | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/src/App.zig b/src/App.zig
> index 7e7e0c1..5169ab2 100644
> --- a/src/App.zig
> +++ b/src/App.zig
> @@ -1532,7 +1532,9 @@ fn draw(self: *App) !void {
> self.loop.?.postEvent(.redraw);
> }
> }
> - var chan_style: vaxis.Style = if (row == self.state.buffers.selected_idx)
> +
> + const is_current = row == self.state.buffers.selected_idx;
> + var chan_style: vaxis.Style = if (is_current)
> .{
> .fg = if (client.status == .disconnected) .{ .index = 8 } else .default,
> .reverse = true,
> @@ -1590,7 +1592,7 @@ fn draw(self: *App) !void {
> .style = chan_style,
> },
> );
> - if (row == self.state.buffers.selected_idx) {
> + if (is_current) {
> var write_buf: [128]u8 = undefined;
> if (channel.has_unread) {
> channel.has_unread = false;
> @@ -1618,6 +1620,12 @@ fn draw(self: *App) !void {
> };
> _ = try topic_win.print(&topic_seg, .{ .wrap = .none });
>
> + {
> + var buf: [64]u8 = undefined;
> + const title = try std.fmt.bufPrint(&buf, "{s} - comlink", .{channel.name});
Is channel always < 54 chars??
--
Tim
On Tue Jul 16, 2024 at 4:13 PM CDT, Tim Culverhouse wrote:
>
> Is channel always < 54 chars??
Libera at least enforces a ~48 character max (many error code 479s were
encountered to discover this). The spec doesn't mention anything about
channel name limits though: https://modern.ircdocs.horse/#channels . So
to be safe, we can truncate the channel name if it's longer than 64
characters.
On Tue Jul 16, 2024 at 4:32 PM CDT, Gregory Anders wrote:
> Libera at least enforces a ~48 character max (many error code 479s were
> encountered to discover this). The spec doesn't mention anything about
> channel name limits though: https://modern.ircdocs.horse/#channels . So
> to be safe, we can truncate the channel name if it's longer than 64
> characters.
Truncating sounds like a good plan to me
Thanks for looking into it!
--
Tim