Skip to content

Overlaping long command line #8

Closed
@lucgiffon

Description

@lucgiffon

Hello,
I've experienced an issue that I didn't notice first:
When using the classic $(context-color) command for customizing my prompt like this:

PS1='[\d \A] \[\e[31m\]\u\[\e[0m\]@\[\e[0m\]$(context-color -c hostname)\h\[\e[0m\]:\w\\$ '

The prompt always used 1 line for big command lines; E.g long lines are wrapped around themselves, meaning that the new line overlaps the previous one. So the terminal wasn't usable anymore.

I figured this was a classic issue with PS1 customization and it is because the colour code wasn't wrapped inside brackets as in \[\e[31m\] where the colour code \e[31m is wrapped inside \[ \]. So to sort this problem out I just changed $(context-color -c hostname) to \[$(context-color -c hostname)\] and it worked fine.

I don't know if this is normal and expected behavior?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions