Hi!

----

I've been digging around in some reports of problems with the
"multiline" editor mode:

1. The first problem happens when the edit line becomes longer than the
terminal's width and the terminal cursor is not at position 0 when PS1
is send to the terminal.
For example: The user does a $ printf "foo"<enter> - in this case the
prompt starts at position 3 instead of 0. If the user enters a command
which is longer than the terminal width and then removes enougth
charcters that the edit line fits again into one line the "foo" at the
beginning will be overwritten with the prompt.

AFAIK a simple workaround is to add $(printf "%*s\r%s" COLUMNS "") at
the beginning of PS1, this causes the shell to move to the beginning of
the next line if the terminal cursor is not at position 0.

2. If the user uses a prompt with escape sequences (e.g. a colored
prompt as described in
http://mail.opensolaris.org/pipermail/shell-discuss/2007-October/001017.html
, e.g. $ export
PS1="$'\E[31m''$USERNAME'$'\E[0m'@$'\E[1;31m''$HOSTNAME'$'\E[0m':"$'\E[1;34m''$PWD'"
$'\E[0m'# " #) the multiline code gets confused because there is a
difference in the number of characters printed on the terminal and the
terminal cursor movement in the X direction.

Both problems quickly boil-down to the issue that the shell doesn't
track the real X position of the terminal cursor and just makes
assumptions where it may currently reside... ;-(

... does anyone know whether there is a way to query the terminal for
the position without resorting to heavywheight stuff like
libcurses/libreadline ?

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [EMAIL PROTECTED]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to