Skip to content

gh-140389: fixed touchpad horizontal scrolling in IDLE editor - #140390

Open
TheLizzard wants to merge 5 commits into
python:mainfrom
TheLizzard:fix-issue-140389
Open

TheLizzard wants to merge 5 commits into
python:mainfrom
TheLizzard:fix-issue-140389

Conversation

@TheLizzard

@TheLizzard TheLizzard commented Oct 20, 2025

Copy link
Copy Markdown

Description

IDLE doesn't have a horizontal scrollbar but that shouldn't stop the user from using their trackpad/touchpad to horizontally scroll the text. This is a small bug that can sometimes annoy people

Previously

If you try to scroll horizontally using a trackpad/touchpad, the text in IDLE would scroll vertically.

Summary of changes

  • Fixed IDLE's scrolling event handling (by respecting the direction embedded in the <tkinter.Event>.state)
  • Added test cases to avoid regression in the future

Testing

I tested the issue and the fix on: Windows 11, Ubuntu 24.04 and Debian 13. The issue appears on all OSes and the fix works on all of them. While I am not 100% sure if this will break on MacOS, I am very confident that there will be no problems.

Fixes #140389

@TheLizzard

Copy link
Copy Markdown
Author

Sorry for the typos I made in the tests I created and wasting GitHub resources. I was sure I ran them but I must have screwed up. Fixed them now and they should work.

@python python deleted a comment from hsnabrahymhsn62-cmyk Oct 22, 2025
@python python deleted a comment from hsnabrahymhsn62-cmyk Oct 22, 2025

@StanFromIreland StanFromIreland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm with manual testing that the patch does implement horizontal scrolling with a touchpad on Unix.

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label May 1, 2026
wheel_event() and its tests moved from idlelib.tree to idlelib.util in
pythonGH-156974, so the horizontal scrolling change is re-applied there.
@serhiy-storchaka

Copy link
Copy Markdown
Member

I merged main into this branch to resolve the conflicts: gh-154511 (GH-156974) moved wheel_event() and its tests from idlelib.tree to idlelib.util, so the horizontal scrolling change is now applied there, with the tests in test_util.WheelEventTest. A second commit uses multicall.MC_SHIFT instead of the raw bit 1, and a third documents how Tk reports horizontal scrolling.

For the record, the Shift check is enough on every Tk we support: Tk 9 reports horizontal scrolling as <Shift-MouseWheel> on all systems, and since 8.6.10 X11 reports the horizontal wheel buttons 6/7 as <Shift-Button-4>/<Shift-Button-5> (Tk ticket 5da1d76e01); <Button-6> cannot even be bound in 8.6.

I have no strong opinion about this feature, but no objections either. I leave the decision to @terryjreedy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IDLE: touchpad horizontal scrolling not working

4 participants