···121121 history_requested: bool = false,
122122 who_requested: bool = false,
123123 at_oldest: bool = false,
124124+ can_scroll_up: bool = false,
124125 // The MARKREAD state of this channel
125126 last_read: u32 = 0,
126127 // The location of the last read indicator. This doesn't necessarily match the state of
···850851851852 // Scroll up
852853 if (self.scroll.pending > 0) {
854854+ // Check if we can scroll up. If we can't, we are done
855855+ if (!self.can_scroll_up) {
856856+ self.scroll.pending = 0;
857857+ return;
858858+ }
853859 // Consume 1 line, and schedule a tick
854860 self.scroll.offset += 1;
855861 self.scroll.pending -= 1;
···11981204 // We will set the msg offset too to prevent any bumping of the scroll state when we get
11991205 // a new message
12001206 self.scroll.msg_offset = self.messages.items.len;
12071207+ }
12081208+12091209+ // Set the can_scroll_up flag. this is true if we drew past the top of the screen
12101210+ self.can_scroll_up = row <= 0;
12111211+ if (row > 0) {
12121212+ // If we didn't draw past the top of the screen, we must have reached the end of
12131213+ // history. Draw an indicator letting the user know this
12141214+ const bot = "━";
12151215+ var writer = try std.ArrayList(u8).initCapacity(ctx.arena, bot.len * max.width);
12161216+ try writer.writer().writeBytesNTimes(bot, max.width);
12171217+12181218+ const border: vxfw.Text = .{
12191219+ .text = writer.items,
12201220+ .style = .{ .fg = .{ .index = 8 } },
12211221+ .softwrap = false,
12221222+ };
12231223+12241224+ const unread: vxfw.SubSurface = .{
12251225+ .origin = .{ .col = 0, .row = row },
12261226+ .surface = try border.draw(ctx),
12271227+ };
12281228+ try children.append(unread);
12291229+ const no_more_history: vxfw.Text = .{
12301230+ .text = "No more history",
12311231+ .style = .{ .fg = .{ .index = 8 } },
12321232+ .softwrap = false,
12331233+ };
12341234+ const no_history_surf = try no_more_history.draw(ctx);
12351235+ const new_sub: vxfw.SubSurface = .{
12361236+ .origin = .{ .col = (max.width -| no_history_surf.size.width) / 2, .row = row },
12371237+ .surface = no_history_surf,
12381238+ };
12391239+ try children.append(new_sub);
12011240 }
1202124112031242 if (did_scroll_to_last_read) {