Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea8835f

Browse files
bpo-34047: IDLE: fix mousewheel scrolling direction on macOS (GH-8678)
(cherry picked from commit077059e)Co-authored-by: Tal Einat <taleinat+github@gmail.com>
1 parent5641081 commitea8835f

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

‎Lib/idlelib/editor.py‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,12 +457,19 @@ def handle_yview(self, event, *args):
457457
return'break'
458458

459459
defmousescroll(self,event):
460-
"Handle scroll wheel."
461-
up= {EventType.MouseWheel:event.delta>=0==darwin,
460+
"""Handle scrollwheel event.
461+
462+
For wheel up, event.delta = 120*n on Windows, -1*n on darwin,
463+
where n can be > 1 if one scrolls fast. Flicking the wheel
464+
generates up to maybe 20 events with n up to 10 or more 1.
465+
Macs use wheel down (delta = 1*n) to scroll up, so positive
466+
delta means to scroll up on both systems.
467+
468+
X-11 sends Control-Button-4 event instead.
469+
"""
470+
up= {EventType.MouseWheel:event.delta>0,
462471
EventType.Button:event.num==4}
463-
lines=5
464-
ifup[event.type]:
465-
lines=-lines
472+
lines=-5ifup[event.type]else5
466473
self.text.yview_scroll(lines,'units')
467474
return'break'
468475

@@ -1701,7 +1708,11 @@ def _editor_window(parent): # htest #
17011708
filename=None
17021709
macosx.setupApp(root,None)
17031710
edit=EditorWindow(root=root,filename=filename)
1704-
edit.text.bind("<<close-all-windows>>",edit.close_event)
1711+
text=edit.text
1712+
text['height']=10
1713+
foriinrange(20):
1714+
text.insert('insert',' '*i+str(i)+'\n')
1715+
# text.bind("<<close-all-windows>>", edit.close_event)
17051716
# Does not stop error, neither does following
17061717
# edit.text.bind("<<close-window>>", edit.close_event)
17071718

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed mousewheel scrolling direction on macOS.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp