-
Notifications
You must be signed in to change notification settings - Fork 524
Question: where is the code to limit the length of the shown prompt(PS1) #43

Description
Hi. My intention is to make sure the displayed prompt in mc doesn't exceed half the line(let's say) as to avoid typing the commands into a small area of 5 chars long.
If someone could point me to the location in the source code which handles this, I'd be grateful, as searching for PS1 in the entire source tree didn't help find anything.
Take for example, I have a bash prompt(*1) which shows on 3 lines in bash, and only shows the last line on mc - this is perfect because the last line contains the current folder in the prompt.
So in mc looks like this:
for the current folder(pwd):
/home/emacs/coostomhuston/texts/system/manjaro/bugs/mmc_cardreader
the mc prompt is:
cd "/home/emacs/coostomhuston/texts/system/manjaro/bugs/mmc_cardreader"&
in bash, the prompt's last line looks like this:
cd "/home/emacs/coostomhuston/texts/system/manjaro/bugs/mmc_cardreader"&&
so the last two chars in mc are cut out.
this gives, in mc, only 4 chars of space to enter the command and when typing the 5th char, the entire 5 char command is shifter and now only last 2 chars are showing - kinda hard to see what was typed and what the command really is especially when going back with C-p (although there is M-h , the editing of the existing command is tough)
but for a different pwd, the prompt shows differently:
pwd:
/home/emacs/coostomhuston/system/manjaro/home/emacs
in mc, the prompt shows as:
cd "/home/emacs/coostomhuston/system/manjaro/home/emacs"&&
For pwd:
/home/emacs/coostomhuston/system/manjaro/home/emacs/temporary_sandbox_play
mc prompt is:
&
(yep, last two chars only)
Going even deeper, pwd:
/home/emacs/coostomhuston/system/manjaro/home/emacs/temporary_sandbox_play/kernel_scrollback_patch_tests
the prompt in mc is:
ernel_scrollback_patch_tests"&&
(*1) this is the bash prompt PS1 env value is this: https://github.com/emanueLczirai/coostomhuston/blob/16c9bf7e1e145a7bae1bfddf136c316cf5e3e6d5/system/manjaro/home/emacs/.bashrc#L141