When I have a file open in either the standard Terminal or iTerm2, I've noticed a weird problem. When I use the Trackpad to scroll through the file with two fingers, if I scroll to the top of the file and scroll a bit more, it goes past that and goes back into my Terminal command history.
I'd really like this behavior to not happen, and stop at the top/bottom of the file. I've only observed this in macOS and not Linux.
Is there a setting I need to tweak?