Skip to content

Commit 12005ec

Browse files
committed
Simplify code
1 parent 2d63513 commit 12005ec

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

kitty/mouse.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -625,21 +625,9 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags) {
625625
//printf("asdf %f\n", pixels);
626626
if (screen->linebuf == screen->main_linebuf) {
627627
screen_history_scroll(screen, abs(s), upwards);
628-
if (screen->scrolled_by != 0) {
629-
if (screen->scrolled_by != screen->historybuf->count) {
630-
pixel_scroll(screen, pixels);
631-
} else {
632-
if (pixels < 0) pixel_scroll(screen, pixels);
633-
else pixel_scroll(screen, 0);
634-
}
635-
} else {
636-
if (screen->scrolled_by != screen->historybuf->count) {
637-
if (pixels > 0) pixel_scroll(screen, pixels);
638-
else pixel_scroll(screen, 0);
639-
} else {
640-
pixel_scroll(screen, 0);
641-
}
642-
}
628+
if (screen->scrolled_by == 0 && pixels < 0) pixels = 0;
629+
if (screen->scrolled_by == screen->historybuf->count && pixels > 0) pixels = 0;
630+
pixel_scroll(screen, pixels);
643631
} else {
644632
pixel_scroll(screen, 0);
645633
if (screen->modes.mouse_tracking_mode) {

0 commit comments

Comments
 (0)