python / python/cpython

IDLE: touchpad horizontal scrolling not working

Open
#140,389 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-IDLE type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

I know that there isn't a horizontal scrollbar for a reason but I believe that horizontally scrolling on a touchpad/trackpad should still scroll the IDLE editor horizontally. Right now trying to horizontally scroll a file, scrolls it vertically which I find very counter intuitive. The reason for this behaviour is in Lib/idlelib/tree.py (which is used in Lib/idlelib/editor.py):

def wheel_event(event, widget=None):
    ...
    up = {EventType.MouseWheel: event.delta > 0,
          EventType.ButtonPress: event.num == 4}
    lines = -5 if up[event.type] else 5
    widget = event.widget if widget is None else widget
    widget.yview(SCROLL, lines, 'units')
    return 'break'

The function doesn't respect the direction of scrolling and instead just scrolls vertically (yview). I know this is a minor bug but it's annoying me so much when IDLE tries to scroll vertically when I am scrolling horizontally

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux, Windows

Linked PRs
  • gh-140390

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Lib/idlelib/tree.py at wheel_event(), then check how it is used by Lib/idlelib/editor.py. Confirm how touchpad direction is represented in the supported event types; done means horizontal touchpad scrolling moves the IDLE editor horizontally instead of vertically on Linux and Windows.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.