Skip to content

Commit 4a32275

Browse files
authored
gh-72284: Revise lists in IDLE doc (#114174)
Tkinter is a fact, not necessarily a feature. Reorganize editor key bindings in a logical order and remove those that do not work, at least on Windows. Improve shell bindings list.
1 parent e07a400 commit 4a32275

File tree

4 files changed

+60
-79
lines changed

4 files changed

+60
-79
lines changed

Doc/library/idle.rst

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ IDLE is Python's Integrated Development and Learning Environment.
1818

1919
IDLE has the following features:
2020

21-
* coded in 100% pure Python, using the :mod:`tkinter` GUI toolkit
22-
2321
* cross-platform: works mostly the same on Windows, Unix, and macOS
2422

2523
* Python shell window (interactive interpreter) with colorizing
@@ -422,41 +420,34 @@ and that other files do not. Run Python code with the Run menu.
422420
Key bindings
423421
^^^^^^^^^^^^
424422

425-
In this section, 'C' refers to the :kbd:`Control` key on Windows and Unix and
426-
the :kbd:`Command` key on macOS.
427-
428-
* :kbd:`Backspace` deletes to the left; :kbd:`Del` deletes to the right
429-
430-
* :kbd:`C-Backspace` delete word left; :kbd:`C-Del` delete word to the right
431-
432-
* Arrow keys and :kbd:`Page Up`/:kbd:`Page Down` to move around
433-
434-
* :kbd:`C-LeftArrow` and :kbd:`C-RightArrow` moves by words
423+
The IDLE insertion cursor is a thin vertical bar between character
424+
positions. When characters are entered, the insertion cursor and
425+
everything to its right moves right one character and
426+
the new character is entered in the new space.
435427

436-
* :kbd:`Home`/:kbd:`End` go to begin/end of line
428+
Several non-character keys move the cursor and possibly
429+
delete characters. Deletion does not puts text on the clipboard,
430+
but IDLE has an undo list. Wherever this doc discusses keys,
431+
'C' refers to the :kbd:`Control` key on Windows and
432+
Unix and the :kbd:`Command` key on macOS. (And all such dicussions
433+
assume that the keys have not been re-bound to something else.)
437434

438-
* :kbd:`C-Home`/:kbd:`C-End` go to begin/end of file
435+
* Arrow keys move the cursor one character or line.
439436

440-
* Some useful Emacs bindings are inherited from Tcl/Tk:
437+
* :kbd:`C-LeftArrow` and :kbd:`C-RightArrow` moves left or right one word.
441438

442-
* :kbd:`C-a` beginning of line
439+
* :kbd:`Home` and :kbd:`End` go to the beginning or end of the line.
443440

444-
* :kbd:`C-e` end of line
441+
* :kbd:`Page Up` and :kbd:`Page Down` go up or down one screen.
445442

446-
* :kbd:`C-k` kill line (but doesn't put it in clipboard)
443+
* :kbd:`C-Home` and :kbd:`C-End` go to beginning or end of the file.
447444

448-
* :kbd:`C-l` center window around the insertion point
445+
* :kbd:`Backspace` and :kbd:`Del` (or :kbd:`C-d`) delete the previous
446+
or next character.
449447

450-
* :kbd:`C-b` go backward one character without deleting (usually you can
451-
also use the cursor key for this)
448+
* :kbd:`C-Backspace` and :kbd:`C-Del` delete one word left or right.
452449

453-
* :kbd:`C-f` go forward one character without deleting (usually you can
454-
also use the cursor key for this)
455-
456-
* :kbd:`C-p` go up one line (usually you can also use the cursor key for
457-
this)
458-
459-
* :kbd:`C-d` delete next character
450+
* :kbd:`C-k` deletes ('kills') everything to the right.
460451

461452
Standard keybindings (like :kbd:`C-c` to copy and :kbd:`C-v` to paste)
462453
may work. Keybindings are selected in the Configure IDLE dialog.
@@ -611,23 +602,18 @@ when one requests a restart on the Shell menu, or when one runs code
611602
in an editor window.
612603

613604
The editing features described in previous subsections work when entering
614-
code interactively. IDLE's Shell window also responds to the following keys.
615-
616-
* :kbd:`C-c` interrupts executing command
617-
618-
* :kbd:`C-d` sends end-of-file; closes window if typed at a ``>>>`` prompt
619-
620-
* :kbd:`Alt-/` (Expand word) is also useful to reduce typing
605+
code interactively. IDLE's Shell window also responds to the following:
621606

622-
Command history
607+
* :kbd:`C-c` attemps to interrupt statement execution (but may fail).
623608

624-
* :kbd:`Alt-p` retrieves previous command matching what you have typed. On
625-
macOS use :kbd:`C-p`.
609+
* :kbd:`C-d` closes Shell if typed at a ``>>>`` prompt.
626610

627-
* :kbd:`Alt-n` retrieves next. On macOS use :kbd:`C-n`.
611+
* :kbd:`Alt-p` and :kbd:`Alt-n` (:kbd:`C-p` and :kbd:`C-n` on macOS)
612+
retrieve to the current prompt the previous or next previously
613+
entered statement that matches anything already typed.
628614

629-
* :kbd:`Return` while the cursor is on any previous command
630-
retrieves that command
615+
* :kbd:`Return` while the cursor is on any previous statement
616+
appends the latter to anything already typed at the prompt.
631617

632618
Text colors
633619
^^^^^^^^^^^

Lib/idlelib/News3.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Released on 2024-10-xx
44
=========================
55

66

7+
gh-72284: Improve the lists of features, editor key bindings,
8+
and shell key bingings in the IDLE doc.
9+
710
gh-113903: Fix rare failure of test.test_idle, in test_configdialog.
811

912
gh-113729: Fix the "Help -> IDLE Doc" menu bug in 3.11.7 and 3.12.1.

Lib/idlelib/help.html

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ <h3>Navigation</h3>
226226
<p>IDLE is Python’s Integrated Development and Learning Environment.</p>
227227
<p>IDLE has the following features:</p>
228228
<ul class="simple">
229-
<li><p>coded in 100% pure Python, using the <a class="reference internal" href="tkinter.html#module-tkinter" title="tkinter: Interface to Tcl/Tk for graphical user interfaces"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tkinter</span></code></a> GUI toolkit</p></li>
230229
<li><p>cross-platform: works mostly the same on Windows, Unix, and macOS</p></li>
231230
<li><p>Python shell window (interactive interpreter) with colorizing
232231
of code input, output, and error messages</p></li>
@@ -547,30 +546,26 @@ <h3>Editor windows<a class="headerlink" href="#editor-windows" title="Permalink
547546
</section>
548547
<section id="key-bindings">
549548
<h3>Key bindings<a class="headerlink" href="#key-bindings" title="Permalink to this heading"></a></h3>
550-
<p>In this section, ‘C’ refers to the <kbd class="kbd docutils literal notranslate">Control</kbd> key on Windows and Unix and
551-
the <kbd class="kbd docutils literal notranslate">Command</kbd> key on macOS.</p>
549+
<p>The IDLE insertion cursor is a thin vertical bar between character
550+
positions. When characters are entered, the insertion cursor and
551+
everything to its right moves right one character and
552+
the new character is entered in the new space.</p>
553+
<p>Several non-character keys move the cursor and possibly
554+
delete characters. Deletion does not puts text on the clipboard,
555+
but IDLE has an undo list. Wherever this doc discusses keys,
556+
‘C’ refers to the <kbd class="kbd docutils literal notranslate">Control</kbd> key on Windows and
557+
Unix and the <kbd class="kbd docutils literal notranslate">Command</kbd> key on macOS. (And all such dicussions
558+
assume that the keys have not been re-bound to something else.)</p>
552559
<ul class="simple">
553-
<li><p><kbd class="kbd docutils literal notranslate">Backspace</kbd> deletes to the left; <kbd class="kbd docutils literal notranslate">Del</kbd> deletes to the right</p></li>
554-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Backspace</kbd></kbd> delete word left; <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Del</kbd></kbd> delete word to the right</p></li>
555-
<li><p>Arrow keys and <kbd class="kbd docutils literal notranslate">Page Up</kbd>/<kbd class="kbd docutils literal notranslate">Page Down</kbd> to move around</p></li>
556-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">LeftArrow</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">RightArrow</kbd></kbd> moves by words</p></li>
557-
<li><p><kbd class="kbd docutils literal notranslate">Home</kbd>/<kbd class="kbd docutils literal notranslate">End</kbd> go to begin/end of line</p></li>
558-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Home</kbd></kbd>/<kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">End</kbd></kbd> go to begin/end of file</p></li>
559-
<li><p>Some useful Emacs bindings are inherited from Tcl/Tk:</p>
560-
<ul>
561-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">a</kbd></kbd> beginning of line</p></li>
562-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">e</kbd></kbd> end of line</p></li>
563-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">k</kbd></kbd> kill line (but doesn’t put it in clipboard)</p></li>
564-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">l</kbd></kbd> center window around the insertion point</p></li>
565-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">b</kbd></kbd> go backward one character without deleting (usually you can
566-
also use the cursor key for this)</p></li>
567-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">f</kbd></kbd> go forward one character without deleting (usually you can
568-
also use the cursor key for this)</p></li>
569-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd> go up one line (usually you can also use the cursor key for
570-
this)</p></li>
571-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd></kbd> delete next character</p></li>
572-
</ul>
573-
</li>
560+
<li><p>Arrow keys move the cursor one character or line.</p></li>
561+
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">LeftArrow</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">RightArrow</kbd></kbd> moves left or right one word.</p></li>
562+
<li><p><kbd class="kbd docutils literal notranslate">Home</kbd> and <kbd class="kbd docutils literal notranslate">End</kbd> go to the beginning or end of the line.</p></li>
563+
<li><p><kbd class="kbd docutils literal notranslate">Page Up</kbd> and <kbd class="kbd docutils literal notranslate">Page Down</kbd> go up or down one screen.</p></li>
564+
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Home</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">End</kbd></kbd> go to beginning or end of the file.</p></li>
565+
<li><p><kbd class="kbd docutils literal notranslate">Backspace</kbd> and <kbd class="kbd docutils literal notranslate">Del</kbd> (or <cite>C-d</cite>) delete the previous or
566+
next character.</p></li>
567+
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Backspace</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Del</kbd></kbd> delete one word left or right.</p></li>
568+
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">k</kbd></kbd> deletes (‘kills’) everything to the right.</p></li>
574569
</ul>
575570
<p>Standard keybindings (like <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd></kbd> to copy and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">v</kbd></kbd> to paste)
576571
may work. Keybindings are selected in the Configure IDLE dialog.</p>
@@ -697,20 +692,15 @@ <h3>Shell window<a class="headerlink" href="#shell-window" title="Permalink to t
697692
when one requests a restart on the Shell menu, or when one runs code
698693
in an editor window.</p>
699694
<p>The editing features described in previous subsections work when entering
700-
code interactively. IDLE’s Shell window also responds to the following keys.</p>
701-
<ul>
702-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd></kbd> interrupts executing command</p></li>
703-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd></kbd> sends end-of-file; closes window if typed at a <code class="docutils literal notranslate"><span class="pre">&gt;&gt;&gt;</span></code> prompt</p></li>
704-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">/</kbd></kbd> (Expand word) is also useful to reduce typing</p>
705-
<p>Command history</p>
695+
code interactively. IDLE’s Shell window also responds to the following:</p>
706696
<ul class="simple">
707-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd> retrieves previous command matching what you have typed. On
708-
macOS use <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd>.</p></li>
709-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd></kbd> retrieves next. On macOS use <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd></kbd>.</p></li>
710-
<li><p><kbd class="kbd docutils literal notranslate">Return</kbd> while the cursor is on any previous command
711-
retrieves that command</p></li>
712-
</ul>
713-
</li>
697+
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd></kbd> attemps to interrupt statement execution (but may fail).</p></li>
698+
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd></kbd> closes Shell if typed at a <code class="docutils literal notranslate"><span class="pre">&gt;&gt;&gt;</span></code> prompt.</p></li>
699+
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd></kbd> (<kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd></kbd> on macOS)
700+
retrieve to the current prompt the previous or next previously
701+
entered statement that matches anything already typed.</p></li>
702+
<li><p><kbd class="kbd docutils literal notranslate">Return</kbd> while the cursor is on any previous statement
703+
appends the latter to anything already typed at the prompt.</p></li>
714704
</ul>
715705
</section>
716706
<section id="text-colors">
@@ -1190,7 +1180,7 @@ <h3>Navigation</h3>
11901180
<br />
11911181
<br />
11921182

1193-
Last updated on Jan 16, 2024 (16:17 UTC).
1183+
Last updated on Jan 17, 2024 (06:57 UTC).
11941184
<a href="/bugs.html">Found a bug</a>?
11951185
<br />
11961186

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Improve the lists of features, editor key bindings, and shell key bingings
2+
in the IDLE doc.

0 commit comments

Comments
 (0)