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

Most Mouse Deltas Rounded to Zero In Textual 2.0 #5554

Closed
ddkasa opened this issue Feb 18, 2025 · 2 comments · Fixed by #5556
Closed

Most Mouse Deltas Rounded to Zero In Textual 2.0 #5554

ddkasa opened this issue Feb 18, 2025 · 2 comments · Fixed by #5556

Comments

@ddkasa
Copy link
Contributor

ddkasa commented Feb 18, 2025

The Bug

Most mouse movement deltas are unusable due to being rounded to zero after the smooth scrolling update. Unless rapid mouse movements are applied, the deltas are almost certainly zero.

1.0.0

Textual-1.0.0.webm

2.0.4

Textual-2.0.4.webm

Expected behaviour would be the original, unless this was intended side effect when converting to integers to the new properties, as most of the float values are below/above ±0.5 depending on if its a negative value or not, so they get rounded to zero.

One idea would be to give the user access to the float values, but that seems a bit half baked, as the new properties would become mostly useless.

Another idea would be clamping the values to ±1 or the closest none-zero value.

MRE

from textual.app import App, ComposeResult
from textual.events import MouseMove
from textual.widgets import Placeholder


class BugReportApp(App):
    def on_mouse_move(self, event: MouseMove) -> None:
        print(f"{event.delta_x=} {event.delta_y=}")


if __name__ == "__main__":
    BugReportApp().run()

Textual Diagnostics

Versions

Name Value
Textual 2.0.4
Rich 13.9.4

Python

Name Value
Version 3.12.5
Implementation CPython
Compiler GCC 14.2.1 20240801 (Red Hat 14.2.1-1)
Executable /home/dk/dev/tmp/textual-sandbox/.venv/bin/python3

Operating System

Name Value
System Linux
Release 6.12.13-100.fc40.x86_64
Version #1 SMP PREEMPT_DYNAMIC Sat Feb 8 17:10:01 UTC 2025

Terminal

Name Value
Terminal Application Kitty
TERM xterm-kitty
COLORTERM truecolor
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=274, height=54
legacy_windows False
min_width 1
max_width 274
is_terminal True
encoding utf-8
max_height 54
justify None
overflow None
no_wrap False
highlight None
markup None
height None
Copy link

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@willmcgugan willmcgugan changed the title Regression - Most Mouse Deltas Rounded to Zero In Textual 2.0 Most Mouse Deltas Rounded to Zero In Textual 2.0 Feb 18, 2025
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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.

1 participant