Re: bash 4.4.18 return to new line

2018-02-04 Thread Chet Ramey
On 2/4/18 11:31 AM, Alexander Kozlenkov wrote:
> Ok. But I not understand, because my PS1 work well in bash-4.3.30 and
> failed in bash-4.4.18.

Luck.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: bash 4.4.18 return to new line

2018-02-04 Thread Alexander Kozlenkov
Ok. But I not understand, because my PS1 work well in bash-4.3.30 and
failed in bash-4.4.18.
--
Best regards
Alexandr Kozlenkov

вс, 4 февр. 2018 г. в 18:34, Chet Ramey :

> On 2/4/18 10:09 AM, Alexander Kozlenkov wrote:
> > I bracketed \[ and \] each prompt variables and simple symbols and line
> > break does work right.
> > Example:
> >> \[\e[1;32m\]\u\[\e[m\]\[\e[1;32m\]@\[\e[m\]\[\e[1;32m\]\h\[\e[m\]
> > But if I bracketed sequences some symbols, line break does not work .
> > Example:
> >>  \[\e[1;32m\]\u@\h\[\e[m\]
>
> You need to identify non-printing sequences so readline knows the visible
> length of the prompt and can accurately calculate the cursor position.
>
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/
>


Re: bash 4.4.18 return to new line

2018-02-04 Thread Chet Ramey
On 2/4/18 10:09 AM, Alexander Kozlenkov wrote:
> I bracketed \[ and \] each prompt variables and simple symbols and line
> break does work right.
> Example:
>> \[\e[1;32m\]\u\[\e[m\]\[\e[1;32m\]@\[\e[m\]\[\e[1;32m\]\h\[\e[m\]
> But if I bracketed sequences some symbols, line break does not work .
> Example:
>>  \[\e[1;32m\]\u@\h\[\e[m\]

You need to identify non-printing sequences so readline knows the visible
length of the prompt and can accurately calculate the cursor position.


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: bash 4.4.18 return to new line

2018-02-04 Thread Alexander Kozlenkov
I bracketed \[ and \] each prompt variables and simple symbols and line
break does work right.
Example:
> \[\e[1;32m\]\u\[\e[m\]\[\e[1;32m\]@\[\e[m\]\[\e[1;32m\]\h\[\e[m\]
But if I bracketed sequences some symbols, line break does not work .
Example:
>  \[\e[1;32m\]\u@\h\[\e[m\]

And thanks for You help!
--
Best regards
Alexandr Kozlenkov

вс, 4 февр. 2018 г. в 2:04, Chet Ramey :

> On 2/3/18 2:21 AM, Alexander Kozlenkov wrote:
> > I changed my PS1 to:
> > (cmd):09:37:53:sah4ez@PC001:~$ printenv PS1
> > \e[1;95m\t\]\e[0m:\]\e[0;92m\u@\h\]\e[0m:\]\e[0;34m\w\a\]\]\e[0m$ \]
>
> The output of printenv indicates that you have non-printing characters in
> PS1 that are not bracketed by \[ and \]. In fact, there don't seem to be
> any \[ sequences in the prompt string at all (and you have two \] in a
> row?).
>
> The mode strings appear to be properly bracketed using \1 and \2.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/
>


Re: bash 4.4.18 return to new line

2018-02-02 Thread Alexander Kozlenkov
I changed my PS1 to:
(cmd):09:37:53:sah4ez@PC001:~$ printenv PS1
\e[1;95m\t\]\e[0m:\]\e[0;92m\u@\h\]\e[0m:\]\e[0;34m\w\a\]\]\e[0m$ \]

But line break still does not work:
ff09:37:56:sah4ez@PC001:~$
f

Else I have the file:
$ cat ~/.inputrc
set show-mode-in-prompt on
set vi-ins-mode-string \1\e[32;1m\2(ins)\1\e[0m:\2
set vi-cmd-mode-string \1\e[34;1m\2(cmd)\1\e[0m:\2

If I removed this '~/.inpurtrc' file, and set to PS1:
\t:\u@\h:\w\a$
Line break continues does not work:
7:05:sah4ez@PC001:~$
fff

As you can see number of 'f' letters changed after which began input from
start line.

пт, 2 февр. 2018 г. в 22:41, Chet Ramey :

> On 2/2/18 2:39 PM, Alexander Kozlenkov wrote:
> > $ printenv PS1
> > \e[1;95m\t\e[0m:\[\e]0;\u@\h:
> > \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@
> \h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
>
> There are a bunch of invisible characters at the beginning of the prompt
> that aren't enclosed in \[ and \]. That will throw off the cursor location
> calculations.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/
>


Re: bash 4.4.18 return to new line

2018-02-02 Thread Chet Ramey
On 2/2/18 2:39 PM, Alexander Kozlenkov wrote:
> $ printenv PS1
> \e[1;95m\t\e[0m:\[\e]0;\u@\h:
> \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$

There are a bunch of invisible characters at the beginning of the prompt
that aren't enclosed in \[ and \]. That will throw off the cursor location
calculations.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: bash 4.4.18 return to new line

2018-02-02 Thread Alexander Kozlenkov
$ printenv PS1
\e[1;95m\t\e[0m:\[\e]0;\u@\h:
\w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$


$ uname -a
Linux PC001 4.8.0-58-generic #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC
2017 x86_64 x86_64 x86_64 GNU/Linux

$ bash --version
GNU bash, версия 4.4.18(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.

And today I connect to remote server via command:
$ shh usern...@remote.server.com
And when I navigate over history (in vi-mode press 'k' key) cursor position
move after '@' and navigation to left position don't work. But when I press
'I' key (insert before first symbol of line) cursor position not change
(after '@') and next I entering something or removed symbols, cursor
position move to real position (first symbol in line).
Example:
$ ssh username@(*cursor here*)remote.server.com
# press 'I'
$ ssh username@(*cursor here*)remote.server.com
# press right and remove first symbol
$ (*cursor here*)sh usern...@remote.server.com
--
Best regards
Aleksandr Kozlenkov

пт, 2 февр. 2018 г. в 22:13, Chet Ramey :

> On 2/2/18 7:42 AM, Alexander Kozlenkov wrote:
> > Hello!
> > Thanks for your project!
> > On days I did building bash v4.4.18 for using vi-ins-mode-string and
> > vi-cmd-mode-string variables in VI mode (insert and command modes).
> > But, when I print long string, line break don't work for the first input
> > line:
> > > (ins):15:30:03:sah4ez@PC001:~/git/bash-4.4.18$
> > > 1115:24:36:sah4ez@PC001:~/git/bash-4.4.18$
> > 11
> >
> > When I print more symbols, line break work well.
>
> What's your $PS1?
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/
>


Re: bash 4.4.18 return to new line

2018-02-02 Thread Chet Ramey
On 2/2/18 7:42 AM, Alexander Kozlenkov wrote:
> Hello!
> Thanks for your project!
> On days I did building bash v4.4.18 for using vi-ins-mode-string and
> vi-cmd-mode-string variables in VI mode (insert and command modes).
> But, when I print long string, line break don't work for the first input
> line:
> > (ins):15:30:03:sah4ez@PC001:~/git/bash-4.4.18$
> > 1115:24:36:sah4ez@PC001:~/git/bash-4.4.18$
> 11
> 
> When I print more symbols, line break work well.

What's your $PS1?

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/