bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Escape sequences in vi-ins-mode-string


From: Chet Ramey
Subject: Re: Escape sequences in vi-ins-mode-string
Date: Wed, 24 Apr 2019 10:18:13 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 4/23/19 3:54 PM, Joshua O'Connor wrote:
> Hi,
> 
> I'm trying to have my cursor change within Bash depending on the vi mode I'm 
> in.
> To accomplish this I've used:
>       > vi-ins-mode-string = "\1\e[6 q\2"
> and a corresponding vi-cmd-mode-string in .inputrc, which has indeed worked.

Yes, this is the documented way to do it.

> However when using the tmux terminal multiplexer it fails to work, with
> similar behaviour in vim.
> From reading online it appears one must wrap such escape sequences inside a
> tmux escape sequence to pass it through
>       > \ePtmux;\e ..... \e\\
> where ..... represents the escape sequence to be passed.

OK, so it's something like "\ePtmux\1\e[6..." and tmux strips out the
escape sequence?

> 
> Using this method does indeed fix vim, and it does indeed in Bash too,
> which suggests something is happening.
> However a new issue arises, when scrolling up in the bash history, some
> characters become "stuck" and remain displayed despite the actual text not
> being there any longer.
> 
> This behaviour seems to be well known, and is usually resolved by correctly
> escaping out zero-width characters in one's PS1 prompt with \[ and \].

That's the equivalent to what you're doing with \1 and \2 above.

Are these characters at the end of the displayed line (or beyond the end of
the line?) If so, I suspect that there's a problem with the clear-to-end-
of-line that readline is using. I don't use tmux, though, so I've never
seen it in that context.


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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]