From d87abbd3dc860aecffb4239fb41973b8e195f85e Mon Sep 17 00:00:00 2001 From: Sam Lanning Date: Sun, 6 Nov 2022 07:32:35 +0000 Subject: [PATCH] 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 --- src/command/client/search/history_list.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/command/client/search/history_list.rs b/src/command/client/search/history_list.rs index fda1098f..d74221d8 100644 --- a/src/command/client/search/history_list.rs +++ b/src/command/client/search/history_list.rs @@ -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); } }