As far as I conformed, Vim hides cursor by cursor_off() right before back to 
prompt.

Collateral evidence: (I confirmed on Ubuntu 16.04)

1) TERM=ansi vim --clean

't_ve' and 't_vi' are empty

2) TERM=xterm vim --clean

't_ve' is '^[[?12l^[[?25h', 't_vi' is '^[[?25l' (both are not empty)

3) set TERM=ansi and 't_ve' and 't_vi':

TERM=ansi vim --clean
:let &t_ve = "\e[?25h"
:let &t_vi = "\e[?25l"
:terminal

then cursor may be invisible.

4) set TERM=xterm and 't_ve' and 't_vi' clear:

TERM=xterm vim --clean
:set t_vi=
:terminal

then cursor may be visible.


I propose this patch:

https://gist.github.com/ichizok/9dafd126bb6f6d5f79878a18f5665e6f

Note: `out_flush()` should not be in `if (term->tl_cursor_visible)` clause.

There is a problem about cursor position and display in the following case:

cursor.c (toggle cursor visibility)

```c
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char const* argv[])
{
    char *const show = "\e[?25h";
    char *const hide = "\e[?25l";
    const char *s = show;
    if (argc > 1) {
        if (strcmp(argv[1], "on") == 0) {
            s = show;
        } else if (strcmp(argv[1], "off") == 0) {
            s = hide;
        } else {
            fprintf(stderr, "Usage: %s [on|off]\n", argv[0]);
            return 1;
        }
    }
    write(1, s, strlen(s));
    return 0;
}
```

gcc -o cursor cursor.c
vim --clean -c terminal

and execute './cursor off' on terminal buffer, then it occurs descrepancy 
between cursor and input position.

Thank you.
Ozaki Kiichi

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui