Title: IDLE: Better support history navigation
Type: enhancement Stage:
Components: IDLE Versions: Python 3.10
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: epaine, terry.reedy, wyz23x2
Priority: normal Keywords:

Created on 2020-06-22 11:16 by wyz23x2, last changed 2020-08-03 09:39 by epaine.

Messages (7)
msg372085 - (view) Author: wyz23x2 (wyz23x2) * Date: 2020-06-22 11:16
Terminals like CMD have support of navigating through commands with ↑↓. While directly implementing the arrows is not good in IDLE (the use for jumping to the prev. line in GUI is needed), there should be a good way.
Some ways:
1. Alt+↑↓. The current behavior is exactly like ↑↓.
2. A "Previous input" option in the right-click menu.
3. A "Navigate" option in the right-click menu. A GUI like this will pop up:
┃        Navigate        ┃
┃  × The [4]th command   ┃
┃  O [1] command before  ┃
┃        _______         ┃
┃        ┃Paste┃         ┃
┃        ———————         ┃

It would be better if 2&3 are together.
msg372089 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-06-22 13:33
There is an old issue proposing making ↑↓ navigate through history in Shell, with cntl/alt ↑↓, for instance, navigating through lines.  

In the meanwhile, one is supposed to be able to redefine the abstract <history-next> and <history-previous> keys in the Keys tab of the settings dialog.  For instance, to Alt-Down and Alt-Up.  However, it is not currently working as I expect and I need to investigate more.

A new history list mechanism is a possibility, but I would want to first change Shell to only add syntactically correct entries to the permanent list.  One should be able to edit a statement until it is correct, just as when trying to run from the editor.  This would reduce the need to retrieve history by perhaps half (depending on one's syntax knowledge and typing accuracy).
msg372101 - (view) Author: E. Paine (epaine) * Date: 2020-06-22 16:32
The issue I found, which I assume you are referencing Terry, is #2704. Even if we don't do all of what is proposed there, I think the default bindings for the history should be changed (I have not used any terminals that don't use ↑↓).

In my experience, very few people know of the history functionality (especially people new to Python - which is IDLE's main audience) and even many of those who teach Python don't know about it!

As for the other features suggested, I am not sure about a "previous input" option in the right-click menu, though it may be nice to have a separate history for commands and inputs (I didn't look that closely at 2704 so it is possible this is proposed there). I am not sure I understand the feature proposed in '3'.
msg372295 - (view) Author: wyz23x2 (wyz23x2) * Date: 2020-06-25 00:50
Doesn't work? The <history-next> and <history-previous> work perfectly in 3.8.3!
Th problem now is that only very few people know it. There should be a clearer way.
msg374670 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-08-01 20:23
History and up/down is apart of #2704.  It has patches that include the up/down change, but I don't expect to use any of them as they are.

I tried Shift/Control/Alt - Up/Down and none worked.  Rebinding just Up/Down did (in Shell only, leaving up/down unchanged in Editor).  But not having up/down work to move between lines in the Shell multiline statement entry area is not acceptable to me.  I don't know if modifiers can never work with up/down or if there is something that would make it work.
msg374671 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-08-01 20:26
Yes, history works fine with the current bindings to alt-p and alt-n, or with binding to up or down, but not with binding to modifier-up/down.
msg374729 - (view) Author: E. Paine (epaine) * Date: 2020-08-03 09:39
> but not with binding to modifier-up/down.

I cannot reproduce. I have tested on both Windows and Linux and found I could successfully change to (and use) the modifier-up/down bindings both through the Keys page of the configdialog and by editing the keys def. There was no traceback on either platform. @wyz23x2, can you reproduce this problem?

My personal preference for the new bindings, when tested, was alt-up/down as it is most similar to the existing bindings. Also, control-up/down is used in other apps for moving the cursor multiple lines at a time and shift-up/down (at least in my mind) seems like a weird/random choice. Terry, I don't know what you have in mind, but I think these bindings should be in addition to the existing ones rather than instead of (I also tested this and found it to work correctly).
Date User Action Args
2020-08-03 09:39:54epainesetmessages: + msg374729
2020-08-01 20:29:20terry.reedysetnosy: + epaine
2020-08-01 20:26:06terry.reedysetmessages: + msg374671
2020-08-01 20:23:46terry.reedysetstatus: closed -> open

title: Make support of navigating through prev. commands in IDLE more conspicuous -> IDLE: Better support history navigation
nosy: - epaine
versions: - Python 3.8, Python 3.9
messages: + msg374670
stage: resolved ->
2020-07-10 08:43:09wyz23x2setstatus: open -> closed
stage: resolved
2020-06-25 00:50:58wyz23x2setmessages: + msg372295
title: Add support of navigating through prev. commands in IDLE -> Make support of navigating through prev. commands in IDLE more conspicuous
2020-06-22 16:32:41epainesetnosy: + epaine
messages: + msg372101
2020-06-22 13:33:51terry.reedysetmessages: + msg372089
2020-06-22 11:16:27wyz23x2create