]> granicus.if.org Git - vim/commitdiff
patch 9.0.0318: clearing screen causes flicker v9.0.0318
authorBram Moolenaar <Bram@vim.org>
Mon, 29 Aug 2022 14:06:50 +0000 (15:06 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 29 Aug 2022 14:06:50 +0000 (15:06 +0100)
Problem:    Clearing screen causes flicker.
Solution:   Do not clear but redraw in more cases.  Add () to "wait_return".

14 files changed:
src/drawscreen.c
src/ex_cmds.c
src/ex_cmds2.c
src/ex_docmd.c
src/ex_getln.c
src/getchar.c
src/if_cscope.c
src/main.c
src/memline.c
src/message.c
src/misc1.c
src/option.c
src/version.c
src/viminfo.c

index a0801e5865474b81606d28d0540e2bc0cc705be5..e90da5f942643c46688722fe699b20d115f2a884 100644 (file)
@@ -1930,24 +1930,9 @@ win_update(win_T *wp)
            }
        }
 
-       // 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.
+       // When starting redraw in the first line, redraw all lines.
        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()
@@ -3183,7 +3168,7 @@ redraw_later_clear(void)
 }
 
 /*
- * Mark all windows to be redrawn later.
+ * Mark all windows to be redrawn later.  Except popup windows.
  */
     void
 redraw_all_later(int type)
@@ -3196,6 +3181,20 @@ redraw_all_later(int type)
     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.
index 96302529ccc70a10eae16112bfecaabb09a5917a..d9f1c993db9e86fc45342ce76676f3e59fc6963e 100644 (file)
@@ -1151,7 +1151,8 @@ do_filter(
 #if defined(FEAT_EVAL)
        if (!aborting())
 #endif
-           (void)semsg(_(e_cant_create_file_str), itmp);       // will call wait_return
+           // will call wait_return()
+           (void)semsg(_(e_cant_create_file_str), itmp);
        goto filterend;
     }
     if (curbuf != old_curbuf)
@@ -4331,7 +4332,7 @@ ex_substitute(exarg_T *eap)
                                                        // needed
                            msg_no_more = TRUE;
                            // write message same highlighting as for
-                           // wait_return
+                           // wait_return()
                            smsg_attr(HL_ATTR(HLF_R),
                                _("replace with %s (y/n/a/q/l/^E/^Y)?"), sub);
                            msg_no_more = FALSE;
