tangled
alpha
login
or
join now
rockorager.dev
/
comlink
2
fork
atom
an experimental irc client
2
fork
atom
overview
issues
pulls
pipelines
ui: add subtle bright hl on left side of message
rockorager.dev
1 year ago
22d22e39
704e636c
verified
This commit was signed with the committer's
known signature
.
rockorager.dev
SSH Key Fingerprint:
SHA256:qn/Fjy7CpbcogGEPB14Y53hLnQleZNFY9lkQnuudFLs=
+19
-5
1 changed file
expand all
collapse all
unified
split
src
irc.zig
+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
1019
+
// Adjust the row we print on for the wrapped height of this message
1020
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
1027
+
const left_hl = try vxfw.Surface.init(
1028
1028
+
ctx.arena,
1029
1029
+
self.messageViewWidget(),
1030
1030
+
.{ .height = surface.size.height, .width = 1 },
1031
1031
+
);
1032
1032
+
const left_hl_cell: vaxis.Cell = .{
1033
1033
+
.char = .{ .grapheme = "▕", .width = 1 },
1034
1034
+
.style = .{ .fg = .{ .index = 3 } },
1035
1035
+
};
1036
1036
+
@memset(left_hl.buffer, left_hl_cell);
1037
1037
+
try children.append(.{
1038
1038
+
.origin = .{ .row = row, .col = gutter_width - 1 },
1039
1039
+
.surface = left_hl,
1040
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
1031
-
mouse.row < row and
1032
1032
-
mouse.row >= row - surface.size.height;
1047
1047
+
mouse.row < row + surface.size.height and
1048
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
1056
-
.origin = .{ .row = row - surface.size.height, .col = gutter_width },
1072
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
1063
-
// Adjust the row we print on for the wrapped height of this message
1064
1064
-
row -= surface.size.height;
1065
1079
try children.append(.{
1066
1080
.origin = .{ .row = row, .col = gutter_width },
1067
1081
.surface = surface,