fix #596: Avoid drawing a command section beyond the width of the list (#597)

* fix #596: Avoid drawing a command section beyond the width  of the list

* chore: remove unneeded parentheses
This commit is contained in:
Sam Lanning 2022-11-06 07:32:35 +00:00 committed by GitHub
parent e297b98f72
commit d87abbd3dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -159,6 +159,11 @@ impl DrawState<'_> {
for section in h.command.split_ascii_whitespace() {
self.x += 1;
if self.x > self.list_area.width {
// Avoid attempting to draw a command section beyond the width
// of the list
return;
}
self.draw(section, style);
}
}