an experimental irc client

ui: add subtle bright hl on left side of message

rockorager.dev 22d22e39 704e636c

verified
+19 -5
+19 -5
src/irc.zig
··· 1016 1016 .{ .width = max.width -| gutter_width, .height = null }, 1017 1017 ); 1018 1018 const surface = try text.draw(child_ctx); 1019 + // Adjust the row we print on for the wrapped height of this message 1020 + row -= surface.size.height; 1019 1021 if (self.client.app.yellow != null and msg.containsPhrase(self.client.nickname())) { 1020 1022 const bg = self.client.app.blendYellow(30); 1021 1023 for (surface.buffer) |*cell| { 1022 1024 if (cell.style.bg != .default) continue; 1023 1025 cell.style.bg = bg; 1024 1026 } 1027 + const left_hl = try vxfw.Surface.init( 1028 + ctx.arena, 1029 + self.messageViewWidget(), 1030 + .{ .height = surface.size.height, .width = 1 }, 1031 + ); 1032 + const left_hl_cell: vaxis.Cell = .{ 1033 + .char = .{ .grapheme = "▕", .width = 1 }, 1034 + .style = .{ .fg = .{ .index = 3 } }, 1035 + }; 1036 + @memset(left_hl.buffer, left_hl_cell); 1037 + try children.append(.{ 1038 + .origin = .{ .row = row, .col = gutter_width - 1 }, 1039 + .surface = left_hl, 1040 + }); 1025 1041 } 1026 1042 1027 1043 // See if our message contains the mouse. We'll highlight it if it does 1028 1044 const message_has_mouse: bool = blk: { 1029 1045 const mouse = self.message_view.mouse orelse break :blk false; 1030 1046 break :blk mouse.col >= gutter_width and 1031 - mouse.row < row and 1032 - mouse.row >= row - surface.size.height; 1047 + mouse.row < row + surface.size.height and 1048 + mouse.row >= row; 1033 1049 }; 1034 1050 1035 1051 if (message_has_mouse) { ··· 1053 1069 @memset(hl_surface.buffer, base); 1054 1070 1055 1071 try children.append(.{ 1056 - .origin = .{ .row = row - surface.size.height, .col = gutter_width }, 1072 + .origin = .{ .row = row, .col = gutter_width }, 1057 1073 .surface = hl_surface, 1058 1074 }); 1059 1075 1060 1076 self.message_view.hovered_message = msg; 1061 1077 } 1062 1078 1063 - // Adjust the row we print on for the wrapped height of this message 1064 - row -= surface.size.height; 1065 1079 try children.append(.{ 1066 1080 .origin = .{ .row = row, .col = gutter_width }, 1067 1081 .surface = surface,