(Former VTE developer here) A terminal emulator's job is to execute the precise instructions it receives from the connected application (e.g. bash), and in this case, VTE does that correctly. It's bash (or some other readline app) that asks the terminal to print the prompt over and over again, and VTE does so.
There's one thing that VTE does differently than some other terminal emulators, though. Upon resizing the width, it rewraps the contents. I'd argue that this "rewrap on resize" is the single best improvement VTE received during the last decade, it improves the experience of using the terminal so much... well, improves the experience except for the shell prompt. What happens is: The terminal rewraps the existing lines on a resize, and then the shell (which is notified by the resize) assumes that the terminal did not rewrap the lines and it reprints the prompt according to this assumption. Unfortunately this assumption is false, the cursor is not where bash believes it to be, and thus reprinting the prompt goes wrong. (Note: This feature was released in VTE in spring 2014. Since then, there was one particular bash version (4.3 or 4.4, can't recall) that didn't reprint its prompt when the window got resized, therefore the bug didn't occur there.) What could be done to fix this situation? In GNOME Terminal you can disable rewrapping on resize. In dconf-editor navigate to /org/gnome/terminal/legacy/profiles: followed by the Profile ID, there you'll find the config option. While it fixes the prompt's behavior, you'll notice that it also modifies the behavior on earlier lines to a less fortunate one. In case anyone would suggest that VTE should do some "magic": try to figure out if the last line is a shell prompt, and rewrap everything except that last line: No, any approach like this would lead to an utter chaos that is fragile, somewhat working (but there'd always be cases that are still handled incorrectly), different in every terminal, unmaintainable... No, not going to happen. So, what would be the real solution? The only real solution is for bash/readline to introduce the possibility (config option) to assume that the terminal has already rewrapped the lines, thus it doesn't need to reprint the prompt (or if it wishes to reprint then takes into account the rewrapping that has already happened). VTE is not the only terminal out there rewrapping the lines on resize. It wasn't the first one to do this, and wasn't the last one to add this feature either. More and more terminals can do this, and for every newly appearing terminal emulator engine this behavior is pretty much the expectation nowadays. bash needs to catch up with this widespread change that happened in the terminal world. -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to bash in Ubuntu. https://bugs.launchpad.net/bugs/1927063 Title: Terminal prompt got strangely replicated when resizing terminal horizontally Status in bash package in Ubuntu: Confirmed Status in gnome-terminal package in Ubuntu: Confirmed Status in mate-terminal package in Ubuntu: Confirmed Status in readline package in Ubuntu: Confirmed Status in tilix package in Ubuntu: Confirmed Status in vte2.91 package in Ubuntu: Confirmed Bug description: Steps to reproduce: 1. Have Ubuntu installed 2. Launch MATE Terminal 3. Navigate to some folder with long name - `cd /usr/share/doc/ayatana-indicator-application` 4. Resize terminal horizontally Expected results: * terminal shows the same "user@host:/usr/share/doc/ayatana-indicator-application$" with single occurrence Actual results: * terminal shows multiple occurrencies of "user@host:/usr/share/doc/ayatana-indicator-application$" (see attached screencast) ProblemType: Bug DistroRelease: Ubuntu 21.04 Package: mate-terminal 1.24.1-1 ProcVersionSignature: Ubuntu 5.11.0-16.17-generic 5.11.12 Uname: Linux 5.11.0-16-generic x86_64 ApportVersion: 2.20.11-0ubuntu65 Architecture: amd64 CasperMD5CheckResult: pass CurrentDesktop: MATE Date: Tue May 4 10:54:59 2021 InstallationDate: Installed on 2021-04-23 (10 days ago) InstallationMedia: Ubuntu-MATE 21.04 "Hirsute Hippo" - Release amd64 (20210420) SourcePackage: mate-terminal UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1927063/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp