]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.0726: redrawing specifically for conceal feature v8.1.0726
authorBram Moolenaar <Bram@vim.org>
Fri, 11 Jan 2019 19:45:36 +0000 (20:45 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 11 Jan 2019 19:45:36 +0000 (20:45 +0100)
Problem:    Redrawing specifically for conceal feature.
Solution:   Use generic redrawing methods.

src/edit.c
src/gui.c
src/main.c
src/normal.c
src/proto/screen.pro
src/screen.c
src/version.c
src/window.c

index bd6f606bba1414e15610ce5bc79e39c38ec741d7..33e0e6708bed766f561d5e18350bdb27748c4f28 100644 (file)
@@ -1745,23 +1745,24 @@ ins_redraw(
     }
 #endif
 
-    if (must_redraw)
-       update_screen(0);
-    else if (clear_cmdline || redraw_cmdline)
-       showmode();             /* clear cmdline and show mode */
-# if defined(FEAT_CONCEAL)
+#if defined(FEAT_CONCEAL)
     if ((conceal_update_lines
            && (conceal_old_cursor_line != conceal_new_cursor_line
                || conceal_cursor_line(curwin)))
            || need_cursor_line_redraw)
     {
        if (conceal_old_cursor_line != conceal_new_cursor_line)
-           update_single_line(curwin, conceal_old_cursor_line);
-       update_single_line(curwin, conceal_new_cursor_line == 0
-                      ? curwin->w_cursor.lnum : conceal_new_cursor_line);
+           redrawWinline(curwin, conceal_old_cursor_line);
+       redrawWinline(curwin, conceal_new_cursor_line == 0
+                           ? curwin->w_cursor.lnum : conceal_new_cursor_line);
        curwin->w_valid &= ~VALID_CROW;
+       need_cursor_line_redraw = FALSE;
     }
-# endif
+#endif
+    if (must_redraw)
+       update_screen(0);
+    else if (clear_cmdline || redraw_cmdline)
+       showmode();             /* clear cmdline and show mode */
     showruler(FALSE);
     setcursor();
     emsg_on_display = FALSE;   /* may remove error message now */
index 0b911b314e8e822f8b8b91c1ff767f0da2439a7b..8c35119b40205c5e542f1f615020d12dada5c51f 100644 (file)
--- a/src/gui.c
+++ b/src/gui.c
@@ -5166,8 +5166,6 @@ gui_update_screen(void)
        last_cursormoved = curwin->w_cursor;
     }
 
-    update_screen(0);  /* may need to update the screen */
-    setcursor();
 # ifdef FEAT_CONCEAL
     if (conceal_update_lines
            && (conceal_old_cursor_line != conceal_new_cursor_line
@@ -5175,11 +5173,14 @@ gui_update_screen(void)
                || need_cursor_line_redraw))
     {
        if (conceal_old_cursor_line != conceal_new_cursor_line)
-           update_single_line(curwin, conceal_old_cursor_line);
-       update_single_line(curwin, conceal_new_cursor_line);
+           redrawWinline(curwin, conceal_old_cursor_line);
+       redrawWinline(curwin, conceal_new_cursor_line);
        curwin->w_valid &= ~VALID_CROW;
+       need_cursor_line_redraw = FALSE;
     }
 # endif
+    update_screen(0);  /* may need to update the screen */
+    setcursor();
     out_flush_cursor(TRUE, FALSE);
 }
 #endif
index 2f8f0523f469ac18c27e9e32f210b96663195650..7c8014c837aca1280e13b0b21c4161bae24a9757 100644 (file)
@@ -1194,6 +1194,22 @@ main_loop(
                last_cursormoved = curwin->w_cursor;
            }
 
+#if defined(FEAT_CONCEAL)
+           if (conceal_update_lines
+                   && (conceal_old_cursor_line != conceal_new_cursor_line
+                       || conceal_cursor_line(curwin)
+                       || need_cursor_line_redraw))
+           {
+               if (conceal_old_cursor_line != conceal_new_cursor_line
+                       && conceal_old_cursor_line
+                                               <= curbuf->b_ml.ml_line_count)
+                   redrawWinline(curwin, conceal_old_cursor_line);
+               redrawWinline(curwin, conceal_new_cursor_line);
+               curwin->w_valid &= ~VALID_CROW;
+               need_cursor_line_redraw = FALSE;
+           }
+#endif
+
            /* Trigger TextChanged if b:changedtick differs. */
            if (!finish_op && has_textchanged()
                    && curbuf->b_last_changedtick != CHANGEDTICK(curbuf))
