comparison src/screen.c @ 17162:f16cee6adf29 v8.1.1580

patch 8.1.1580: cannot make part of a popup transparent commit https://github.com/vim/vim/commit/c662ec9978e9a381680ffe53d05da0e10bb8d1a0 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 23 00:15:57 2019 +0200 patch 8.1.1580: cannot make part of a popup transparent Problem: Cannot make part of a popup transparent. Solution: Add the "mask" option.
author Bram Moolenaar <Bram@vim.org>
date Sun, 23 Jun 2019 00:30:04 +0200
parents 26941c50baf3
children 983950357c40
comparison
equal deleted inserted replaced
17161:9ccb1ea9b2fc 17162:f16cee6adf29
6263 { 6263 {
6264 return (int)(current_ScreenLine - ScreenLines); 6264 return (int)(current_ScreenLine - ScreenLines);
6265 } 6265 }
6266 #endif 6266 #endif
6267 6267
6268 #ifdef FEAT_TEXT_PROP
6269 /*
6270 * Return TRUE if this position has a higher level popup or this cell is
6271 * transparent in the current popup.
6272 */
6273 static int
6274 blocked_by_popup(int row, int col)
6275 {
6276 int off;
6277
6278 if (!popup_visible)
6279 return FALSE;
6280 off = row * screen_Columns + col;
6281 return popup_mask[off] > screen_zindex || popup_transparent[off];
6282 }
6283 #endif
6284
6268 /* 6285 /*
6269 * Move one "cooked" screen line to the screen, but only the characters that 6286 * Move one "cooked" screen line to the screen, but only the characters that
6270 * have actually changed. Handle insert/delete character. 6287 * have actually changed. Handle insert/delete character.
6271 * "coloff" gives the first column on the screen for this line. 6288 * "coloff" gives the first column on the screen for this line.
6272 * "endcol" gives the columns where valid characters are. 6289 * "endcol" gives the columns where valid characters are.
6369 if (hl & HL_BOLD) 6386 if (hl & HL_BOLD)
6370 redraw_this = TRUE; 6387 redraw_this = TRUE;
6371 } 6388 }
6372 #endif 6389 #endif
6373 #ifdef FEAT_TEXT_PROP 6390 #ifdef FEAT_TEXT_PROP
6374 // Skip if under a(nother) popup. 6391 if (blocked_by_popup(row, col + coloff))
6375 if (popup_mask[row * screen_Columns + col + coloff] > screen_zindex)
6376 redraw_this = FALSE; 6392 redraw_this = FALSE;
6377 #endif 6393 #endif
6378
6379 if (redraw_this) 6394 if (redraw_this)
6380 { 6395 {
6381 /* 6396 /*
6382 * Special handling when 'xs' termcap flag set (hpterm): 6397 * Special handling when 'xs' termcap flag set (hpterm):
6383 * Attributes for characters are stored at the position where the 6398 * Attributes for characters are stored at the position where the
6625 // For a window that has a right neighbor, draw the separator char 6640 // For a window that has a right neighbor, draw the separator char
6626 // right of the window contents. But not on top of a popup window. 6641 // right of the window contents. But not on top of a popup window.
6627 if (coloff + col < Columns) 6642 if (coloff + col < Columns)
6628 { 6643 {
6629 #ifdef FEAT_TEXT_PROP 6644 #ifdef FEAT_TEXT_PROP
6630 if (popup_mask[row * screen_Columns + col + coloff] 6645 if (!blocked_by_popup(row, col + coloff))
6631 <= screen_zindex)
6632 #endif 6646 #endif
6633 { 6647 {
6634 int c; 6648 int c;
6635 6649
6636 c = fillchar_vsep(&hl); 6650 c = fillchar_vsep(&hl);
7719 || ScreenAttrs[off] != attr 7733 || ScreenAttrs[off] != attr
7720 || exmode_active; 7734 || exmode_active;
7721 7735
7722 if ((need_redraw || force_redraw_this) 7736 if ((need_redraw || force_redraw_this)
7723 #ifdef FEAT_TEXT_PROP 7737 #ifdef FEAT_TEXT_PROP
7724 && popup_mask[row * screen_Columns + col] <= screen_zindex 7738 && !blocked_by_popup(row, col)
7725 #endif 7739 #endif
7726 ) 7740 )
7727 { 7741 {
7728 #if defined(FEAT_GUI) || defined(UNIX) 7742 #if defined(FEAT_GUI) || defined(UNIX)
7729 /* The bold trick makes a single row of pixels appear in the next 7743 /* The bold trick makes a single row of pixels appear in the next
8488 # endif 8502 # endif
8489 ) 8503 )
8490 return; 8504 return;
8491 #endif 8505 #endif
8492 #ifdef FEAT_TEXT_PROP 8506 #ifdef FEAT_TEXT_PROP
8493 // Skip if under a(nother) popup. 8507 if (blocked_by_popup(row, col))
8494 if (popup_mask[row * screen_Columns + col] > screen_zindex)
8495 return; 8508 return;
8496 #endif 8509 #endif
8497 8510
8498 /* Outputting a character in the last cell on the screen may scroll the 8511 /* Outputting a character in the last cell on the screen may scroll the
8499 * screen up. Only do it when the "xn" termcap property is set, otherwise 8512 * screen up. Only do it when the "xn" termcap property is set, otherwise
8677 * with character 'c1' in first column followed by 'c2' in the other columns. 8690 * with character 'c1' in first column followed by 'c2' in the other columns.
8678 * Use attributes 'attr'. 8691 * Use attributes 'attr'.
8679 */ 8692 */
8680 void 8693 void
8681 screen_fill( 8694 screen_fill(
8682 int start_row, 8695 int start_row,
8683 int end_row, 8696 int end_row,
8684 int start_col, 8697 int start_col,
8685 int end_col, 8698 int end_col,
8686 int c1, 8699 int c1,
8687 int c2, 8700 int c2,
8688 int attr) 8701 int attr)
8689 { 8702 {
8690 int row; 8703 int row;
8691 int col; 8704 int col;
8692 int off; 8705 int off;
8693 int end_off; 8706 int end_off;
8694 int did_delete; 8707 int did_delete;
8695 int c; 8708 int c;
8696 int norm_term; 8709 int norm_term;
8697 #if defined(FEAT_GUI) || defined(UNIX) 8710 #if defined(FEAT_GUI) || defined(UNIX)
8698 int force_next = FALSE; 8711 int force_next = FALSE;
8699 #endif 8712 #endif
8700 8713
8701 if (end_row > screen_Rows) /* safety check */ 8714 if (end_row > screen_Rows) /* safety check */
8702 end_row = screen_Rows; 8715 end_row = screen_Rows;
8703 if (end_col > screen_Columns) /* safety check */ 8716 if (end_col > screen_Columns) /* safety check */
8792 || force_next 8805 || force_next
8793 #endif 8806 #endif
8794 ) 8807 )
8795 #ifdef FEAT_TEXT_PROP 8808 #ifdef FEAT_TEXT_PROP
8796 // Skip if under a(nother) popup. 8809 // Skip if under a(nother) popup.
8797 && popup_mask[row * screen_Columns + col] <= screen_zindex 8810 && !blocked_by_popup(row, col)
8798 #endif 8811 #endif
8799 ) 8812 )
8800 { 8813 {
8801 #if defined(FEAT_GUI) || defined(UNIX) 8814 #if defined(FEAT_GUI) || defined(UNIX)
8802 /* The bold trick may make a single row of pixels appear in 8815 /* The bold trick may make a single row of pixels appear in
8934 char_u *new_LineWraps; 8947 char_u *new_LineWraps;
8935 short *new_TabPageIdxs; 8948 short *new_TabPageIdxs;
8936 #ifdef FEAT_TEXT_PROP 8949 #ifdef FEAT_TEXT_PROP
8937 short *new_popup_mask; 8950 short *new_popup_mask;
8938 short *new_popup_mask_next; 8951 short *new_popup_mask_next;
8952 char *new_popup_transparent;
8939 #endif 8953 #endif
8940 tabpage_T *tp; 8954 tabpage_T *tp;
8941 static int entered = FALSE; /* avoid recursiveness */ 8955 static int entered = FALSE; /* avoid recursiveness */
8942 static int done_outofmem_msg = FALSE; /* did outofmem message */ 8956 static int done_outofmem_msg = FALSE; /* did outofmem message */
8943 int retry_count = 0; 8957 int retry_count = 0;
9019 new_LineWraps = LALLOC_MULT(char_u, Rows); 9033 new_LineWraps = LALLOC_MULT(char_u, Rows);
9020 new_TabPageIdxs = LALLOC_MULT(short, Columns); 9034 new_TabPageIdxs = LALLOC_MULT(short, Columns);
9021 #ifdef FEAT_TEXT_PROP 9035 #ifdef FEAT_TEXT_PROP
9022 new_popup_mask = LALLOC_MULT(short, Rows * Columns); 9036 new_popup_mask = LALLOC_MULT(short, Rows * Columns);
9023 new_popup_mask_next = LALLOC_MULT(short, Rows * Columns); 9037 new_popup_mask_next = LALLOC_MULT(short, Rows * Columns);
9038 new_popup_transparent = LALLOC_MULT(char, Rows * Columns);
9024 #endif 9039 #endif
9025 9040
9026 FOR_ALL_TAB_WINDOWS(tp, wp) 9041 FOR_ALL_TAB_WINDOWS(tp, wp)
9027 { 9042 {
9028 if (win_alloc_lines(wp) == FAIL) 9043 if (win_alloc_lines(wp) == FAIL)
9065 || new_LineWraps == NULL 9080 || new_LineWraps == NULL
9066 || new_TabPageIdxs == NULL 9081 || new_TabPageIdxs == NULL
9067 #ifdef FEAT_TEXT_PROP 9082 #ifdef FEAT_TEXT_PROP
9068 || new_popup_mask == NULL 9083 || new_popup_mask == NULL
9069 || new_popup_mask_next == NULL 9084 || new_popup_mask_next == NULL
9085 || new_popup_transparent == NULL
9070 #endif 9086 #endif
9071 || outofmem) 9087 || outofmem)
9072 { 9088 {
9073 if (ScreenLines != NULL || !done_outofmem_msg) 9089 if (ScreenLines != NULL || !done_outofmem_msg)
9074 { 9090 {
9089 VIM_CLEAR(new_LineWraps); 9105 VIM_CLEAR(new_LineWraps);
9090 VIM_CLEAR(new_TabPageIdxs); 9106 VIM_CLEAR(new_TabPageIdxs);
9091 #ifdef FEAT_TEXT_PROP 9107 #ifdef FEAT_TEXT_PROP
9092 VIM_CLEAR(new_popup_mask); 9108 VIM_CLEAR(new_popup_mask);
9093 VIM_CLEAR(new_popup_mask_next); 9109 VIM_CLEAR(new_popup_mask_next);
9110 VIM_CLEAR(new_popup_transparent);
9094 #endif 9111 #endif
9095 } 9112 }
9096 else 9113 else
9097 { 9114 {
9098 done_outofmem_msg = FALSE; 9115 done_outofmem_msg = FALSE;
9178 LineOffset = new_LineOffset; 9195 LineOffset = new_LineOffset;
9179 LineWraps = new_LineWraps; 9196 LineWraps = new_LineWraps;
9180 TabPageIdxs = new_TabPageIdxs; 9197 TabPageIdxs = new_TabPageIdxs;
9181 #ifdef FEAT_TEXT_PROP 9198 #ifdef FEAT_TEXT_PROP
9182 popup_mask = new_popup_mask; 9199 popup_mask = new_popup_mask;
9200 vim_memset(popup_mask, 0, Rows * Columns * sizeof(short));
9183 popup_mask_next = new_popup_mask_next; 9201 popup_mask_next = new_popup_mask_next;
9184 vim_memset(popup_mask, 0, Rows * Columns * sizeof(short)); 9202 popup_transparent = new_popup_transparent;
9203 vim_memset(popup_transparent, 0, Rows * Columns * sizeof(char));
9185 popup_mask_refresh = TRUE; 9204 popup_mask_refresh = TRUE;
9186 #endif 9205 #endif
9187 9206
9188 /* It's important that screen_Rows and screen_Columns reflect the actual 9207 /* It's important that screen_Rows and screen_Columns reflect the actual
9189 * size of ScreenLines[]. Set them before calling anything. */ 9208 * size of ScreenLines[]. Set them before calling anything. */
9248 VIM_CLEAR(LineWraps); 9267 VIM_CLEAR(LineWraps);
9249 VIM_CLEAR(TabPageIdxs); 9268 VIM_CLEAR(TabPageIdxs);
9250 #ifdef FEAT_TEXT_PROP 9269 #ifdef FEAT_TEXT_PROP
9251 VIM_CLEAR(popup_mask); 9270 VIM_CLEAR(popup_mask);
9252 VIM_CLEAR(popup_mask_next); 9271 VIM_CLEAR(popup_mask_next);
9272 VIM_CLEAR(popup_transparent);
9253 #endif 9273 #endif
9254 } 9274 }
9255 9275
9256 void 9276 void
9257 screenclear(void) 9277 screenclear(void)