[Bug 282364] /bin/sh Adding new lines into PS1 causes visual glitches

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 27 Oct 2024 17:21:33 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282364

            Bug ID: 282364
           Summary: /bin/sh Adding new lines into PS1 causes visual
                    glitches
           Product: Base System
           Version: 14.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: adrieljc@gmail.com

Adding new lines into PS1 causes visual glitches when using /bin/sh.


~/.shrc

```
export PS1='\[\n \] \u \[\n \] # ❭❭❭❭❭❭❭❭❭❭❭❭ '

# csh like history on arrow up and down
bind "^[[A" ed-search-prev-history
bind "^[[B" ed-search-next-history
```

example commands:

type this and enter it into history

```
ls /var/log/
```

Now type ls and hit the up arrow, you will see a large gap between "ls" and
/var/log.

```
root
# ❭❭❭❭❭❭❭❭❭❭❭❭ ls      /var/log/
```

It seems to me that the text before PS1 new lines are added to the the current
line which gives
a weird gap to the shells prompt output. If you modify the command after its
been inserted the spacing
glitch gets worse and worse and it becomes impossible to see what commands you
are typing.

expected behaviour:

New lines in PS1 should work as csh,bash, zsh and not have weird spacing and
visual glitches.

-- 
You are receiving this mail because:
You are the assignee for the bug.