@@ -1288,22 +1304,6 @@ main_loop(
            may_clear_sb_text();        /* clear scroll-back text on next msg */
            showruler(FALSE);
 
-#if defined(FEAT_CONCEAL)
-           if (conceal_update_lines
-                   && (conceal_old_cursor_line != conceal_new_cursor_line
-                       || conceal_cursor_line(curwin)
-                       || need_cursor_line_redraw))
-           {
-               mch_disable_flush();    /* Stop issuing gui_mch_flush(). */
-               if (conceal_old_cursor_line != conceal_new_cursor_line
-                       && conceal_old_cursor_line
-                                               <= curbuf->b_ml.ml_line_count)
-                   update_single_line(curwin, conceal_old_cursor_line);
-               update_single_line(curwin, conceal_new_cursor_line);
-               mch_enable_flush();
-               curwin->w_valid &= ~VALID_CROW;
-           }
-#endif
            setcursor();
            cursor_on();
 
index 9ee0eeffba11e0efb0c31a707b2816192e732cfc..c973fa12e8be753e75a6952ffe76e5328451ae5e 100644 (file)
@@ -8512,7 +8512,7 @@ n_opencmd(cmdarg_T *cap)
        {
 #ifdef FEAT_CONCEAL
            if (curwin->w_p_cole > 0 && oldline != curwin->w_cursor.lnum)
-               update_single_line(curwin, oldline);
+               redrawWinline(curwin, oldline);
 #endif
            /* When '#' is in 'cpoptions' ignore the count. */
            if (vim_strchr(p_cpo, CPO_HASH) != NULL)
index 2e5f2e0bec91cbaa2903ea06f49786f78b5617bc..b78796e7445cb5e60a8717905a3fe5af41c81adb 100644 (file)
@@ -15,7 +15,6 @@ void update_curbuf(int type);
 int update_screen(int type_arg);
 int conceal_cursor_line(win_T *wp);
 void conceal_check_cursor_line(void);
-void update_single_line(win_T *wp, linenr_T lnum);
 void update_debug_sign(buf_T *buf, linenr_T lnum);
 void updateWindow(win_T *wp);
 int screen_get_current_line_off(void);
index 926a09083c1427a2f82ff54dc882c35b78114a07..9b976ffaf1d8e2c8d9549904312d1b66bfb2d6b6 100644 (file)
@@ -927,55 +927,6 @@ conceal_check_cursor_line(void)
        curs_columns(TRUE);
     }
 }
-
-    void
-update_single_line(win_T *wp, linenr_T lnum)
-{
-    int                row;
-    int                j;
-#ifdef SYN_TIME_LIMIT
-    proftime_T syntax_tm;
-#endif
-
-    /* Don't do anything if the screen structures are (not yet) valid. */
-    if (!screen_valid(TRUE) || updating_screen)
-       return;
-
-    if (lnum >= wp->w_topline && lnum < wp->w_botline
-                                && foldedCount(wp, lnum, &win_foldinfo) == 0)
-    {
-#ifdef SYN_TIME_LIMIT
-       /* Set the time limit to 'redrawtime'. */
-       profile_setlimit(p_rdt, &syntax_tm);
-       syn_set_timeout(&syntax_tm);
-#endif
-       update_prepare();
-
-       row = 0;
-       for (j = 0; j < wp->w_lines_valid; ++j)
-       {
-           if (lnum == wp->w_lines[j].wl_lnum)
-           {
-               screen_start(); /* not sure of screen cursor */
-# ifdef FEAT_SEARCH_EXTRA
-               init_search_hl(wp);
-               prepare_search_hl(wp, lnum);
-# endif
-               win_line(wp, lnum, row, row + wp->w_lines[j].wl_size,
-                                                                FALSE, FALSE);
-               break;
-           }
-           row += wp->w_lines[j].wl_size;
-       }
-
-       update_finish();
-
-#ifdef SYN_TIME_LIMIT
-       syn_set_timeout(NULL);
-#endif
-    }
-    need_cursor_line_redraw = FALSE;
-}
 #endif
 
 #if defined(FEAT_SIGNS) || defined(PROTO)
index 743712d0256d7a075b670a81bacde021706ed52d..c7d63f194f3d3f123db818b2308714353abce0ec 100644 (file)
@@ -795,6 +795,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    726,
 /**/
     725,
 /**/
index e67aeeabdc6d937ed2929839901d53ea352d2870..5989aed4b627ee2703b8483d4c80954feabfd278 100644 (file)
@@ -4177,9 +4177,9 @@ win_goto(win_T *wp)
     win_enter(wp, TRUE);
 
 #ifdef FEAT_CONCEAL
-    /* Conceal cursor line in previous window, unconceal in current window. */
+    // Conceal cursor line in previous window, unconceal in current window.
     if (win_valid(owp) && owp->w_p_cole > 0 && !msg_scrolled)
-       update_single_line(owp, owp->w_cursor.lnum);
+       redrawWinline(owp, owp->w_cursor.lnum);
     if (curwin->w_p_cole > 0 && !msg_scrolled)
        need_cursor_line_redraw = TRUE;
 #endif