Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command wrapping too early #74

Open
apprehensions opened this issue Mar 19, 2023 · 5 comments
Open

command wrapping too early #74

apprehensions opened this issue Mar 19, 2023 · 5 comments

Comments

@apprehensions
Copy link

on a stock build of suckless's st, the command wrapping begins very early (this has been extremely annoying for me, and i wish i can fucking disable this), and i'm not sure why.

on a OpenBSD system, using the same terminal, this issue does not occur.

@ibara
Copy link
Owner

ibara commented Mar 19, 2023

What OS are you on?

@apprehensions
Copy link
Author

...Linux? ncurses 6.4-1 oksh 7.2-1

@167rgc911
Copy link

oksh-7.2-r0
ncurses-6.3_p20221119-r0
on AlpineLinux and this issue does not occur
i also use dwm and st (i am in monocle layout so my cmdline is wide)

what is the output of 'set' from the cmdline?

CHARSET=UTF-8
COLUMNS=194
DISPLAY=:0

mind the 'COLUMNS' env var

@apprehensions
Copy link
Author

The issue might be that ksh is failing to update when to wrap. Try to have the window starting in a small position then extend the window, you will then see that it will wrap very early, according to the window's geometry when ksh first started.

Maybe that it gets the columns and height once but doesn't check again.

@username-null101
Copy link

username-null101 commented Jun 25, 2023

Found the fix, I had this problem too

By looking through the man page, under the PS1 section, the escape chars '\[' and '\]' are for turning off character count and turning back on respectively(default behavior), so depending on how long is your prompt you will want to put the '\[' at the beggining and the '\]' to certain point, like a range of chars that the shell will ignore, for example my PS1 is:
PS1="\[\033[01;32m@\033[01;33m\W\033[01;36m--\033[01;35m$(ls -A | wc -l)\]\033[01;33m ; "

I turned off the char count from the beginning and turned it back on after the ls command and that solved my problem

If i had specified the range of my whole prompt, then when you type, it breaks to the next line but then when you delete what you typed, it will not go back to the previous line, so thats why you will have to test a proper range with your prompt.

Hope this helps.
(Had to edit the comment because the escape chars were not showing).

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

No branches or pull requests

4 participants