Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/screen.c +++ b/src/screen.c @@ -6265,6 +6265,23 @@ screen_get_current_line_off() } #endif +#ifdef FEAT_TEXT_PROP +/* + * Return TRUE if this position has a higher level popup or this cell is + * transparent in the current popup. + */ + static int +blocked_by_popup(int row, int col) +{ + int off; + + if (!popup_visible) + return FALSE; + off = row * screen_Columns + col; + return popup_mask[off] > screen_zindex || popup_transparent[off]; +} +#endif + /* * Move one "cooked" screen line to the screen, but only the characters that * have actually changed. Handle insert/delete character. @@ -6371,11 +6388,9 @@ screen_line( } #endif #ifdef FEAT_TEXT_PROP - // Skip if under a(nother) popup. - if (popup_mask[row * screen_Columns + col + coloff] > screen_zindex) + if (blocked_by_popup(row, col + coloff)) redraw_this = FALSE; #endif - if (redraw_this) { /* @@ -6627,8 +6642,7 @@ screen_line( if (coloff + col < Columns) { #ifdef FEAT_TEXT_PROP - if (popup_mask[row * screen_Columns + col + coloff] - <= screen_zindex) + if (!blocked_by_popup(row, col + coloff)) #endif { int c; @@ -7721,7 +7735,7 @@ screen_puts_len( if ((need_redraw || force_redraw_this) #ifdef FEAT_TEXT_PROP - && popup_mask[row * screen_Columns + col] <= screen_zindex + && !blocked_by_popup(row, col) #endif ) { @@ -8490,8 +8504,7 @@ screen_char(unsigned off, int row, int c return; #endif #ifdef FEAT_TEXT_PROP - // Skip if under a(nother) popup. - if (popup_mask[row * screen_Columns + col] > screen_zindex) + if (blocked_by_popup(row, col)) return; #endif @@ -8679,23 +8692,23 @@ space_to_screenline(int off, int attr) */ void screen_fill( - int start_row, - int end_row, - int start_col, - int end_col, - int c1, - int c2, - int attr) -{ - int row; - int col; - int off; - int end_off; - int did_delete; - int c; - int norm_term; + int start_row, + int end_row, + int start_col, + int end_col, + int c1, + int c2, + int attr) +{ + int row; + int col; + int off; + int end_off; + int did_delete; + int c; + int norm_term; #if defined(FEAT_GUI) || defined(UNIX) - int force_next = FALSE; + int force_next = FALSE; #endif if (end_row > screen_Rows) /* safety check */ @@ -8794,7 +8807,7 @@ screen_fill( ) #ifdef FEAT_TEXT_PROP // Skip if under a(nother) popup. - && popup_mask[row * screen_Columns + col] <= screen_zindex + && !blocked_by_popup(row, col) #endif ) { @@ -8936,6 +8949,7 @@ screenalloc(int doclear) #ifdef FEAT_TEXT_PROP short *new_popup_mask; short *new_popup_mask_next; + char *new_popup_transparent; #endif tabpage_T *tp; static int entered = FALSE; /* avoid recursiveness */ @@ -9021,6 +9035,7 @@ retry: #ifdef FEAT_TEXT_PROP new_popup_mask = LALLOC_MULT(short, Rows * Columns); new_popup_mask_next = LALLOC_MULT(short, Rows * Columns); + new_popup_transparent = LALLOC_MULT(char, Rows * Columns); #endif FOR_ALL_TAB_WINDOWS(tp, wp) @@ -9067,6 +9082,7 @@ give_up: #ifdef FEAT_TEXT_PROP || new_popup_mask == NULL || new_popup_mask_next == NULL + || new_popup_transparent == NULL #endif || outofmem) { @@ -9091,6 +9107,7 @@ give_up: #ifdef FEAT_TEXT_PROP VIM_CLEAR(new_popup_mask); VIM_CLEAR(new_popup_mask_next); + VIM_CLEAR(new_popup_transparent); #endif } else @@ -9180,8 +9197,10 @@ give_up: TabPageIdxs = new_TabPageIdxs; #ifdef FEAT_TEXT_PROP popup_mask = new_popup_mask; + vim_memset(popup_mask, 0, Rows * Columns * sizeof(short)); popup_mask_next = new_popup_mask_next; - vim_memset(popup_mask, 0, Rows * Columns * sizeof(short)); + popup_transparent = new_popup_transparent; + vim_memset(popup_transparent, 0, Rows * Columns * sizeof(char)); popup_mask_refresh = TRUE; #endif @@ -9250,6 +9269,7 @@ free_screenlines(void) #ifdef FEAT_TEXT_PROP VIM_CLEAR(popup_mask); VIM_CLEAR(popup_mask_next); + VIM_CLEAR(popup_transparent); #endif }