index a41e0675b7d2ad7182e1f8c56550ded292fc82b9..3db15922facb07732bf5532b81462abdb48fc858 100644 (file)
@@ -348,7 +348,7 @@ check_changed_any(
     if (!(p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)))
 #endif
     {
-       // There must be a wait_return for this message, do_buffer()
+       // 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.
index 598c6b7c32ba64bd532d180f2c9888a00d488544..1891d8085ae74fa644dbcd613d66b2592f807431 100644 (file)
@@ -879,7 +879,7 @@ do_cmdline(
                    , in_vim9script() ? GETLINE_CONCAT_CONTBAR
                                               : GETLINE_CONCAT_CONT)) == NULL)
            {
-               // Don't call wait_return for aborted command line.  The 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,7 +1355,7 @@ do_cmdline(
        else if (need_wait_return)
        {
            /*
-            * The msg_start() above clears msg_didout. The wait_return we do
+            * 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.
             */
index f28ce8a6c520041649ff6c0738beae53fdc1faf2..dadcfef77fe4fa9ffab0ed167c7397cd9e2ea166 100644 (file)
@@ -1666,7 +1666,7 @@ getcmdline_int(
     if (!cmd_silent)
     {
        i = msg_scrolled;
-       msg_scrolled = 0;               // avoid wait_return message
+       msg_scrolled = 0;               // avoid wait_return() message
        gotocmdline(TRUE);
        msg_scrolled += i;
        redrawcmdprompt();              // draw prompt or indent
index 4134eb9a99964d817ed20f64723749f8cfaeb55c..b598997dc89a6189a552e0efcee7bd280f52e445 100644 (file)
@@ -2098,7 +2098,7 @@ getchar_common(typval_T *argvars, typval_T *rettv)
 
     // redraw the screen after getchar()
     if (p_ch == 0)
-       update_screen(UPD_CLEAR);
+       update_screen(UPD_NOT_VALID);
 
     set_vim_var_nr(VV_MOUSE_WIN, 0);
     set_vim_var_nr(VV_MOUSE_WINID, 0);
index 5d24533016d17caf33d0dd687c4277dd670e8637..945b019a3097813e4d1d0110a8ce2be5760d1b47 100644 (file)
@@ -2474,7 +2474,7 @@ cs_show(exarg_T *eap UNUSED)
        }
     }
 
-    wait_return(TRUE);
+    wait_return(FALSE);
     return CSCOPE_SUCCESS;
 }
 
index f4db631a310d33bb2ba5d76a9fd66f459489db0c..7a42463ba3f41af4bb6e2d3f1520ac5825adf7d4 100644 (file)
@@ -651,7 +651,7 @@ vim_main2(void)
 
     /*
      * When done something that is not allowed or given an error message call
-     * wait_return.  This must be done before starttermcap(), because it may
+     * 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,7 +1226,7 @@ main_loop(
            did_check_timestamps = FALSE;
            if (need_check_timestamps)
                check_timestamps(FALSE);
-           if (need_wait_return)       // if wait_return still needed ...
+           if (need_wait_return)       // if wait_return() still needed ...
                wait_return(FALSE);     // ... call it now
            if (need_start_insertmode && goto_im() && !VIsual_active)
            {
index 391121320b0e89398210cb5657ba3ee6bc9cb7ce..6651cda18c20b2cfe58896730128c3d6942bc589 100644 (file)
@@ -822,7 +822,7 @@ ml_open_file(buf_T *buf)
 
     if (*p_dir != NUL && mfp->mf_fname == NULL)
     {
-       need_wait_return = TRUE;        // call wait_return later
+       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);
index 5c5e3783aea8b8f54837f9147a88ffaadadd4861..ebf198563a984bdcb37cdb76405ceb26e1779c46 100644 (file)
@@ -94,7 +94,7 @@ static int  verbose_did_open = FALSE;
 /*
  * 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
+ * return TRUE if wait_return() not called
  */
     int
 msg(char *s)
@@ -631,7 +631,7 @@ do_perror(char *msg)
  * 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.
+ * Return TRUE if wait_return() not called.
  * Note: caller must check 'emsg_not_now()' before calling this.
  */
     static int
@@ -758,7 +758,7 @@ emsg_core(char_u *s)
     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
+                                   // wait_return() has reset need_wait_return
                                    // and a redraw is expected because
                                    // msg_scrolled is non-zero
 
@@ -2456,7 +2456,7 @@ msg_puts_display(
            {
 #endif
                inc_msg_scrolled();
-               need_wait_return = TRUE; // may need wait_return in main()
+               need_wait_return = TRUE; // may need wait_return() in main()
                redraw_cmdline = TRUE;
                if (cmdline_row > 0 && !exmode_active)
                    --cmdline_row;
@@ -3716,8 +3716,8 @@ msg_clr_cmdline(void)
 
 /*
  * 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.
+ * call wait_return() if the message does not fit in the available space
+ * return TRUE if wait_return() not called.
  */
     int
 msg_end(void)
index e8216a08aec8d2f04f5f906eb0f36ace5365b555..8257f7680abf30f070e39f6fca47860fd407e5ee 100644 (file)
@@ -616,7 +616,7 @@ ask_yesno(char_u *str, int direct)
 
     while (r != 'y' && r != 'n')
     {
-       // same highlighting as for wait_return
+       // same highlighting as for wait_return()
        smsg_attr(HL_ATTR(HLF_R), "%s (y/n)?", str);
        if (direct)
            r = get_keystroke();
index 3e1473fc95c328cd6964ca50bce98d407b7656bf..95733511458ff9898c5c0e69cb7e4322deed82bd 100644 (file)
@@ -2184,7 +2184,7 @@ skip:
            // make sure all characters are printable
            trans_characters(IObuff, IOSIZE);
 
-           ++no_wait_return;           // wait_return done later
+           ++no_wait_return;           // wait_return() done later
            emsg((char *)IObuff);       // show error highlighted
            --no_wait_return;
 
index 6cd7bd28b9c36a6f9d1746dfcd416034832cb250..6c9a330d9463734690efbcd243e969e08c871d49 100644 (file)
@@ -707,6 +707,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    318,
 /**/
     317,
 /**/
index cd734130f6c664a02e91bb1ea968cc8363aa0e83..acdf61825f061cd8d3ca4882bff99f3d44256c79 100644 (file)
@@ -3095,7 +3095,7 @@ write_viminfo(char_u *file, int forceit)
        {
            int tt = msg_didany;
 
-           // avoid a wait_return for this message, it's annoying
+           // 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);