fix: escape file list contents to avoid rendering garbage

This commit is contained in:
CJ van den Berg 2024-12-20 15:34:29 +01:00
parent ca784d1712
commit 1c087203e0
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -174,18 +174,10 @@ fn handle_render_menu(self: *Self, button: *Button.State(*Menu.State(*Self)), th
.Warning => button.plane.set_style(style_warning),
.Error => button.plane.set_style(style_error),
}
_ = button.plane.print("{s}", .{entry.lines}) catch {};
_ = button.plane.print("{s}", .{std.fmt.fmtSliceEscapeLower(entry.lines)}) catch {};
return false;
}
fn render_cell(plane: *Plane, y: usize, x: usize, style: Widget.Theme.Style) !void {
plane.cursor_move_yx(@intCast(y), @intCast(x)) catch return;
var cell = plane.cell_init();
_ = plane.at_cursor_cell(&cell) catch return;
cell.set_style(style);
_ = plane.putc(&cell) catch {};
}
fn handle_scroll(self: *Self, _: tp.pid_ref, m: tp.message) error{Exit}!void {
_ = try m.match(.{ "scroll_to", tp.extract(&self.view_pos) });
self.update_selected();