Skip to content

Commit 5ff3a16

Browse files
authored
bpo-21474: Update IDLE word/identifier definition from ascii to unicode. (GH-6643)
In text and entry boxes, this affects selection by double-click, movement left/right by control-left/right, and deletion left/right by control-BACKSPACE/DEL.
1 parent c1a6832 commit 5ff3a16

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Lib/idlelib/editor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,12 +1658,12 @@ def get_accelerator(keydefs, eventname):
16581658

16591659

16601660
def fixwordbreaks(root):
1661-
# Make sure that Tk's double-click and next/previous word
1662-
# operations use our definition of a word (i.e. an identifier)
1661+
# On Windows, tcl/tk breaks 'words' only on spaces, as in Command Prompt.
1662+
# We want Motif style everywhere. See #21474, msg218992 and followup.
16631663
tk = root.tk
16641664
tk.call('tcl_wordBreakAfter', 'a b', 0) # make sure word.tcl is loaded
1665-
tk.call('set', 'tcl_wordchars', '[a-zA-Z0-9_]')
1666-
tk.call('set', 'tcl_nonwordchars', '[^a-zA-Z0-9_]')
1665+
tk.call('set', 'tcl_wordchars', r'\w')
1666+
tk.call('set', 'tcl_nonwordchars', r'\W')
16671667

16681668

16691669
def _editor_window(parent): # htest #
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Update word/identifier definition from ascii to unicode. In text and entry
2+
boxes, this affects selection by double-click, movement left/right by
3+
control-left/right, and deletion left/right by control-BACKSPACE/DEL.

0 commit comments

Comments
 (0)