bug-bash
[Top][All Lists]
Advanced

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

Re: Cursor can land before the prompt after calling beginning-of-line


From: Chet Ramey
Subject: Re: Cursor can land before the prompt after calling beginning-of-line
Date: Wed, 8 Jan 2020 09:35:48 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.3.1

On 1/8/20 4:13 AM, Julien Palard wrote:
It can be reproduced on Debian bullseye with bash 5.0.11 on urxvt and xterm and 
by a friend on MacOS with bash 3.2.57.

With this procedure I'm able to reproduce it consistently:

- Move ~/.bashrc elsewhere just to start clean
- Start a new terminal (in my case tput cols tells it's 79 columns, beware, the 
bug varies according to the terminal width).
- run `bash --norc` in it, to start clean
- Prompt in my case is `bash-5.0$ `, beware, the bug varies according to the 
length of the prompt.
- type `printf "Hello World\n                    "` (1)
- hit the `uparrow` of your keyboard to see the printf again (2)
- hit C-a (bash shortcut for beginning-of-line) (3)

Readline assumes it starts in column 0. If it doesn't know the physical
screen position of the cursor when it starts, it can't make correct
decisions about redisplay. Sometimes it wants to go to the beginning of
the line and redraw/erase characters, sometimes it wants to move backwards
and do it, but all these decisions assume that it knows where it is on
the line.

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



reply via email to

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