bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-readline] Disable the "modify history with arrow keys" feature


From: frederik
Subject: Re: [Bug-readline] Disable the "modify history with arrow keys" feature
Date: Tue, 29 Jan 2019 00:20:39 -0800
User-agent: NeoMutt/20180716

It seems like the behavior that John is requesting is reasonable and
intuitive.

I note that Zsh has the desired behavior, if that is an option.

However, if Bash already has a facility for reverting all history undo
lists, then it would seem to be easy to simply trigger this by default
before showing a new prompt, thereby restoring all history lines to
their original states. Am I missing something?

Frederick

On Tue, Jan 29, 2019 at 03:59:53PM +0800, 林自均 wrote:
Hi Chet,

Thank you for the explanation. I tried "revert-all-at-newline", but it's
not what I wanted. What I wish is:

1. Use arrow key to navigate to a history command (e.g., "echo 5566").
2. Modify the command (e.g., change to "echo 7788").
3. Instead of hitting enter to execute it, use arrow keys to navigate to
other commands.
4. Ctrl+C
5. The history is NOT modified (i.e., "echo 5566" WON'T BE CHANGED to "echo
7788").

Is that possible?

Best,
John Lin

Chet Ramey <address@hidden> 於 2019年1月29日 週二 上午12:02寫道:

On 1/28/19 2:05 AM, 林自均 wrote:
> Hi,
>
> When I am using bash, I found that bash has the following behavior:
>
> 1. Use arrow key to navigate to a history command (e.g., "echo 5566").
> 2. Modify the command (e.g., change to "echo 7788").
> 3. Instead of hitting enter to execute it, use arrow keys to navigate to
> other commands.
> 4. Ctrl+C
> 5. The history is modified (e.g., "echo 5566" is changed to "echo 7788").
>
> This feature bothers me a lot since I don't expect that I can modify
> history in such obscure method. Especially the fact that step 3 above is
> necessary to modify the history makes me feel so weird.

This is pretty well baked in to how readline operates. While the history
entry is modified, it has an individual entry-specific undo list, and all
changes are reverted if you hit return (you can also run the undo list on
demand). If you want every line with an undo list to be reverted whenever
readline returns, set the variable `revert-all-at-newline'.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/


_______________________________________________
Bug-readline mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-readline




reply via email to

[Prev in Thread] Current Thread [Next in Thread]