Skip to content

Preserve space in variables#216

Merged
certik merged 8 commits intoprefix-dev:mainfrom
certik:space
Jan 30, 2025
Merged

Preserve space in variables#216
certik merged 8 commits intoprefix-dev:mainfrom
certik:space

Conversation

@certik
Copy link
Collaborator

@certik certik commented Jan 29, 2025

Now it adds two spaces, for some reason:

~/repos/shell(space)$ echo "X${PS1}X"
X{display_cwd}{git_branch}$  X
~/repos/shell(space)$ PS1="${PS1}"
~/repos/shell(space)$  x

But the PR is in the right direction.

Fixes #215.

@certik
Copy link
Collaborator Author

certik commented Jan 29, 2025

This now works:

PS1="${PS1}"

But this still fails:

PS1="${PS1:-}"

@certik
Copy link
Collaborator Author

certik commented Jan 30, 2025

Both now work.

@certik certik marked this pull request as ready for review January 30, 2025 00:07
@certik
Copy link
Collaborator Author

certik commented Jan 30, 2025

This fixes bugs to allow $PS1 to work well. The changes are small and isolated, so I am going to merge it. We can improve it later if needed.

@certik certik merged commit 7241944 into prefix-dev:main Jan 30, 2025
6 checks passed
@certik certik deleted the space branch January 30, 2025 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

White space at the end of variables is sometimes trimmed

1 participant

Comments