Operating System - HP-UX
1748145 Members
3645 Online
108758 Solutions
New Discussion юеВ

Command Prompt get truncated to 80 chars whenever recall command using ESC-k

 
JLiYim
Occasional Advisor

Command Prompt get truncated to 80 chars whenever recall command using ESC-k

Hi,

I have set the command prompt (PS1) to show the current working directory and am currently using vi to recall command history.

However, if my prompt is greater than 80 chars, it will be truncated to 80 chars when I recall the previous command using ESC-k. My screen width is 150 chars and it is really annoying and confusing when this happens.

Is there a way to prevent this from happening?

Thanks,
John
12 REPLIES 12
Pete Randall
Outstanding Contributor

Re: Command Prompt get truncated to 80 chars whenever recall command using ESC-k

John,

I just tried it with a 100 character (bogus) command and got all 100 characters back. I had to scroll to the right to see them, but they were there. I'm using an HPTerm on CDE with 11.11 (PA-RISC flavored), and "set -o vi" + "export HISTFILE=" to get command line editing.


Pete

Pete
Andreas Voss
Honored Contributor

Re: Command Prompt get truncated to 80 chars whenever recall command using ESC-k

Hi,

try this command to set the current window size environment:

eval $(resize)

Regards
Sanjay Kumar Suri
Honored Contributor

Re: Command Prompt get truncated to 80 chars whenever recall command using ESC-k

Have you tried using following to edit the command?

h : move cursor one character to left
l : move cursor one character to right

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
JLiYim
Occasional Advisor

Re: Command Prompt get truncated to 80 chars whenever recall command using ESC-k

It's not the command that gets truncated. It is the command prompt ... You can test this by going to a directory path that is greater than 80 chars with your command prompt set to display the current directory (export PS1='$PWD >>').

eval $(resize) does not work.
Pete Randall
Outstanding Contributor

Re: Command Prompt get truncated to 80 chars whenever recall command using ESC-k

Oh, I see. In that case, you've got me. I would find having a command prompt of varying width (let alone greater than 80 characters!) far more disconcerting!

Sorry I couldn't help.


Pete

Pete
Stephen Keane
Honored Contributor

Re: Command Prompt get truncated to 80 chars whenever recall command using ESC-k

This appears to be a limitation/feature of the command prompt PS1 rather than the pwd command. If you set PS1 to a long string, it only displays the right hand 80 characters.
Sanjay Kumar Suri
Honored Contributor

Re: Command Prompt get truncated to 80 chars whenever recall command using ESC-k

Check this link (last 20 lines):

http://www.nersc.no/~knutal/unix_tips.html


sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
JLiYim
Occasional Advisor

Re: Command Prompt get truncated to 80 chars whenever recall command using ESC-k

This does not happen on CYGWIN and I wonder whether other UNIX platforms (SUN/IBM/Linux) have the same issue.

Anybody who has worked on Oracle E-Business Suite knows that some directory paths can easily be more than 80 chars and this is one of the reason why I set the window's width to be 140 or more.

I do not think that is is an issue with PS1 as this does not happen when I use emacs as the command editor.
JLiYim
Occasional Advisor

Re: Command Prompt get truncated to 80 chars whenever recall command using ESC-k

Correction ... it does happen when I use emacs but only when I use CTRL-L. If I just use CTRL-P and CTRL-N, the command prompt remain unchanged.