Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glitchy scrolling with (touchpad emulated) mouse wheel #10

Open
xiota opened this issue May 31, 2023 · 6 comments · May be fixed by #11
Open

Glitchy scrolling with (touchpad emulated) mouse wheel #10

xiota opened this issue May 31, 2023 · 6 comments · May be fixed by #11

Comments

@xiota
Copy link
Contributor

xiota commented May 31, 2023

Using (touchpad emulated) mouse wheel to scroll with current git checkout (6318c71). Looks like the scroll overshoots a little then bounces back, on each line. Does not occur with epy.

@wustho
Copy link
Owner

wustho commented Jun 2, 2023

That's weird, I cannot replicate it, is there anymore details to recreate it? Does it work on different terminals?

@xiota
Copy link
Contributor Author

xiota commented Jun 2, 2023

Arch Linux. Don't really know what's relevant. It's present in all combinations of the following that I've tried:

  • bash, zsh
  • kitty, konsole, xfce4-terminal, xterm, uxterm
  • Wayland: Plasma
  • X11: Plasma, XFCE

I'm scrolling with a touchpad. Maybe it's a hardware issue. I know some touchpads report scroll behavior differently from the wheel on a mouse. Sorry for inaccurate description. Have edited to clarify.

@xiota xiota changed the title Glitchy scrolling with mouse wheel Glitchy scrolling with (touchpad emulated) mouse wheel Jun 2, 2023
@xiota
Copy link
Contributor Author

xiota commented Jun 4, 2023

Tested with an external mouse. Same problem.

Tried compiling with nuitka, and the problem is absent/reduced, so scrolling may be affected by some processing. Does baca perform some calculations in a loop that epy doesn't?

Occasionally, the glitchy scrolling does not occur, but far more often it does. (Out of all testing so far, only 2-3 times it was not glitchy.)

@xiota
Copy link
Contributor Author

xiota commented Jun 4, 2023

I was poking around in the code and found this:

contents.py (L158-L162):

    def on_mouse_scroll_down(self, _: events.MouseScrollDown) -> None:
        self.screen.scroll_down()

    def on_mouse_scroll_up(self, _: events.MouseScrollUp) -> None:
        self.screen.scroll_up()

Changing it to the following (based on Textual: widget.py) corrects the scrolling behavior:

    def on_mouse_scroll_down(self, _: events.MouseScrollDown) -> None:
        if self._scroll_down_for_pointer(animate=False):
            event.stop()

    def on_mouse_scroll_up(self, _: events.MouseScrollUp) -> None:
        if self._scroll_up_for_pointer(animate=False):
            event.stop()

@xiota xiota linked a pull request Jun 4, 2023 that will close this issue
@xiota
Copy link
Contributor Author

xiota commented Jun 4, 2023

Switching to self.scroll_*() also seems to work. Glitchiness only occurs with self.screen.scroll_*().

@xiota
Copy link
Contributor Author

xiota commented Jun 8, 2023

Did some more testing.

  • Version of textual on my computer with glitchy scrolling is v0.27.0. On another computer with the same version of textual, scroll behavior is the same. (Installing baca on Arch using AUR package.)
  • Installing with pipx install baca uses textual v0.16.0 with scrolling behaving as expected. Changing from self.screen.scroll_*() to self.scroll_*() results in no response to the scroll wheel (no scrolling).
  • Updating textual to v0.17.0 in pipx venv results in glitchy scroll behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants