Re: [bug][patch] Doing ":redraw" during external command causes strange screen state

2016-10-14 Fir de Conversatie Bram Moolenaar

Ozaki Kiichi wrote:

> > Isn't this a bit too drastic?  When termcap_active it should still be
> > possible to output text (e.g. from another timer command).
> > 
> > Also check msg_use_printf().  Looks like your change overrules its own
> > check for termcap_active.
> 
> Hmm, yes. I think we should suppress updating screen while
> doing stoptermcap() ~ starttermcap() (i.e termcap_active == FALSE).
> 
> Can we check termcap_active only in specific screen-updating functions
> (update_screen, or some), or should not do such?

Check the calls to screen_valid().  An explicit check at some of them
that termcap_active is FALSE should help.

We should perhaps also update must_redraw when bailing out.
It's needed when invoked from ex_redraw().

-- 
To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass is twice as big as it needs to be.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [bug][patch] Doing ":redraw" during external command causes strange screen state

2016-10-14 Fir de Conversatie Ozaki Kiichi
> Isn't this a bit too drastic?  When termcap_active it should still be
> possible to output text (e.g. from another timer command).
> 
> Also check msg_use_printf().  Looks like your change overrules its own
> check for termcap_active.

Hmm, yes. I think we should suppress updating screen while
doing stoptermcap() ~ starttermcap() (i.e termcap_active == FALSE).

Can we check termcap_active only in specific screen-updating functions
(update_screen, or some), or should not do such?

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [bug][patch] Doing ":redraw" during external command causes strange screen state

2016-10-13 Fir de Conversatie Bram Moolenaar

Ozaki Kiichi wrote:

> 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"
> 
> 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

Isn't this a bit too drastic?  When termcap_active it should still be
possible to output text (e.g. from another timer command).

Also check msg_use_printf().  Looks like your change overrules its own
check for termcap_active.

-- 
   [Another hideous roar.]
BEDEVERE: That's it!
ARTHUR:   What?
BEDEVERE: It's The Legendary Black Beast of Arrggghhh!
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[bug][patch] Doing ":redraw" during external command causes strange screen state

2016-10-13 Fir de Conversatie Ozaki Kiichi
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"

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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.