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    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to