Hi.

Doing ":redraw" during external command causes strange screen state and cursor 
position.

[repro steps]

test.vim

----
" for clarity of screen state
colorscheme morning
syntax on

function! Callback(timer) abort
    redraw
    "quit
endfunction

call timer_start(1000, 'Callback')
:!ls
----

vim -Nu NONE -S test.vim

starting, after ":!ls" and ":redraw" in timer callback:
cursor is positioned on the right of "help version7<Enter>"

https://cloud.githubusercontent.com/assets/18260849/17743470/cadaca1e-64de-11e6-9c95-cd3a0f5111a3.png

entering insert mode:
"~" of empty line prefix isn't drawn.

https://cloud.githubusercontent.com/assets/18260849/17743478/cfacf242-64de-11e6-922d-0411f7a59c5e.png

quiting:
intro remains.

https://cloud.githubusercontent.com/assets/18260849/17743483/d48c6e1e-64de-11e6-9d77-a96709b15c4c.png

[cause/detail]

Terminal goes into inconsistent state.

normal sequence of executing external command:
----
do_shell
  stoptermcap // switch to normal screen buffer (T_TE [DECRST 1049]), 
termcap_active=FALSE
  call_shell
    mch_call_shell
      settmode(TMODE_COOK)
      [:!ls]
      settmode(TMODE_RAW)
  wait_return
  starttermcap // switch to alt-screen buffer (T_TI [DECSET 1049]), 
termcap_active=TRUE
----

case-1: this problem
----
do_shell
  stoptermcap // switch to normal screen buffer
  call_shell
  (snip)
  wait_return
    (firing timer)
       ex_redraw // draw intro on normal (NOT alt-) screen buffer
    (waiting key-input)
  starttermcap // switch to alt-screen buffer
  (snip)
  // on exiting, restore to normal screen buffer (== intro)
----

case-2: uncommenting ":quit" in callback
----
do_shell
  stoptermcap // switch to normal screen buffer
  call_shell
  (snip)
  wait_return
    (timer発火)
      ex_redraw // draw intro on normal (NOT alt-) screen buffer
      ex_quit
        getout
          (exit) // :quit
----

[patch]

- check "termcap_active" in screen_valid(), except GUI.
(on GUI, this prevents executing external command)

https://gist.github.com/ichizok/4fe3853dbc7cc2e67c4a994e59fc5ee8

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