comparison src/screen.c @ 30608:c3398c601bfa v9.0.0639

patch 9.0.0639: checking for popup in screen_char() is too late Commit: https://github.com/vim/vim/commit/ff85d4a1076dc7d6fc3102f6560df3ad1af696ae Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 2 15:21:04 2022 +0100 patch 9.0.0639: checking for popup in screen_char() is too late Problem: Checking for popup in screen_char() is too late, the attribute has already been changed. Solution: Move check for popup to where screen_char() is called.
author Bram Moolenaar <Bram@vim.org>
date Sun, 02 Oct 2022 16:30:04 +0200
parents c5356021a938
children dfb02f9dcbe8
comparison
equal deleted inserted replaced
30607:d3a64e0e7374 30608:c3398c601bfa
726 off_to += char_cells; 726 off_to += char_cells;
727 off_from += char_cells; 727 off_from += char_cells;
728 col += char_cells; 728 col += char_cells;
729 } 729 }
730 730
731 if (clear_next) 731 if (clear_next && !skip_for_popup(row, col + coloff))
732 { 732 {
733 // Clear the second half of a double-wide character of which the left 733 // Clear the second half of a double-wide character of which the left
734 // half was overwritten with a single-wide character. 734 // half was overwritten with a single-wide character.
735 ScreenLines[off_to] = ' '; 735 ScreenLines[off_to] = ' ';
736 if (enc_utf8) 736 if (enc_utf8)
790 prev_cells = (*mb_off2cells)(off, max_off); 790 prev_cells = (*mb_off2cells)(off, max_off);
791 off += prev_cells; 791 off += prev_cells;
792 } 792 }
793 } 793 }
794 794
795 if (enc_dbcs != 0 && prev_cells > 1) 795 if (!skip_for_popup(row, col + coloff - prev_cells))
796 screen_char_2(off_to - prev_cells, row, 796 {
797 if (enc_dbcs != 0 && prev_cells > 1)
798 screen_char_2(off_to - prev_cells, row,
797 col + coloff - prev_cells); 799 col + coloff - prev_cells);
798 else 800 else
799 screen_char(off_to - prev_cells, row, 801 screen_char(off_to - prev_cells, row,
800 col + coloff - prev_cells); 802 col + coloff - prev_cells);
803 }
801 } 804 }
802 } 805 }
803 #endif 806 #endif
804 screen_fill(row, row + 1, col + coloff, clear_width + coloff, 807 screen_fill(row, row + 1, col + coloff, clear_width + coloff,
805 ' ', ' ', 0); 808 ' ', ' ', 0);
819 { 822 {
820 // For a window that has a right neighbor, draw the separator char 823 // For a window that has a right neighbor, draw the separator char
821 // right of the window contents. But not on top of a popup window. 824 // right of the window contents. But not on top of a popup window.
822 if (coloff + col < Columns) 825 if (coloff + col < Columns)
823 { 826 {
824 #ifdef FEAT_PROP_POPUP 827 if (!skip_for_popup(row, col + coloff))
825 if (!blocked_by_popup(row, col + coloff))
826 #endif
827 { 828 {
828 int c; 829 int c;
829 830
830 c = fillchar_vsep(&hl, wp); 831 c = fillchar_vsep(&hl, wp);
831 if (ScreenLines[off_to] != (schar_T)c 832 if (ScreenLines[off_to] != (schar_T)c
1562 #ifdef FEAT_GUI 1563 #ifdef FEAT_GUI
1563 && !gui.in_use 1564 && !gui.in_use
1564 #endif 1565 #endif
1565 && mb_fix_col(col, row) != col) 1566 && mb_fix_col(col, row) != col)
1566 { 1567 {
1567 ScreenLines[off - 1] = ' '; 1568 if (!skip_for_popup(row, col - 1))
1568 ScreenAttrs[off - 1] = 0; 1569 {
1569 if (enc_utf8) 1570 ScreenLines[off - 1] = ' ';
1570 { 1571 ScreenAttrs[off - 1] = 0;
1571 ScreenLinesUC[off - 1] = 0; 1572 if (enc_utf8)
1572 ScreenLinesC[0][off - 1] = 0; 1573 {
1573 } 1574 ScreenLinesUC[off - 1] = 0;
1574 // redraw the previous cell, make it empty 1575 ScreenLinesC[0][off - 1] = 0;
1575 screen_char(off - 1, row, col - 1); 1576 }
1577 // redraw the previous cell, make it empty
1578 screen_char(off - 1, row, col - 1);
1579 }
1576 // force the cell at "col" to be redrawn 1580 // force the cell at "col" to be redrawn
1577 force_redraw_next = TRUE; 1581 force_redraw_next = TRUE;
1578 } 1582 }
1579 1583
1580 max_off = LineOffset[row] + screen_Columns; 1584 max_off = LineOffset[row] + screen_Columns;
1649 || (ScreenLinesUC[off] != 0 1653 || (ScreenLinesUC[off] != 0
1650 && screen_comp_differs(off, u8cc)))) 1654 && screen_comp_differs(off, u8cc))))
1651 || ScreenAttrs[off] != attr 1655 || ScreenAttrs[off] != attr
1652 || exmode_active; 1656 || exmode_active;
1653 1657
1654 if ((need_redraw || force_redraw_this) 1658 if ((need_redraw || force_redraw_this) && !skip_for_popup(row, col))
1655 #ifdef FEAT_PROP_POPUP
1656 && !blocked_by_popup(row, col)
1657 #endif
1658 )
1659 { 1659 {
1660 #if defined(FEAT_GUI) || defined(UNIX) 1660 #if defined(FEAT_GUI) || defined(UNIX)
1661 // The bold trick makes a single row of pixels appear in the next 1661 // The bold trick makes a single row of pixels appear in the next
1662 // character. When a bold character is removed, the next 1662 // character. When a bold character is removed, the next
1663 // character should be redrawn too. This happens for our own GUI 1663 // character should be redrawn too. This happens for our own GUI
1770 } 1770 }
1771 } 1771 }
1772 1772
1773 // If we detected the next character needs to be redrawn, but the text 1773 // If we detected the next character needs to be redrawn, but the text
1774 // doesn't extend up to there, update the character here. 1774 // doesn't extend up to there, update the character here.
1775 if (force_redraw_next && col < screen_Columns) 1775 if (force_redraw_next && col < screen_Columns && !skip_for_popup(row, col))
1776 { 1776 {
1777 if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1) 1777 if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1)
1778 screen_char_2(off, row, col); 1778 screen_char_2(off, row, col);
1779 else 1779 else
1780 screen_char(off, row, col); 1780 screen_char(off, row, col);
2179 // Check for illegal values, just in case (could happen just after 2179 // Check for illegal values, just in case (could happen just after
2180 // resizing). 2180 // resizing).
2181 if (row >= screen_Rows || col >= screen_Columns) 2181 if (row >= screen_Rows || col >= screen_Columns)
2182 return; 2182 return;
2183 2183
2184 // Skip if under the popup menu.
2185 if (skip_for_popup(row, col))
2186 return;
2187
2188 // Outputting a character in the last cell on the screen may scroll the 2184 // Outputting a character in the last cell on the screen may scroll the
2189 // screen up. Only do it when the "xn" termcap property is set, otherwise 2185 // screen up. Only do it when the "xn" termcap property is set, otherwise
2190 // mark the character invalid (update it when scrolled up). 2186 // mark the character invalid (update it when scrolled up).
2191 if (*T_XN == NUL 2187 if (*T_XN == NUL
2192 && row == screen_Rows - 1 && col == screen_Columns - 1 2188 && row == screen_Rows - 1 && col == screen_Columns - 1
2313 max_off = off + screen_Columns; 2309 max_off = off + screen_Columns;
2314 for (c = col; c < col + width; ++c) 2310 for (c = col; c < col + width; ++c)
2315 { 2311 {
2316 if (enc_dbcs != 0 && dbcs_off2cells(off + c, max_off) > 1) 2312 if (enc_dbcs != 0 && dbcs_off2cells(off + c, max_off) > 1)
2317 { 2313 {
2318 screen_char_2(off + c, r, c); 2314 if (!skip_for_popup(r, c))
2315 screen_char_2(off + c, r, c);
2319 ++c; 2316 ++c;
2320 } 2317 }
2321 else 2318 else
2322 { 2319 {
2323 screen_char(off + c, r, c); 2320 if (!skip_for_popup(r, c))
2321 screen_char(off + c, r, c);
2324 if (utf_off2cells(off + c, max_off) > 1) 2322 if (utf_off2cells(off + c, max_off) > 1)
2325 ++c; 2323 ++c;
2326 } 2324 }
2327 } 2325 }
2328 } 2326 }
2484 || must_redraw == UPD_CLEAR // screen clear pending 2482 || must_redraw == UPD_CLEAR // screen clear pending
2485 #if defined(FEAT_GUI) || defined(UNIX) 2483 #if defined(FEAT_GUI) || defined(UNIX)
2486 || force_next 2484 || force_next
2487 #endif 2485 #endif
2488 ) 2486 )
2489 #ifdef FEAT_PROP_POPUP
2490 // Skip if under a(nother) popup. 2487 // Skip if under a(nother) popup.
2491 && !blocked_by_popup(row, col) 2488 && !skip_for_popup(row, col))
2492 #endif
2493 )
2494 { 2489 {
2495 #if defined(FEAT_GUI) || defined(UNIX) 2490 #if defined(FEAT_GUI) || defined(UNIX)
2496 // The bold trick may make a single row of pixels appear in 2491 // The bold trick may make a single row of pixels appear in
2497 // the next character. When a bold character is removed, the 2492 // the next character. When a bold character is removed, the
2498 // next character should be redrawn too. This happens for our 2493 // next character should be redrawn too. This happens for our