mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-11-21 15:44:44 +00:00
Ignore fractional scroll amounts that are not finite
This commit is contained in:
parent
fb68ed81e0
commit
74fd8e792f
2 changed files with 5 additions and 1 deletions
|
|
@ -6087,7 +6087,7 @@ screen_history_scroll(Screen *self, int amt, bool upwards) {
|
|||
|
||||
static bool
|
||||
screen_fractional_scroll(Screen *self, double amt) {
|
||||
if (amt == 0) return false;
|
||||
if (amt == 0 || !isfinite(amt)) return false;
|
||||
double integral_part, fractional_part = modf(amt, &integral_part);
|
||||
double pixels = trunc(fractional_part * self->cell_size.height);
|
||||
if (fractional_part > 0) pixels = MAX(1, pixels);
|
||||
|
|
|
|||
|
|
@ -317,6 +317,10 @@ class TestScreen(BaseTest):
|
|||
total -= 15
|
||||
self.ae((s.scrolled_by, s.pixel_scroll_offset_y), (total // 20, total % 20))
|
||||
self.ae(total, 0)
|
||||
s.scroll_to_absolute(5.0)
|
||||
for amt in (float('nan'), float('inf'), float('-inf')):
|
||||
self.assertFalse(s.fractional_scroll(amt))
|
||||
self.ae((s.scrolled_by, s.pixel_scroll_offset_y), (5, 0))
|
||||
|
||||
def test_emoji_skin_tone_modifiers(self):
|
||||
s = self.create_screen()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue