Patch 9.0.0318
Problem:    Clearing screen causes flicker.
Solution:   Do not clear but redraw in more cases.  Add () to "wait_return".
Files:      src/getchar.c, src/drawscreen.c, src/if_cscope.c, src/ex_cmds.c,
            src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, src/main.c,
            src/memline.c, src/message.c, src/misc1.c, src/option.c,
            src/viminfo.c


*** ../vim-9.0.0317/src/getchar.c       2022-08-21 10:40:02.447904003 +0100
--- src/getchar.c       2022-08-29 14:29:14.532902332 +0100
***************
*** 2098,2104 ****
  
      // redraw the screen after getchar()
      if (p_ch == 0)
!       update_screen(UPD_CLEAR);
  
      set_vim_var_nr(VV_MOUSE_WIN, 0);
      set_vim_var_nr(VV_MOUSE_WINID, 0);
--- 2098,2104 ----
  
      // redraw the screen after getchar()
      if (p_ch == 0)
!       update_screen(UPD_NOT_VALID);
  
      set_vim_var_nr(VV_MOUSE_WIN, 0);
      set_vim_var_nr(VV_MOUSE_WINID, 0);
*** ../vim-9.0.0317/src/drawscreen.c    2022-08-29 13:44:24.162897357 +0100
--- src/drawscreen.c    2022-08-29 14:56:34.406244265 +0100
***************
*** 1930,1953 ****
            }
        }
  
!       // When starting redraw in the first line, redraw all lines.  When
!       // there is only one window it's probably faster to clear the screen
!       // first.
        if (mid_start == 0)
-       {
            mid_end = wp->w_height;
-           if (ONE_WINDOW && !WIN_IS_POPUP(wp))
-           {
-               // Clear the screen when it was not done by win_del_lines() or
-               // win_ins_lines() above, "screen_cleared" is FALSE or MAYBE
-               // then.
-               if (screen_cleared != TRUE)
-                   screenclear();
-               // The screen was cleared, redraw the tab pages line.
-               if (redraw_tabline)
-                   draw_tabline();
-           }
-       }
  
        // When win_del_lines() or win_ins_lines() caused the screen to be
        // cleared (only happens for the first window) or when screenclear()
--- 1930,1938 ----
            }
        }
  
!       // When starting redraw in the first line, redraw all lines.
        if (mid_start == 0)
            mid_end = wp->w_height;
  
        // When win_del_lines() or win_ins_lines() caused the screen to be
        // cleared (only happens for the first window) or when screenclear()
***************
*** 3183,3189 ****
  }
  
  /*
!  * Mark all windows to be redrawn later.
   */
      void
  redraw_all_later(int type)
--- 3168,3174 ----
  }
  
  /*
!  * Mark all windows to be redrawn later.  Except popup windows.
   */
      void
  redraw_all_later(int type)
***************
*** 3196,3201 ****
--- 3181,3200 ----
      set_must_redraw(type);
  }
  
