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
This commit is contained in:
Johannes Altmanninger
2025-12-17 16:43:16 +01:00
parent 81e1f6937f
commit ee2d99ecf3

View File

@@ -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);