From ee2d99ecf30ceac1f2a3e51f75c40020135bcf37 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 17 Dec 2025 16:43:16 +0100 Subject: [PATCH] Fix crash on kitty when clicking in scrolled command line When the command line occupies the whole screen such that no prompt line is shown, we crash due to overflow. Fix that. Fixes #12178 --- src/screen.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screen.rs b/src/screen.rs index 32b2c96be..570164502 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -642,7 +642,7 @@ pub fn offset_in_cmdline_given_cursor( ); 0 }) - .max(self.actual.visible_prompt_lines - 1) + .max(self.actual.visible_prompt_lines.saturating_sub(1)) .min(self.actual.line_count() - 1); let line = self.actual.line(y); let x = viewport_position.x.max(line.indentation);