Mercurial > vim
comparison src/screen.c @ 16986:03f3a9ca2770 v8.1.1493
patch 8.1.1493: redrawing with popups is slow and causes flicker
commit https://github.com/vim/vim/commit/33796b39b9f00b42ca57fa00dbbb52316d9d38ff
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 8 16:01:13 2019 +0200
patch 8.1.1493: redrawing with popups is slow and causes flicker
Problem: Redrawing with popups is slow and causes flicker.
Solution: Avoid clearing and redrawing using a zindex mask.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 08 Jun 2019 16:15:04 +0200 |
parents | 21cddcc6fbe8 |
children | f824831e2805 |
comparison
equal
deleted
inserted
replaced
16985:914898e347fe | 16986:03f3a9ca2770 |
---|---|
608 must_redraw = type; | 608 must_redraw = type; |
609 if (type > INVERTED_ALL) | 609 if (type > INVERTED_ALL) |
610 curwin->w_lines_valid = 0; /* don't use w_lines[].wl_size now */ | 610 curwin->w_lines_valid = 0; /* don't use w_lines[].wl_size now */ |
611 return FAIL; | 611 return FAIL; |
612 } | 612 } |
613 | |
613 #ifdef FEAT_TEXT_PROP | 614 #ifdef FEAT_TEXT_PROP |
614 // TODO: avoid redrawing everything when there is a popup window. | 615 // Update popup_mask if needed. |
615 if (popup_any_visible()) | 616 type = may_update_popup_mask(type); |
616 { | |
617 if (type < NOT_VALID) | |
618 type = NOT_VALID; | |
619 FOR_ALL_WINDOWS(wp) | |
620 wp->w_redr_type = NOT_VALID; | |
621 } | |
622 #endif | 617 #endif |
623 | 618 |
624 updating_screen = TRUE; | 619 updating_screen = TRUE; |
625 #ifdef FEAT_SYN_HL | 620 #ifdef FEAT_SYN_HL |
626 ++display_tick; /* let syntax code know we're in a next round of | 621 ++display_tick; /* let syntax code know we're in a next round of |
878 gui_undraw_cursor(); | 873 gui_undraw_cursor(); |
879 #endif | 874 #endif |
880 #ifdef FEAT_SEARCH_EXTRA | 875 #ifdef FEAT_SEARCH_EXTRA |
881 start_search_hl(); | 876 start_search_hl(); |
882 #endif | 877 #endif |
878 #ifdef FEAT_TEXT_PROP | |
879 // Update popup_mask if needed. | |
880 may_update_popup_mask(0); | |
881 #endif | |
883 } | 882 } |
884 | 883 |
885 /* | 884 /* |
886 * Finish updating one or more windows. | 885 * Finish updating one or more windows. |
887 */ | 886 */ |
990 win_update(wp); | 989 win_update(wp); |
991 if (wp->w_redr_status) | 990 if (wp->w_redr_status) |
992 win_redr_status(wp, FALSE); | 991 win_redr_status(wp, FALSE); |
993 } | 992 } |
994 | 993 |
995 #ifdef FEAT_TEXT_PROP | |
996 // Display popup windows on top of the others. | |
997 update_popups(); | |
998 #endif | |
999 | |
1000 update_finish(); | 994 update_finish(); |
1001 } | 995 } |
1002 #endif | 996 #endif |
1003 | 997 |
1004 /* | 998 /* |
1018 #endif | 1012 #endif |
1019 return wcr_attr; | 1013 return wcr_attr; |
1020 } | 1014 } |
1021 | 1015 |
1022 #ifdef FEAT_TEXT_PROP | 1016 #ifdef FEAT_TEXT_PROP |
1017 /* | |
1018 * Update "popup_mask" if needed. | |
1019 * Also recomputes the popup size and positions. | |
1020 * Also updates "popup_visible". | |
1021 * If more redrawing is needed than "type_arg" a higher value is returned. | |
1022 */ | |
1023 int | |
1024 may_update_popup_mask(int type_arg) | |
1025 { | |
1026 int type = type_arg; | |
1027 win_T *wp; | |
1028 | |
1029 if (popup_mask_tab != curtab) | |
1030 popup_mask_refresh = TRUE; | |
1031 if (!popup_mask_refresh) | |
1032 { | |
1033 // Check if any buffer has changed. | |
1034 for (wp = first_popupwin; wp != NULL; wp = wp->w_next) | |
1035 if (wp->w_popup_last_changedtick != CHANGEDTICK(wp->w_buffer)) | |
1036 popup_mask_refresh = TRUE; | |
1037 for (wp = curtab->tp_first_popupwin; wp != NULL; wp = wp->w_next) | |
1038 if (wp->w_popup_last_changedtick != CHANGEDTICK(wp->w_buffer)) | |
1039 popup_mask_refresh = TRUE; | |
1040 if (!popup_mask_refresh) | |
1041 return type; | |
1042 } | |
1043 | |
1044 popup_mask_refresh = FALSE; | |
1045 popup_mask_tab = curtab; | |
1046 | |
1047 popup_visible = FALSE; | |
1048 vim_memset(popup_mask, 0, screen_Rows * screen_Columns * sizeof(short)); | |
1049 | |
1050 // Find the window with the lowest zindex that hasn't been handled yet, | |
1051 // so that the window with a higher zindex overwrites the value in | |
1052 // popup_mask. | |
1053 popup_reset_handled(); | |
1054 while ((wp = find_next_popup(TRUE)) != NULL) | |
1055 { | |
1056 int top_off, bot_off; | |
1057 int left_off, right_off; | |
1058 short *p; | |
1059 int line, col; | |
1060 | |
1061 popup_visible = TRUE; | |
1062 | |
1063 // Recompute the position if the text changed. | |
1064 if (wp->w_popup_last_changedtick != CHANGEDTICK(wp->w_buffer)) | |
1065 popup_adjust_position(wp); | |
1066 | |
1067 // the position and size are for the inside, add the padding and | |
1068 // border | |
1069 top_off = wp->w_popup_padding[0] + wp->w_popup_border[0]; | |
1070 bot_off = wp->w_popup_padding[2] + wp->w_popup_border[2]; | |
1071 left_off = wp->w_popup_padding[3] + wp->w_popup_border[3]; | |
1072 right_off = wp->w_popup_padding[1] + wp->w_popup_border[1]; | |
1073 | |
1074 for (line = wp->w_winrow + top_off; | |
1075 line < wp->w_winrow + wp->w_height + bot_off | |
1076 && line < screen_Rows; ++line) | |
1077 for (col = wp->w_wincol + left_off; | |
1078 col < wp->w_wincol + wp->w_width + right_off | |
1079 && col < screen_Columns; ++col) | |
1080 { | |
1081 p = popup_mask + line * screen_Columns + col; | |
1082 if (*p != wp->w_zindex) | |
1083 { | |
1084 *p = wp->w_zindex; | |
1085 type = NOT_VALID; | |
1086 } | |
1087 } | |
1088 } | |
1089 | |
1090 return type; | |
1091 } | |
1092 | |
1023 /* | 1093 /* |
1024 * Return a string of "len" spaces in IObuff. | 1094 * Return a string of "len" spaces in IObuff. |
1025 */ | 1095 */ |
1026 static char_u * | 1096 static char_u * |
1027 get_spaces(int len) | 1097 get_spaces(int len) |
1047 int i; | 1117 int i; |
1048 | 1118 |
1049 // Find the window with the lowest zindex that hasn't been updated yet, | 1119 // Find the window with the lowest zindex that hasn't been updated yet, |
1050 // so that the window with a higher zindex is drawn later, thus goes on | 1120 // so that the window with a higher zindex is drawn later, thus goes on |
1051 // top. | 1121 // top. |
1052 // TODO: don't redraw every popup every time. | |
1053 popup_visible = FALSE; | |
1054 popup_reset_handled(); | 1122 popup_reset_handled(); |
1055 while ((wp = find_next_popup(TRUE)) != NULL) | 1123 while ((wp = find_next_popup(TRUE)) != NULL) |
1056 { | 1124 { |
1057 // Recompute the position if the text changed. | 1125 // This drawing uses the zindex of the popup window, so that it's on |
1058 if (wp->w_popup_last_changedtick != CHANGEDTICK(wp->w_buffer)) | 1126 // top of the text but doesn't draw when another popup with higher |
1059 popup_adjust_position(wp); | 1127 // zindex is on top of the character. |
1128 screen_zindex = wp->w_zindex; | |
1060 | 1129 |
1061 // adjust w_winrow and w_wincol for border and padding, since | 1130 // adjust w_winrow and w_wincol for border and padding, since |
1062 // win_update() doesn't handle them. | 1131 // win_update() doesn't handle them. |
1063 top_off = wp->w_popup_padding[0] + wp->w_popup_border[0]; | 1132 top_off = wp->w_popup_padding[0] + wp->w_popup_border[0]; |
1064 left_off = wp->w_popup_padding[3] + wp->w_popup_border[3]; | 1133 left_off = wp->w_popup_padding[3] + wp->w_popup_border[3]; |
1065 wp->w_winrow += top_off; | 1134 wp->w_winrow += top_off; |
1066 wp->w_wincol += left_off; | 1135 wp->w_wincol += left_off; |
1067 | 1136 |
1068 // Draw the popup text. | 1137 // Draw the popup text. |
1069 win_update(wp); | 1138 win_update(wp); |
1070 popup_visible = TRUE; | |
1071 | 1139 |
1072 wp->w_winrow -= top_off; | 1140 wp->w_winrow -= top_off; |
1073 wp->w_wincol -= left_off; | 1141 wp->w_wincol -= left_off; |
1074 | 1142 |
1075 total_width = wp->w_popup_border[3] + wp->w_popup_padding[3] | 1143 total_width = wp->w_popup_border[3] + wp->w_popup_padding[3] |
1188 buf[mb_char2bytes(border_char[6], buf)] = NUL; | 1256 buf[mb_char2bytes(border_char[6], buf)] = NUL; |
1189 screen_puts(buf, row, | 1257 screen_puts(buf, row, |
1190 wp->w_wincol + total_width - 1, border_attr[2]); | 1258 wp->w_wincol + total_width - 1, border_attr[2]); |
1191 } | 1259 } |
1192 } | 1260 } |
1261 | |
1262 // Back to the normal zindex. | |
1263 screen_zindex = 0; | |
1193 } | 1264 } |
1194 } | 1265 } |
1195 #endif | 1266 #endif |
1196 | 1267 |
1197 #if defined(FEAT_GUI) || defined(PROTO) | 1268 #if defined(FEAT_GUI) || defined(PROTO) |
6475 hl = syn_attr2attr(hl); | 6546 hl = syn_attr2attr(hl); |
6476 if (hl & HL_BOLD) | 6547 if (hl & HL_BOLD) |
6477 redraw_this = TRUE; | 6548 redraw_this = TRUE; |
6478 } | 6549 } |
6479 #endif | 6550 #endif |
6551 #ifdef FEAT_TEXT_PROP | |
6552 // Skip if under a(nother) popup. | |
6553 if (popup_mask[row * screen_Columns + col + coloff] > screen_zindex) | |
6554 redraw_this = FALSE; | |
6555 #endif | |
6480 | 6556 |
6481 if (redraw_this) | 6557 if (redraw_this) |
6482 { | 6558 { |
6483 /* | 6559 /* |
6484 * Special handling when 'xs' termcap flag set (hpterm): | 6560 * Special handling when 'xs' termcap flag set (hpterm): |
6719 } | 6795 } |
6720 | 6796 |
6721 if (clear_width > 0 | 6797 if (clear_width > 0 |
6722 #ifdef FEAT_TEXT_PROP | 6798 #ifdef FEAT_TEXT_PROP |
6723 && !(flags & SLF_POPUP) // no separator for popup window | 6799 && !(flags & SLF_POPUP) // no separator for popup window |
6800 && popup_mask[row * screen_Columns + col + coloff] <= screen_zindex | |
6724 #endif | 6801 #endif |
6725 ) | 6802 ) |
6726 { | 6803 { |
6727 // For a window that has a right neighbor, draw the separator char | 6804 // For a window that has a right neighbor, draw the separator char |
6728 // right of the window contents. | 6805 // right of the window contents. |
6819 FOR_ALL_WINDOWS(wp) | 6896 FOR_ALL_WINDOWS(wp) |
6820 if (wp->w_redr_status) | 6897 if (wp->w_redr_status) |
6821 win_redr_status(wp, FALSE); | 6898 win_redr_status(wp, FALSE); |
6822 if (redraw_tabline) | 6899 if (redraw_tabline) |
6823 draw_tabline(); | 6900 draw_tabline(); |
6824 | |
6825 #ifdef FEAT_TEXT_PROP | |
6826 // Display popup windows on top of the status lines. | |
6827 update_popups(); | |
6828 #endif | |
6829 } | 6901 } |
6830 | 6902 |
6831 #if defined(FEAT_WILDMENU) || defined(PROTO) | 6903 #if defined(FEAT_WILDMENU) || defined(PROTO) |
6832 /* | 6904 /* |
6833 * Redraw all status lines at the bottom of frame "frp". | 6905 * Redraw all status lines at the bottom of frame "frp". |
8575 * resizing). */ | 8647 * resizing). */ |
8576 if (row >= screen_Rows || col >= screen_Columns) | 8648 if (row >= screen_Rows || col >= screen_Columns) |
8577 return; | 8649 return; |
8578 | 8650 |
8579 #ifdef FEAT_INS_EXPAND | 8651 #ifdef FEAT_INS_EXPAND |
8580 if (pum_under_menu(row, col)) | 8652 // Skip if under the popup menu. |
8653 // Popup windows with zindex higher than POPUPMENU_ZINDEX go on top. | |
8654 if (pum_under_menu(row, col) | |
8655 # ifdef FEAT_TEXT_PROP | |
8656 && screen_zindex <= POPUPMENU_ZINDEX | |
8657 # endif | |
8658 ) | |
8581 return; | 8659 return; |
8582 #endif | 8660 #endif |
8661 #ifdef FEAT_TEXT_PROP | |
8662 // Skip if under a(nother) popup. | |
8663 if (popup_mask[row * screen_Columns + col] > screen_zindex) | |
8664 return; | |
8665 #endif | |
8666 | |
8583 /* Outputting a character in the last cell on the screen may scroll the | 8667 /* Outputting a character in the last cell on the screen may scroll the |
8584 * screen up. Only do it when the "xn" termcap property is set, otherwise | 8668 * screen up. Only do it when the "xn" termcap property is set, otherwise |
8585 * mark the character invalid (update it when scrolled up). */ | 8669 * mark the character invalid (update it when scrolled up). */ |
8586 if (*T_XN == NUL | 8670 if (*T_XN == NUL |
8587 && row == screen_Rows - 1 && col == screen_Columns - 1 | 8671 && row == screen_Rows - 1 && col == screen_Columns - 1 |
8867 | 8951 |
8868 off = LineOffset[row] + start_col; | 8952 off = LineOffset[row] + start_col; |
8869 c = c1; | 8953 c = c1; |
8870 for (col = start_col; col < end_col; ++col) | 8954 for (col = start_col; col < end_col; ++col) |
8871 { | 8955 { |
8872 if (ScreenLines[off] != c | 8956 if ((ScreenLines[off] != c |
8873 || (enc_utf8 && (int)ScreenLinesUC[off] | 8957 || (enc_utf8 && (int)ScreenLinesUC[off] |
8874 != (c >= 0x80 ? c : 0)) | 8958 != (c >= 0x80 ? c : 0)) |
8875 || ScreenAttrs[off] != attr | 8959 || ScreenAttrs[off] != attr |
8876 #if defined(FEAT_GUI) || defined(UNIX) | 8960 #if defined(FEAT_GUI) || defined(UNIX) |
8877 || force_next | 8961 || force_next |
8878 #endif | 8962 #endif |
8879 ) | 8963 ) |
8964 #ifdef FEAT_TEXT_PROP | |
8965 // Skip if under a(nother) popup. | |
8966 && popup_mask[row * screen_Columns + col] <= screen_zindex | |
8967 #endif | |
8968 ) | |
8880 { | 8969 { |
8881 #if defined(FEAT_GUI) || defined(UNIX) | 8970 #if defined(FEAT_GUI) || defined(UNIX) |
8882 /* The bold trick may make a single row of pixels appear in | 8971 /* The bold trick may make a single row of pixels appear in |
8883 * the next character. When a bold character is removed, the | 8972 * the next character. When a bold character is removed, the |
8884 * next character should be redrawn too. This happens for our | 8973 * next character should be redrawn too. This happens for our |
9011 int i; | 9100 int i; |
9012 sattr_T *new_ScreenAttrs; | 9101 sattr_T *new_ScreenAttrs; |
9013 unsigned *new_LineOffset; | 9102 unsigned *new_LineOffset; |
9014 char_u *new_LineWraps; | 9103 char_u *new_LineWraps; |
9015 short *new_TabPageIdxs; | 9104 short *new_TabPageIdxs; |
9105 #ifdef FEAT_TEXT_PROP | |
9106 short *new_popup_mask; | |
9107 #endif | |
9016 tabpage_T *tp; | 9108 tabpage_T *tp; |
9017 static int entered = FALSE; /* avoid recursiveness */ | 9109 static int entered = FALSE; /* avoid recursiveness */ |
9018 static int done_outofmem_msg = FALSE; /* did outofmem message */ | 9110 static int done_outofmem_msg = FALSE; /* did outofmem message */ |
9019 int retry_count = 0; | 9111 int retry_count = 0; |
9020 | 9112 |
9092 new_ScreenLines2 = LALLOC_MULT(schar_T, (Rows + 1) * Columns); | 9184 new_ScreenLines2 = LALLOC_MULT(schar_T, (Rows + 1) * Columns); |
9093 new_ScreenAttrs = LALLOC_MULT(sattr_T, (Rows + 1) * Columns); | 9185 new_ScreenAttrs = LALLOC_MULT(sattr_T, (Rows + 1) * Columns); |
9094 new_LineOffset = LALLOC_MULT(unsigned, Rows); | 9186 new_LineOffset = LALLOC_MULT(unsigned, Rows); |
9095 new_LineWraps = LALLOC_MULT(char_u, Rows); | 9187 new_LineWraps = LALLOC_MULT(char_u, Rows); |
9096 new_TabPageIdxs = LALLOC_MULT(short, Columns); | 9188 new_TabPageIdxs = LALLOC_MULT(short, Columns); |
9189 #ifdef FEAT_TEXT_PROP | |
9190 new_popup_mask = LALLOC_MULT(short, Rows * Columns); | |
9191 #endif | |
9097 | 9192 |
9098 FOR_ALL_TAB_WINDOWS(tp, wp) | 9193 FOR_ALL_TAB_WINDOWS(tp, wp) |
9099 { | 9194 { |
9100 if (win_alloc_lines(wp) == FAIL) | 9195 if (win_alloc_lines(wp) == FAIL) |
9101 { | 9196 { |
9134 || (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL) | 9229 || (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL) |
9135 || new_ScreenAttrs == NULL | 9230 || new_ScreenAttrs == NULL |
9136 || new_LineOffset == NULL | 9231 || new_LineOffset == NULL |
9137 || new_LineWraps == NULL | 9232 || new_LineWraps == NULL |
9138 || new_TabPageIdxs == NULL | 9233 || new_TabPageIdxs == NULL |
9234 #ifdef FEAT_TEXT_PROP | |
9235 || new_popup_mask == NULL | |
9236 #endif | |
9139 || outofmem) | 9237 || outofmem) |
9140 { | 9238 { |
9141 if (ScreenLines != NULL || !done_outofmem_msg) | 9239 if (ScreenLines != NULL || !done_outofmem_msg) |
9142 { | 9240 { |
9143 /* guess the size */ | 9241 /* guess the size */ |
9154 VIM_CLEAR(new_ScreenLines2); | 9252 VIM_CLEAR(new_ScreenLines2); |
9155 VIM_CLEAR(new_ScreenAttrs); | 9253 VIM_CLEAR(new_ScreenAttrs); |
9156 VIM_CLEAR(new_LineOffset); | 9254 VIM_CLEAR(new_LineOffset); |
9157 VIM_CLEAR(new_LineWraps); | 9255 VIM_CLEAR(new_LineWraps); |
9158 VIM_CLEAR(new_TabPageIdxs); | 9256 VIM_CLEAR(new_TabPageIdxs); |
9257 #ifdef FEAT_TEXT_PROP | |
9258 VIM_CLEAR(new_popup_mask); | |
9259 #endif | |
9159 } | 9260 } |
9160 else | 9261 else |
9161 { | 9262 { |
9162 done_outofmem_msg = FALSE; | 9263 done_outofmem_msg = FALSE; |
9163 | 9264 |
9240 ScreenLines2 = new_ScreenLines2; | 9341 ScreenLines2 = new_ScreenLines2; |
9241 ScreenAttrs = new_ScreenAttrs; | 9342 ScreenAttrs = new_ScreenAttrs; |
9242 LineOffset = new_LineOffset; | 9343 LineOffset = new_LineOffset; |
9243 LineWraps = new_LineWraps; | 9344 LineWraps = new_LineWraps; |
9244 TabPageIdxs = new_TabPageIdxs; | 9345 TabPageIdxs = new_TabPageIdxs; |
9346 #ifdef FEAT_TEXT_PROP | |
9347 popup_mask = new_popup_mask; | |
9348 vim_memset(popup_mask, 0, screen_Rows * screen_Columns * sizeof(short)); | |
9349 popup_mask_refresh = TRUE; | |
9350 #endif | |
9245 | 9351 |
9246 /* It's important that screen_Rows and screen_Columns reflect the actual | 9352 /* It's important that screen_Rows and screen_Columns reflect the actual |
9247 * size of ScreenLines[]. Set them before calling anything. */ | 9353 * size of ScreenLines[]. Set them before calling anything. */ |
9248 #ifdef FEAT_GUI | 9354 #ifdef FEAT_GUI |
9249 old_Rows = screen_Rows; | 9355 old_Rows = screen_Rows; |
9294 void | 9400 void |
9295 free_screenlines(void) | 9401 free_screenlines(void) |
9296 { | 9402 { |
9297 int i; | 9403 int i; |
9298 | 9404 |
9299 vim_free(ScreenLinesUC); | 9405 VIM_CLEAR(ScreenLinesUC); |
9300 for (i = 0; i < Screen_mco; ++i) | 9406 for (i = 0; i < Screen_mco; ++i) |
9301 vim_free(ScreenLinesC[i]); | 9407 VIM_CLEAR(ScreenLinesC[i]); |
9302 vim_free(ScreenLines2); | 9408 VIM_CLEAR(ScreenLines2); |
9303 vim_free(ScreenLines); | 9409 VIM_CLEAR(ScreenLines); |
9304 vim_free(ScreenAttrs); | 9410 VIM_CLEAR(ScreenAttrs); |
9305 vim_free(LineOffset); | 9411 VIM_CLEAR(LineOffset); |
9306 vim_free(LineWraps); | 9412 VIM_CLEAR(LineWraps); |
9307 vim_free(TabPageIdxs); | 9413 VIM_CLEAR(TabPageIdxs); |
9414 #ifdef FEAT_TEXT_PROP | |
9415 VIM_CLEAR(popup_mask); | |
9416 #endif | |
9308 } | 9417 } |
9309 | 9418 |
9310 void | 9419 void |
9311 screenclear(void) | 9420 screenclear(void) |
9312 { | 9421 { |
9427 } | 9536 } |
9428 | 9537 |
9429 /* | 9538 /* |
9430 * Return TRUE if clearing with term string "p" would work. | 9539 * Return TRUE if clearing with term string "p" would work. |
9431 * It can't work when the string is empty or it won't set the right background. | 9540 * It can't work when the string is empty or it won't set the right background. |
9541 * Don't clear to end-of-line when there are popups, it may cause flicker. | |
9432 */ | 9542 */ |
9433 int | 9543 int |
9434 can_clear(char_u *p) | 9544 can_clear(char_u *p) |
9435 { | 9545 { |
9436 return (*p != NUL && (t_colors <= 1 | 9546 return (*p != NUL && (t_colors <= 1 |
9441 || (p_tgc && cterm_normal_bg_gui_color == INVALCOLOR) | 9551 || (p_tgc && cterm_normal_bg_gui_color == INVALCOLOR) |
9442 || (!p_tgc && cterm_normal_bg_color == 0) | 9552 || (!p_tgc && cterm_normal_bg_color == 0) |
9443 #else | 9553 #else |
9444 || cterm_normal_bg_color == 0 | 9554 || cterm_normal_bg_color == 0 |
9445 #endif | 9555 #endif |
9446 || *T_UT != NUL)); | 9556 || *T_UT != NUL) |
9557 #ifdef FEAT_TEXT_PROP | |
9558 && !(p == T_CE && popup_visible) | |
9559 #endif | |
9560 ); | |
9447 } | 9561 } |
9448 | 9562 |
9449 /* | 9563 /* |
9450 * Reset cursor position. Use whenever cursor was moved because of outputting | 9564 * Reset cursor position. Use whenever cursor was moved because of outputting |
9451 * something directly to the screen (shell commands) or a terminal control | 9565 * something directly to the screen (shell commands) or a terminal control |
9889 int retval; | 10003 int retval; |
9890 | 10004 |
9891 if (!redrawing() || line_count <= 0) | 10005 if (!redrawing() || line_count <= 0) |
9892 return FAIL; | 10006 return FAIL; |
9893 | 10007 |
9894 /* When inserting lines would result in loss of command output, just redraw | 10008 // When inserting lines would result in loss of command output, just redraw |
9895 * the lines. */ | 10009 // the lines. |
9896 if (no_win_do_lines_ins && !del) | 10010 if (no_win_do_lines_ins && !del) |
9897 return FAIL; | 10011 return FAIL; |
9898 | 10012 |
9899 /* only a few lines left: redraw is faster */ | 10013 // only a few lines left: redraw is faster |
9900 if (mayclear && Rows - line_count < 5 && wp->w_width == Columns) | 10014 if (mayclear && Rows - line_count < 5 && wp->w_width == Columns) |
9901 { | 10015 { |
9902 if (!no_win_do_lines_ins) | 10016 if (!no_win_do_lines_ins) |
9903 screenclear(); /* will set wp->w_lines_valid to 0 */ | 10017 screenclear(); // will set wp->w_lines_valid to 0 |
9904 return FAIL; | 10018 return FAIL; |
9905 } | 10019 } |
9906 | 10020 |
9907 /* | 10021 #ifdef FEAT_TEXT_PROP |
9908 * Delete all remaining lines | 10022 // this doesn't work when tere are popups visible |
9909 */ | 10023 if (popup_visible) |
10024 return FAIL; | |
10025 #endif | |
10026 | |
10027 // Delete all remaining lines | |
9910 if (row + line_count >= wp->w_height) | 10028 if (row + line_count >= wp->w_height) |
9911 { | 10029 { |
9912 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height, | 10030 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height, |
9913 wp->w_wincol, (int)W_ENDCOL(wp), | 10031 wp->w_wincol, (int)W_ENDCOL(wp), |
9914 ' ', ' ', 0); | 10032 ' ', ' ', 0); |
10022 * - there is no valid screen | 10140 * - there is no valid screen |
10023 * - the screen has to be redrawn completely | 10141 * - the screen has to be redrawn completely |
10024 * - the line count is less than one | 10142 * - the line count is less than one |
10025 * - the line count is more than 'ttyscroll' | 10143 * - the line count is more than 'ttyscroll' |
10026 * - redrawing for a callback and there is a modeless selection | 10144 * - redrawing for a callback and there is a modeless selection |
10145 * - there is a popup window | |
10027 */ | 10146 */ |
10028 if (!screen_valid(TRUE) || line_count <= 0 || line_count > p_ttyscroll | 10147 if (!screen_valid(TRUE) |
10148 || line_count <= 0 || line_count > p_ttyscroll | |
10029 #ifdef FEAT_CLIPBOARD | 10149 #ifdef FEAT_CLIPBOARD |
10030 || (clip_star.state != SELECT_CLEARED | 10150 || (clip_star.state != SELECT_CLEARED |
10031 && redrawing_for_callback > 0) | 10151 && redrawing_for_callback > 0) |
10152 #endif | |
10153 #ifdef FEAT_TEXT_PROP | |
10154 || popup_visible | |
10032 #endif | 10155 #endif |
10033 ) | 10156 ) |
10034 return FAIL; | 10157 return FAIL; |
10035 | 10158 |
10036 /* | 10159 /* |
11134 maketitle(); | 11257 maketitle(); |
11135 #endif | 11258 #endif |
11136 /* Redraw the tab pages line if needed. */ | 11259 /* Redraw the tab pages line if needed. */ |
11137 if (redraw_tabline) | 11260 if (redraw_tabline) |
11138 draw_tabline(); | 11261 draw_tabline(); |
11139 | |
11140 #ifdef FEAT_TEXT_PROP | |
11141 // Display popup windows on top of everything. | |
11142 update_popups(); | |
11143 #endif | |
11144 } | 11262 } |
11145 | 11263 |
11146 #ifdef FEAT_CMDL_INFO | 11264 #ifdef FEAT_CMDL_INFO |
11147 static void | 11265 static void |
11148 win_redr_ruler(win_T *wp, int always, int ignore_pum) | 11266 win_redr_ruler(win_T *wp, int always, int ignore_pum) |