tangled
alpha
login
or
join now
rockorager.dev
/
comlink
2
fork
atom
an experimental irc client
2
fork
atom
overview
issues
pulls
pipelines
ui: limit completer height
rockorager.dev
1 year ago
a51b6646
ec896d27
verified
This commit was signed with the committer's
known signature
.
rockorager.dev
SSH Key Fingerprint:
SHA256:qn/Fjy7CpbcogGEPB14Y53hLnQleZNFY9lkQnuudFLs=
+17
-2
1 changed file
expand all
collapse all
unified
split
src
irc.zig
+17
-2
src/irc.zig
···
280
280
.completer = Completer.init(gpa),
281
281
};
282
282
283
283
+
self.text_field.style = .{ .bg = .{ .index = 8 } };
283
284
self.text_field.userdata = self;
284
285
self.text_field.onSubmit = Channel.onSubmit;
285
286
self.text_field.onChange = Channel.onChange;
···
735
736
.origin = .{ .col = 0, .row = max.height - 1 },
736
737
.surface = try self.text_field.draw(text_field_ctx),
737
738
});
739
739
+
// Write some placeholder text if we don't have anything in the text field
740
740
+
if (self.text_field.buf.realLength() == 0) {
741
741
+
const text = try std.fmt.allocPrint(ctx.arena, "Message {s}", .{self.name});
742
742
+
var text_style = self.text_field.style;
743
743
+
text_style.italic = true;
744
744
+
text_style.dim = true;
745
745
+
var ghost_text_ctx = text_field_ctx;
746
746
+
ghost_text_ctx.max.width = text_field_ctx.max.width.? -| 2;
747
747
+
const ghost_text: vxfw.Text = .{ .text = text, .style = text_style };
748
748
+
try children.append(.{
749
749
+
.origin = .{ .col = 2, .row = max.height - 1 },
750
750
+
.surface = try ghost_text.draw(ghost_text_ctx),
751
751
+
});
752
752
+
}
738
753
}
739
754
740
755
if (self.completer_shown) {
741
756
const widest: u16 = @intCast(self.completer.widestMatch(ctx));
742
742
-
const completer_ctx = ctx.withConstraints(ctx.min, .{ .height = 10, .width = widest + 2 });
743
743
-
const surface = try self.completer.list_view.draw(completer_ctx);
744
757
const height: u16 = @intCast(@min(10, self.completer.options.items.len));
758
758
+
const completer_ctx = ctx.withConstraints(ctx.min, .{ .height = height, .width = widest + 2 });
759
759
+
const surface = try self.completer.list_view.draw(completer_ctx);
745
760
try children.append(.{
746
761
.origin = .{ .col = 0, .row = max.height -| 1 -| height },
747
762
.surface = surface,