[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature request for PS0
From: |
Alex fxmbsw7 Ratchev |
Subject: |
Re: Feature request for PS0 |
Date: |
Tue, 8 Feb 2022 03:05:58 +0100 |
it may mangle data
it mangled the paste
PS0=$'\e[1A\e[K$time \e[s\n' PS1=$'' PROMPT_COMMAND='printf -v time
"%(%F-%T)T" ${EPOCHREALTIME%.*}' ; trap $'[[ $BASH_COMMAND != "printf
-v time "* ]] && { cmd=$BASH_COMMAND; IFS=$\'[;\' read -r -d R -p
$\'\\e[6n\' none line char ; printf \'\\e[u%s\e[%d;%dH\' "$cmd"
"$line" "$char" ; }' debug
On Tue, Feb 8, 2022 at 3:04 AM Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:
>
> PS0=$'\e[1A\e[K$time \e[s\n' PS1=$'' PROMPT_COMMAND='printf -v time
> "%(%F-%T)T" ${EPOCHREALTIME%.*}' ; trap $'[[ $BASH_COMMAND != "printf
> -v time "* ]] && { cmd=$BASH_COMMAND; IFS=$\'[;\' read -r -d R -p
> 2022-02-08-03:04:31
> 2022-02-08-03:04:33 ls
> bl5 bl5e bl5.tgz t xbl5 xbl5.750763197 xbl5e xbl5e.3881483953
> xbl5.tgz xft xft.tgz
> 2022-02-08-03:04:35 uptime
> 03:04:37 up 2:17, 0 users, load average: 0.00, 0.00, 0.00
>
> On Mon, Feb 7, 2022 at 8:13 PM Akbarkhon Variskhanov
> <akbarkhon.variskhanov@gmail.com> wrote:
> >
> > Hello.
> >
> > Would it be possible to add an option or easy configuration of where PS0 is
> > placed? I really want to have PS0 appear side-by-side with PS1 but in front
> > of it, so that the whole command line looks like this after having been
> > read:
> > ~ echo "Hello, Wo # not finished typing
> > ~ echo "Hello, World!" # finished typing, pressing Enter
> > 21:39:44 ~ echo "Hello, World!"
> > Hello, World!
> > The default behavior is:
> > ~ echo "Hello, World!"
> > 21:39:44
> > Hello, World!
> >
> > CSI sequences such as \033[A, \033[F or term caps like cuu and tput cuu1
> > only work for single-row command lines. As soon as pipelines, multiple
> > arguments or long command lines are involved, everything gets scrambled.
> > See this thread for details:
> > https://ubuntuforums.org/showthread.php?t=2471634
> >
> > Thanks.