summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2018-04-30 07:08:01 (GMT)
committerGitHub <noreply@github.com>2018-04-30 07:08:01 (GMT)
commit5ff3a161c8a6b525c5e5b3e36e9c43f5a95bda60 (patch)
treebcb9e2038f38b5642de35157f62f027e86b9d112
parentc1a6832f50b36ffec299e6e6038535904e2b158d (diff)
downloadcpython-5ff3a161c8a6b525c5e5b3e36e9c43f5a95bda60.zip
cpython-5ff3a161c8a6b525c5e5b3e36e9c43f5a95bda60.tar.gz
cpython-5ff3a161c8a6b525c5e5b3e36e9c43f5a95bda60.tar.bz2
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.
-rw-r--r--Lib/idlelib/editor.py8
-rw-r--r--Misc/NEWS.d/next/IDLE/2018-04-29-16-13-02.bpo-21474.bglg-F.rst3
2 files changed, 7 insertions, 4 deletions
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py
index ab9c7e6..892b64b 100644
--- a/Lib/idlelib/editor.py
+++ b/Lib/idlelib/editor.py
@@ -1658,12 +1658,12 @@ def get_accelerator(keydefs, eventname):
def fixwordbreaks(root):
- # Make sure that Tk's double-click and next/previous word
- # operations use our definition of a word (i.e. an identifier)
+ # On Windows, tcl/tk breaks 'words' only on spaces, as in Command Prompt.
+ # We want Motif style everywhere. See #21474, msg218992 and followup.
tk = root.tk
tk.call('tcl_wordBreakAfter', 'a b', 0) # make sure word.tcl is loaded
- tk.call('set', 'tcl_wordchars', '[a-zA-Z0-9_]')
- tk.call('set', 'tcl_nonwordchars', '[^a-zA-Z0-9_]')
+ tk.call('set', 'tcl_wordchars', r'\w')
+ tk.call('set', 'tcl_nonwordchars', r'\W')
def _editor_window(parent): # htest #
diff --git a/Misc/NEWS.d/next/IDLE/2018-04-29-16-13-02.bpo-21474.bglg-F.rst b/Misc/NEWS.d/next/IDLE/2018-04-29-16-13-02.bpo-21474.bglg-F.rst
new file mode 100644
index 0000000..caf640b
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2018-04-29-16-13-02.bpo-21474.bglg-F.rst
@@ -0,0 +1,3 @@
+Update word/identifier definition from ascii to unicode. 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.