Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Tianon Gravi Newsgroups: gnu.bash.bug Subject: Multi-line Prompt/PS1 wrapping oddly Date: Fri, 12 Jul 2019 13:40:15 -0700 Lines: 35 Approved: bug-bash@gnu.org Message-ID: References: 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 1562967967 17028 209.51.188.17 (12 Jul 2019 21:46:07 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=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=llWhBq3dpETjcLXlJr0N65vHyBe7pEKEXdDQmKdnfbk=; b=pf0+IPzKUX2EoAQxjoGRT1zU1UPLLbuEi2ZbFil4pzbSIK5EE2yyFjdnzemq0QEFzG yQ6HrjW9skV63WFlu9gC9Mfay+gvsxKiuhlWK0er1tJMSn5Z07AU4l++GKhbnPJc71cj 1N2PhQeV9ClldzC3ZrPA0xIiH3lF4k8jSYy7eotJyH6WUmLj5oqJNFU667j9LH8H1jFN vqzI85dY2VNMxHWQnviQTAHs6cZNwzZhDT8e5Xjl7d79lUEab+EvhODzCmFvh3PgpyCz q9eBA1eT+pbTCTepfIMxdBq0GwCXNsKA9kDsS0Un5Mh1yKJNnMwO8FS4lI2/MspLzSlm hRGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=llWhBq3dpETjcLXlJr0N65vHyBe7pEKEXdDQmKdnfbk=; b=eM8ZXKkEyenW6y37ZaVZdFIePLNsEUjMsWM3I75LXOgnw9H2S++A9t82vgfebx4xHI TTvOQ+FQGGlO45NB78PQE5meKR0M4wvhfMVPNptnNW/HXuEFxMXsu5p4W/DaEOJbBEOE O30mEZT6wPKgw5vh1wTRkDs95CGKsPzeyyo8bDx0vepzcnBKcQgFCZukKGJuMVT93NpM rEidCD1hlVLY1mWX/ao6yjj7WR+0dqhKwNGROe16GVW1SemOoxUPUjUohgDNCKyWDpGW 300xh12LKGLJyrECerzJIxwxyCyyJwkqkkYbOQZgaskHuFzM2gONm88/ar8+GeTF8x5O 8qmw== X-Gm-Message-State: APjAAAWiciTsiQmjPnUckB1+jY7wGDAqgM/evYtgi/9E/+d2zL7wBmdy 5hsc/YrfRaR2IoFiDskVPZZ2JpBeDbI53p7ryiBpeCte X-Google-Smtp-Source: APXvYqybelePkIIr1PqKaC7urkRiIO/eBhyOP8MSw16c1KxOUtmVhT3gQErYwzW3ixAoG9VZ8izzQcwIwknB/t4YGSc= X-Received: by 2002:a2e:9e81:: with SMTP id f1mr7063056ljk.29.1562964027295; Fri, 12 Jul 2019 13:40:27 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::230 X-Mailman-Approved-At: Fri, 12 Jul 2019 17:46:06 -0400 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:15155 I cannot reproduce on Bash 4.4.23, but I can reproduce on all of Bash 5.0.3 (Debian's) Bash 5.0.7 and ea578790a910fcd394930de7a1933a9ee24f9119 from the "devel" branch ("commit bash-20190705 snapshot"). I'm on Linux and can reproduce both in my host's install of Bash (Debian Buster), and inside containers (which is how I've tested various Bash versions to reproduce). I can also reproduce in all of xfce4-terminal, gnome-terminal, and terminology (in trying to make sure it really was Bash and not a quirk of the terminal). Bash in Debian is likely compiled via GCC 8.3.0, my Bash 5.0.7 was compiled via GCC 8.3.0 in Alpine 3.9, and my Bash from devel was compiled via GCC 8.3.0 in Alpine 3.10. What I've found is that if PS1 contains '\n' and the last line gets long enough for the cursor to be on the next line (for example, if \w gets too long), then typing will result in a single character being printed in the correct place followed by the cursor being moved to the next line. I've found the simplest way to test is to have a small terminal (I use 80x24) and set PS1 to something long (and it reproduces with or without special characters, colors, or even \w, \h, \u, etc). My current testing value is PS1=3D'\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa= aaaaaaaaaaaaaaaaaa$ '. I've also recorded a short asciinema to help illustrate more clearly: https://asciinema.org/a/zaOBmlbs01VlPfuBPpcswQ3vm =E2=99=A5, - Tianon 4096R / B42F 6819 007F 00F8 8E36 4FD4 036A 9C25 BF35 7DD4