input: Fix invalid vertical scroll in single line mode. (#1273)

This commit is contained in:
Jason Lee 2025-09-22 19:47:47 +08:00 committed by GitHub
parent 62e3f8126a
commit c80704d4d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1612,7 +1612,11 @@ impl InputState {
let safe_x_range =
(-self.scroll_size.width + self.input_bounds.size.width).min(px(0.0))..px(0.);
offset.y = offset.y.clamp(safe_y_range.start, safe_y_range.end);
offset.y = if self.mode.is_single_line() {
px(0.)
} else {
offset.y.clamp(safe_y_range.start, safe_y_range.end)
};
offset.x = offset.x.clamp(safe_x_range.start, safe_x_range.end);
self.scroll_handle.set_offset(offset);
cx.notify();