+ #if 0  // not actually used yet, it probably should
+ /*
+  * Mark all windows, including popup windows, to be redrawn.
+  */
+     void
+ redraw_all_windows_later(int type)
+ {
+     redraw_all_later(type);
+ #ifdef FEAT_PROP_POPUP
+     popup_redraw_all();               // redraw all popup windows
+ #endif
+ }
+ #endif
+ 
  /*
   * Set "must_redraw" to "type" unless it already has a higher value
   * or it is currently not allowed.
*** ../vim-9.0.0317/src/if_cscope.c     2022-06-05 21:53:46.000000000 +0100
--- src/if_cscope.c     2022-08-29 14:40:24.652089802 +0100
***************
*** 2474,2480 ****
        }
      }
  
!     wait_return(TRUE);
      return CSCOPE_SUCCESS;
  }
  
--- 2474,2480 ----
        }
      }
  
!     wait_return(FALSE);
      return CSCOPE_SUCCESS;
  }
  
*** ../vim-9.0.0317/src/ex_cmds.c       2022-08-29 12:23:32.941653371 +0100
--- src/ex_cmds.c       2022-08-29 14:38:42.260243732 +0100
***************
*** 1151,1157 ****
  #if defined(FEAT_EVAL)
        if (!aborting())
  #endif
!           (void)semsg(_(e_cant_create_file_str), itmp);       // will call 
wait_return
        goto filterend;
      }
      if (curbuf != old_curbuf)
--- 1151,1158 ----
  #if defined(FEAT_EVAL)
        if (!aborting())
  #endif
!           // will call wait_return()
!           (void)semsg(_(e_cant_create_file_str), itmp);
        goto filterend;
      }
      if (curbuf != old_curbuf)
***************
*** 4331,4337 ****
                                                        // needed
                            msg_no_more = TRUE;
                            // write message same highlighting as for
!                           // wait_return
                            smsg_attr(HL_ATTR(HLF_R),
                                _("replace with %s (y/n/a/q/l/^E/^Y)?"), sub);
                            msg_no_more = FALSE;
--- 4332,4338 ----
                                                        // needed
                            msg_no_more = TRUE;
                            // write message same highlighting as for
!                           // wait_return()
                            smsg_attr(HL_ATTR(HLF_R),
                                _("replace with %s (y/n/a/q/l/^E/^Y)?"), sub);
                            msg_no_more = FALSE;
*** ../vim-9.0.0317/src/ex_cmds2.c      2022-08-25 15:11:11.396084550 +0100
--- src/ex_cmds2.c      2022-08-29 14:38:51.152230652 +0100
***************
*** 348,354 ****
      if (!(p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)))
  #endif
      {
!       // There must be a wait_return for this message, do_buffer()
        // may cause a redraw.  But wait_return() is a no-op when vgetc()
        // is busy (Quit used from window menu), then make sure we don't
        // cause a scroll up.
--- 348,354 ----
      if (!(p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)))
  #endif
      {
!       // There must be a wait_return() for this message, do_buffer()
        // may cause a redraw.  But wait_return() is a no-op when vgetc()
        // is busy (Quit used from window menu), then make sure we don't
        // cause a scroll up.
*** ../vim-9.0.0317/src/ex_docmd.c      2022-08-28 21:36:17.150095067 +0100
--- src/ex_docmd.c      2022-08-29 14:39:16.660192802 +0100
***************
*** 879,885 ****
                    , in_vim9script() ? GETLINE_CONCAT_CONTBAR
                                               : GETLINE_CONCAT_CONT)) == NULL)
            {
!               // Don't call wait_return for aborted command line.  The NULL
                // returned for the end of a sourced file or executed function
                // doesn't do this.
                if (KeyTyped && !(flags & DOCMD_REPEAT))
--- 879,885 ----
                    , in_vim9script() ? GETLINE_CONCAT_CONTBAR
                                               : GETLINE_CONCAT_CONT)) == NULL)
            {
!               // Don't call wait_return() for aborted command line.  The NULL
                // returned for the end of a sourced file or executed function
                // doesn't do this.
                if (KeyTyped && !(flags & DOCMD_REPEAT))
***************
*** 1355,1361 ****
        else if (need_wait_return)
        {
            /*
!            * The msg_start() above clears msg_didout. The wait_return we do
             * here should not overwrite the command that may be shown before
             * doing that.
             */
