@@ -777,6 +777,57 @@ update_screen(int type)
777777#endif
778778}
779779
780+ #if defined(FEAT_SIGNS ) || defined(FEAT_GUI ) || defined(FEAT_CONCEAL )
781+ /*
782+ * Prepare for updating one or more windows.
783+ * Caller must check for "updating_screen" already set to avoid recursiveness.
784+ */
785+ static void
786+ update_prepare (void )
787+ {
788+ cursor_off ();
789+ updating_screen = TRUE;
790+ #ifdef FEAT_GUI
791+ /* Remove the cursor before starting to do anything, because scrolling may
792+ * make it difficult to redraw the text under it. */
793+ if (gui .in_use )
794+ gui_undraw_cursor ();
795+ #endif
796+ #ifdef FEAT_SEARCH_EXTRA
797+ start_search_hl ();
798+ #endif
799+ }
800+
801+ /*
802+ * Finish updating one or more windows.
803+ */
804+ static void
805+ update_finish (void )
806+ {
807+ if (redraw_cmdline )
808+ showmode ();
809+
810+ # ifdef FEAT_SEARCH_EXTRA
811+ end_search_hl ();
812+ # endif
813+
814+ updating_screen = FALSE;
815+
816+ # ifdef FEAT_GUI
817+ gui_may_resize_shell ();
818+
819+ /* Redraw the cursor and update the scrollbars when all screen updating is
820+ * done. */
821+ if (gui .in_use )
822+ {
823+ out_flush (); /* required before updating the cursor */
824+ gui_update_cursor (FALSE, FALSE);
825+ gui_update_scrollbars (FALSE);
826+ }
827+ # endif
828+ }
829+ #endif
830+
780831#if defined(FEAT_CONCEAL ) || defined(PROTO )
781832/*
782833 * Return TRUE if the cursor line in window "wp" may be concealed, according
@@ -826,17 +877,12 @@ update_single_line(win_T *wp, linenr_T lnum)
826877 /* Don't do anything if the screen structures are (not yet) valid. */
827878 if (!screen_valid (TRUE) || updating_screen )
828879 return ;
829- updating_screen = TRUE;
830880
831881 if (lnum >= wp -> w_topline && lnum < wp -> w_botline
832882 && foldedCount (wp , lnum , & win_foldinfo ) == 0 )
833883 {
834- # ifdef FEAT_GUI
835- /* Remove the cursor before starting to do anything, because scrolling
836- * may make it difficult to redraw the text under it. */
837- if (gui .in_use )
838- gui_undraw_cursor ();
839- # endif
884+ update_prepare ();
885+
840886 row = 0 ;
841887 for (j = 0 ; j < wp -> w_lines_valid ; ++ j )
842888 {
@@ -856,68 +902,10 @@ update_single_line(win_T *wp, linenr_T lnum)
856902 }
857903 row += wp -> w_lines [j ].wl_size ;
858904 }
859- # ifdef FEAT_GUI
860- /* Redraw the cursor */
861- if (gui .in_use )
862- {
863- out_flush (); /* required before updating the cursor */
864- gui_update_cursor (FALSE, FALSE);
865- }
866- # endif
867- }
868- need_cursor_line_redraw = FALSE;
869- updating_screen = FALSE;
870- }
871- #endif
872-
873- #if defined(FEAT_SIGNS ) || defined(FEAT_GUI )
874- /*
875- * Prepare for updating one or more windows.
876- * Caller must check for "updating_screen" already set to avoid recursiveness.
877- */
878- static void
879- update_prepare (void )
880- {
881- cursor_off ();
882- updating_screen = TRUE;
883- #ifdef FEAT_GUI
884- /* Remove the cursor before starting to do anything, because scrolling may
885- * make it difficult to redraw the text under it. */
886- if (gui .in_use )
887- gui_undraw_cursor ();
888- #endif
889- #ifdef FEAT_SEARCH_EXTRA
890- start_search_hl ();
891- #endif
892- }
893-
894- /*
895- * Finish updating one or more windows.
896- */
897- static void
898- update_finish (void )
899- {
900- if (redraw_cmdline )
901- showmode ();
902-
903- # ifdef FEAT_SEARCH_EXTRA
904- end_search_hl ();
905- # endif
906905
907- updating_screen = FALSE;
908-
909- # ifdef FEAT_GUI
910- gui_may_resize_shell ();
911-
912- /* Redraw the cursor and update the scrollbars when all screen updating is
913- * done. */
914- if (gui .in_use )
915- {
916- out_flush (); /* required before updating the cursor */
917- gui_update_cursor (FALSE, FALSE);
918- gui_update_scrollbars (FALSE);
906+ update_finish ();
919907 }
920- # endif
908+ need_cursor_line_redraw = FALSE;
921909}
922910#endif
923911
0 commit comments