Patch 8.2.0468
Problem: GUI: pixel dust with some fonts and characters.
Solution: Always redraw the character before the cursor. (Nir Lichtman,
closes #5549, closes #5856)
Files: src/gui.c, src/proto/
gui.pro, src/screen.c
*** ../vim-8.2.0467/src/gui.c 2020-03-23 22:12:15.500961012 +0100
--- src/gui.c 2020-03-28 20:36:38.211860408 +0100
***************
*** 2630,2647 ****
/*
* Un-draw the cursor. Actually this just redraws the character at the given
! * position. The character just before it too, for when it was in bold.
*/
void
gui_undraw_cursor(void)
{
if (gui.cursor_is_valid)
{
! if (gui_redraw_block(gui.cursor_row, gui.cursor_col,
! gui.cursor_row, gui.cursor_col, GUI_MON_NOCLEAR)
! && gui.cursor_col > 0)
! (void)gui_redraw_block(gui.cursor_row, gui.cursor_col - 1,
! gui.cursor_row, gui.cursor_col - 1, GUI_MON_NOCLEAR);
// Cursor_is_valid is reset when the cursor is undrawn, also reset it
// here in case it wasn't needed to undraw it.
gui.cursor_is_valid = FALSE;
--- 2630,2648 ----
/*
* Un-draw the cursor. Actually this just redraws the character at the given
! * position.
*/
void
gui_undraw_cursor(void)
{
if (gui.cursor_is_valid)
{
! // Redraw the character just before too, if there is one, because with
! // some fonts and characters there can be a one pixel overlap.
! gui_redraw_block(gui.cursor_row,
! gui.cursor_col > 0 ? gui.cursor_col - 1 : gui.cursor_col,
! gui.cursor_row, gui.cursor_col, GUI_MON_NOCLEAR);
!
// Cursor_is_valid is reset when the cursor is undrawn, also reset it
// here in case it wasn't needed to undraw it.
gui.cursor_is_valid = FALSE;
***************
*** 2662,2668 ****
row2 = Y_2_ROW(y + h - 1);
col2 = X_2_COL(x + w - 1);
! (void)gui_redraw_block(row1, col1, row2, col2, GUI_MON_NOCLEAR);
/*
* We may need to redraw the cursor, but don't take it upon us to change
--- 2663,2669 ----
row2 = Y_2_ROW(y + h - 1);
col2 = X_2_COL(x + w - 1);
! gui_redraw_block(row1, col1, row2, col2, GUI_MON_NOCLEAR);
/*
* We may need to redraw the cursor, but don't take it upon us to change
***************
*** 2678,2687 ****
/*
* Draw a rectangular block of characters, from row1 to row2 (inclusive) and
* from col1 to col2 (inclusive).
- * Return TRUE when the character before the first drawn character has
- * different attributes (may have to be redrawn too).
*/
! int
gui_redraw_block(
int row1,
int col1,
--- 2679,2686 ----
/*
* Draw a rectangular block of characters, from row1 to row2 (inclusive) and
* from col1 to col2 (inclusive).
*/
! void
gui_redraw_block(
int row1,
int col1,
***************
*** 2695,2706 ****
sattr_T first_attr;
int idx, len;
int back, nback;
- int retval = FALSE;
int orig_col1, orig_col2;
// Don't try to update when ScreenLines is not valid
if (!screen_cleared || ScreenLines == NULL)
! return retval;
// Don't try to draw outside the shell!
// Check everything, strange values may be caused by a big border width
--- 2694,2704 ----
sattr_T first_attr;
int idx, len;
int back, nback;
int orig_col1, orig_col2;
// Don't try to update when ScreenLines is not valid
if (!screen_cleared || ScreenLines == NULL)
! return;
// Don't try to draw outside the shell!
// Check everything, strange values may be caused by a big border width
***************
*** 2762,2769 ****
if (ScreenAttrs[off - 1 - back] != ScreenAttrs[off]
|| ScreenLines[off - 1 - back] == ' ')
break;
- retval = (col1 > 0 && ScreenAttrs[off - 1] != 0 && back == 0
- && ScreenLines[off - 1] != ' ');
// Break it up in strings of characters with the same attributes.
// Print UTF-8 characters individually.
--- 2760,2765 ----
***************
*** 2845,2852 ****
gui.row = old_row;
gui.col = old_col;
gui.highlight_mask = (int)old_hl_mask;
-
- return retval;
}
static void
--- 2841,2846 ----
*** ../vim-8.2.0467/src/proto/
gui.pro 2019-12-12 12:55:39.000000000 +0100
--- src/proto/
gui.pro 2020-03-28 20:32:10.324850738 +0100
***************
*** 27,33 ****
void gui_may_flush(void);
void gui_undraw_cursor(void);
void gui_redraw(int x, int y, int w, int h);
! int gui_redraw_block(int row1, int col1, int row2, int col2, int flags);
int gui_wait_for_chars(long wtime, int tb_change_cnt);
int gui_inchar(char_u *buf, int maxlen, long wtime, int tb_change_cnt);
void gui_send_mouse_event(int button, int x, int y, int repeated_click, int_u modifiers);
--- 27,33 ----
void gui_may_flush(void);
void gui_undraw_cursor(void);
void gui_redraw(int x, int y, int w, int h);
! void gui_redraw_block(int row1, int col1, int row2, int col2, int flags);
int gui_wait_for_chars(long wtime, int tb_change_cnt);
int gui_inchar(char_u *buf, int maxlen, long wtime, int tb_change_cnt);
void gui_send_mouse_event(int button, int x, int y, int repeated_click, int_u modifiers);
*** ../vim-8.2.0467/src/screen.c 2020-02-26 16:15:31.072386953 +0100
--- src/screen.c 2020-03-28 20:36:23.843913641 +0100
***************
*** 2788,2798 ****
&& ScreenLines != NULL
&& old_Rows != Rows)
{
! (void)gui_redraw_block(0, 0, (int)Rows - 1, (int)Columns - 1, 0);
! /*
! * Adjust the position of the cursor, for when executing an external
! * command.
! */
if (msg_row >= Rows) // Rows got smaller
msg_row = Rows - 1; // put cursor at last row
else if (Rows > old_Rows) // Rows got bigger
--- 2788,2797 ----
&& ScreenLines != NULL
&& old_Rows != Rows)
{
! gui_redraw_block(0, 0, (int)Rows - 1, (int)Columns - 1, 0);
!
! // Adjust the position of the cursor, for when executing an external
! // command.
if (msg_row >= Rows) // Rows got smaller
msg_row = Rows - 1; // put cursor at last row
else if (Rows > old_Rows) // Rows got bigger
*** ../vim-8.2.0467/src/version.c 2020-03-28 19:41:29.595765241 +0100
--- src/version.c 2020-03-28 20:38:05.263537467 +0100
***************
*** 740,741 ****
--- 740,743 ----
{ /* Add new patch number below this line */
+ /**/
+ 468,
/**/
--
CONCORDE: Quickly, sir, come this way!
LAUNCELOT: No! It's not right for my idiom. I must escape more ... more ...
CONCORDE: Dramatically, sir?
LAUNCELOT: Dramatically.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///