Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Julien Palard Newsgroups: gnu.bash.bug Subject: Cursor can land before the prompt after calling beginning-of-line Date: Wed, 08 Jan 2020 09:13:32 +0000 Lines: 66 Approved: bug-bash@gnu.org Message-ID: References: Reply-To: Julien Palard NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1578475728 5036 209.51.188.17 (8 Jan 2020 09:28:48 GMT) X-Complaints-To: action@cs.stanford.edu To: "bug-bash@gnu.org" Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=palard.fr; s=protonmail; t=1578474816; bh=nAHqp/N8XCMo6dxyCBIRy/K/czxD/V7qLRaZqaLj0K0=; h=Date:To:From:Reply-To:Subject:Feedback-ID:From; b=KUakXWiiqPoJBZHLa977+BiFM9RXfFwwNfUca2s8cLTA1Fu5On5lGIAKgG3+gZ3M1 d/lIsyaXMCSFp2RJ04oWGIdG9MFARA/IROT1l5dlnwMZkm++/BsGofSf+hPdwKRO+n 6KkNCO4CwGm39FNH4mlmTEFaGyEgifF2GOJ+OxK0= Feedback-ID: xLmgcmt-7YcZHfPbKjAcE9hqRIBdgjiY0E9ywet2lByQDdGWgPEkeuia08-XIoVWUINSDzo2_yfT5xLg44friA==:Ext:ProtonMail X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.70.40.134 X-Mailman-Approved-At: Wed, 08 Jan 2020 04:28:45 -0500 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com gnu.bash.bug:15792 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 th= e 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) After (1) you should see (I'm using =E2=96=A0 to mark the place of the curs= or) which is OK: bash-5.0$ printf "Hello World\n Hello World bash-5.0$ =E2=96=A0 After (2) you should see (still OK): bash-5.0$ printf "Hello World\n " Hello World bash-5.0$ printf "Hello World\n = "=E2=96=A0 After (3) you should see (not OK): bash-5.0$ printf "Hello World\n " Hello World =E2=96=A0 bash-5.0$ printf "Hello World\n = " The cursor should not go that far, it should stop on the `p` of `printf`. I straced and played a bit with, and noted a few interesting things: - Bug appear, or not, depending on the length of the prompt (happen with sh= ort prompts, bug disapear with long prompts) - Bug appear, or not, depending on the length of the command (happend with = long commands, bug disapear with short commands) - Bug appear, or not, depending on the width of the terminal - When beginning-of-line calls `write(2, "\r\33[C\33[C\33[C\33[C\33[C...` I= have the bug - When beginning-of-line calls `write(2, "\10\10\10\10\10\10\10\10\10...` I= don't have the bug It can be reproduced without using spaces: mdk@seraph:~$ printf "Hello World\n01234567890123456789" Hello World 01234567890123456789mdk@seraph:~$ printf "Hello World\n0123456789012345= 6789" ^ The point jumps here (on the 2nd 4) Cross-posted here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D9483= 43 --=C2=A0 Julien Palard https://mdk.fr