--- 1355,1361 ----
        else if (need_wait_return)
        {
            /*
!            * The msg_start() above clears msg_didout. The wait_return() we do
             * here should not overwrite the command that may be shown before
             * doing that.
             */
*** ../vim-9.0.0317/src/ex_getln.c      2022-08-29 12:40:56.877873407 +0100
--- src/ex_getln.c      2022-08-29 14:39:24.296181402 +0100
***************
*** 1666,1672 ****
      if (!cmd_silent)
      {
        i = msg_scrolled;
!       msg_scrolled = 0;               // avoid wait_return message
        gotocmdline(TRUE);
        msg_scrolled += i;
        redrawcmdprompt();              // draw prompt or indent
--- 1666,1672 ----
      if (!cmd_silent)
      {
        i = msg_scrolled;
!       msg_scrolled = 0;               // avoid wait_return() message
        gotocmdline(TRUE);
        msg_scrolled += i;
        redrawcmdprompt();              // draw prompt or indent
*** ../vim-9.0.0317/src/main.c  2022-08-22 15:19:12.732328943 +0100
--- src/main.c  2022-08-29 14:41:00.792033899 +0100
***************
*** 651,657 ****
  
      /*
       * When done something that is not allowed or given an error message call
!      * wait_return.  This must be done before starttermcap(), because it may
       * switch to another screen. It must be done after settmode(TMODE_RAW),
       * because we want to react on a single key stroke.
       * Call settmode and starttermcap here, so the T_KS and T_TI may be
--- 651,657 ----
  
      /*
       * When done something that is not allowed or given an error message call
!      * wait_return().  This must be done before starttermcap(), because it may
       * switch to another screen. It must be done after settmode(TMODE_RAW),
       * because we want to react on a single key stroke.
       * Call settmode and starttermcap here, so the T_KS and T_TI may be
***************
*** 1226,1232 ****
            did_check_timestamps = FALSE;
            if (need_check_timestamps)
                check_timestamps(FALSE);
!           if (need_wait_return)       // if wait_return still needed ...
                wait_return(FALSE);     // ... call it now
            if (need_start_insertmode && goto_im() && !VIsual_active)
            {
--- 1226,1232 ----
            did_check_timestamps = FALSE;
            if (need_check_timestamps)
                check_timestamps(FALSE);
!           if (need_wait_return)       // if wait_return() still needed ...
                wait_return(FALSE);     // ... call it now
            if (need_start_insertmode && goto_im() && !VIsual_active)
            {
*** ../vim-9.0.0317/src/memline.c       2022-08-28 22:17:46.298785791 +0100
--- src/memline.c       2022-08-29 14:41:13.368014285 +0100
***************
*** 822,828 ****
  
      if (*p_dir != NUL && mfp->mf_fname == NULL)
      {
!       need_wait_return = TRUE;        // call wait_return later
        ++no_wait_return;
        (void)semsg(_(e_unable_to_open_swap_file_for_str_recovery_impossible),
                    buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
--- 822,828 ----
  
      if (*p_dir != NUL && mfp->mf_fname == NULL)
      {
!       need_wait_return = TRUE;        // call wait_return() later
        ++no_wait_return;
        (void)semsg(_(e_unable_to_open_swap_file_for_str_recovery_impossible),
                    buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
*** ../vim-9.0.0317/src/message.c       2022-08-29 12:23:32.941653371 +0100
--- src/message.c       2022-08-29 14:42:05.611931874 +0100
***************
*** 94,100 ****
  /*
   * msg(s) - displays the string 's' on the status line
   * When terminal not initialized (yet) mch_errmsg(..) is used.
!  * return TRUE if wait_return not called
   */
      int
  msg(char *s)
--- 94,100 ----
  /*
   * msg(s) - displays the string 's' on the status line
   * When terminal not initialized (yet) mch_errmsg(..) is used.
!  * return TRUE if wait_return() not called
   */
      int
  msg(char *s)
***************
*** 631,637 ****
   * Rings the bell, if appropriate, and calls message() to do the real work
   * When terminal not initialized (yet) mch_errmsg(..) is used.
   *
!  * Return TRUE if wait_return not called.
   * Note: caller must check 'emsg_not_now()' before calling this.
   */
      static int
--- 631,637 ----
   * Rings the bell, if appropriate, and calls message() to do the real work
   * When terminal not initialized (yet) mch_errmsg(..) is used.
   *
!  * Return TRUE if wait_return() not called.
   * Note: caller must check 'emsg_not_now()' before calling this.
   */
      static int
***************
*** 758,764 ****
      attr = HL_ATTR(HLF_E);        // set highlight mode for error messages
      if (msg_scrolled != 0)
        need_wait_return = TRUE;    // needed in case emsg() is called after
!                                   // wait_return has reset need_wait_return
                                    // and a redraw is expected because
                                    // msg_scrolled is non-zero
  
--- 758,764 ----
      attr = HL_ATTR(HLF_E);        // set highlight mode for error messages
      if (msg_scrolled != 0)
        need_wait_return = TRUE;    // needed in case emsg() is called after
!                                   // wait_return() has reset need_wait_return
                                    // and a redraw is expected because
                                    // msg_scrolled is non-zero
  
***************
*** 2456,2462 ****
            {
  #endif
                inc_msg_scrolled();
!               need_wait_return = TRUE; // may need wait_return in main()
                redraw_cmdline = TRUE;
                if (cmdline_row > 0 && !exmode_active)
                    --cmdline_row;
--- 2456,2462 ----
            {
  #endif
                inc_msg_scrolled();
!               need_wait_return = TRUE; // may need wait_return() in main()
                redraw_cmdline = TRUE;
                if (cmdline_row > 0 && !exmode_active)
                    --cmdline_row;
***************
*** 3716,3723 ****
  
  /*
   * end putting a message on the screen
!  * call wait_return if the message does not fit in the available space
!  * return TRUE if wait_return not called.
   */
      int
  msg_end(void)
--- 3716,3723 ----
  
  /*
   * end putting a message on the screen
!  * call wait_return() if the message does not fit in the available space
!  * return TRUE if wait_return() not called.
   */
      int
  msg_end(void)
*** ../vim-9.0.0317/src/misc1.c 2022-08-26 22:36:32.480565634 +0100
--- src/misc1.c 2022-08-29 14:42:12.071921583 +0100
***************
*** 616,622 ****
  
      while (r != 'y' && r != 'n')
      {
!       // same highlighting as for wait_return
        smsg_attr(HL_ATTR(HLF_R), "%s (y/n)?", str);
        if (direct)
            r = get_keystroke();
--- 616,622 ----
  
      while (r != 'y' && r != 'n')
      {
!       // same highlighting as for wait_return()
        smsg_attr(HL_ATTR(HLF_R), "%s (y/n)?", str);
        if (direct)
            r = get_keystroke();
*** ../vim-9.0.0317/src/option.c        2022-08-26 16:41:10.037072416 +0100
--- src/option.c        2022-08-29 14:42:19.955909001 +0100
***************
*** 2184,2190 ****
            // make sure all characters are printable
            trans_characters(IObuff, IOSIZE);
  
!           ++no_wait_return;           // wait_return done later
            emsg((char *)IObuff);       // show error highlighted
            --no_wait_return;
  
--- 2184,2190 ----
            // make sure all characters are printable
            trans_characters(IObuff, IOSIZE);
  
!           ++no_wait_return;           // wait_return() done later
            emsg((char *)IObuff);       // show error highlighted
            --no_wait_return;
  
*** ../vim-9.0.0317/src/viminfo.c       2022-08-25 15:11:11.400084545 +0100
--- src/viminfo.c       2022-08-29 14:43:18.199815116 +0100
***************
*** 3095,3101 ****
        {
            int tt = msg_didany;
  
!           // avoid a wait_return for this message, it's annoying
            semsg(_(e_viminfo_file_is_not_writable_str), fname);
            msg_didany = tt;
            fclose(fp_in);
--- 3095,3101 ----
        {
            int tt = msg_didany;
  
!           // avoid a wait_return() for this message, it's annoying
            semsg(_(e_viminfo_file_is_not_writable_str), fname);
            msg_didany = tt;
            fclose(fp_in);
*** ../vim-9.0.0317/src/version.c       2022-08-29 13:44:24.166897355 +0100
--- src/version.c       2022-08-29 15:04:40.593006819 +0100
***************
*** 709,710 ****
--- 709,712 ----
  {   /* Add new patch number below this line */
+ /**/
+     318,
  /**/

-- 
To keep milk from turning sour: Keep it in the cow.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220829140853.EF0A21C07CD%40moolenaar.net.

Raspunde prin e-mail lui