comparison src/screen.c @ 30771:cf77f7a19ab6 v9.0.0720

patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing Commit: https://github.com/vim/vim/commit/0c502d2e7031611788c301c7da0896f0fd9515fd Author: Bram Moolenaar <Bram@vim.org> Date: Tue Oct 11 12:48:44 2022 +0100 patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing Problem: MS-Windows GUI may have pixel dust from antialiasing. Solution: When a character changes also redraw the next one. (issue https://github.com/vim/vim/issues/8532)
author Bram Moolenaar <Bram@vim.org>
date Tue, 11 Oct 2022 14:00:07 +0200
parents dfb02f9dcbe8
children c7983f593fa7
comparison
equal deleted inserted replaced
30770:aff0085cbf86 30771:cf77f7a19ab6
473 #ifdef FEAT_GUI 473 #ifdef FEAT_GUI
474 = TRUE // For GUI when while-loop empty 474 = TRUE // For GUI when while-loop empty
475 #endif 475 #endif
476 ; 476 ;
477 int redraw_next; // redraw_this for next character 477 int redraw_next; // redraw_this for next character
478 #ifdef FEAT_GUI_MSWIN
479 int changed_this; // TRUE if character changed
480 int changed_next; // TRUE if next character changed
481 #endif
478 int clear_next = FALSE; 482 int clear_next = FALSE;
479 int char_cells; // 1: normal char 483 int char_cells; // 1: normal char
480 // 2: occupies two display cells 484 // 2: occupies two display cells
481 485
482 // Check for illegal row and col, just in case. 486 // Check for illegal row and col, just in case.
532 screen_char(off_to - 1, row, col + coloff - 1); 536 screen_char(off_to - 1, row, col + coloff - 1);
533 } 537 }
534 #endif 538 #endif
535 539
536 redraw_next = char_needs_redraw(off_from, off_to, endcol - col); 540 redraw_next = char_needs_redraw(off_from, off_to, endcol - col);
541 #ifdef FEAT_GUI_MSWIN
542 changed_next = redraw_next;
543 #endif
537 544
538 while (col < endcol) 545 while (col < endcol)
539 { 546 {
540 if (has_mbyte && (col + 1 < endcol)) 547 if (has_mbyte && (col + 1 < endcol))
541 char_cells = (*mb_off2cells)(off_from, max_off_from); 548 char_cells = (*mb_off2cells)(off_from, max_off_from);
545 redraw_this = redraw_next; 552 redraw_this = redraw_next;
546 redraw_next = force || char_needs_redraw(off_from + char_cells, 553 redraw_next = force || char_needs_redraw(off_from + char_cells,
547 off_to + char_cells, endcol - col - char_cells); 554 off_to + char_cells, endcol - col - char_cells);
548 555
549 #ifdef FEAT_GUI 556 #ifdef FEAT_GUI
557 # ifdef FEAT_GUI_MSWIN
558 changed_this = changed_next;
559 changed_next = redraw_next;
560 # endif
550 // If the next character was bold, then redraw the current character to 561 // If the next character was bold, then redraw the current character to
551 // remove any pixels that might have spilt over into us. This only 562 // remove any pixels that might have spilt over into us. This only
552 // happens in the GUI. 563 // happens in the GUI.
564 // With MS-Windows antialiasing may also cause pixels to spill over
565 // from a previous character, no matter attributes, always redraw if a
566 // character changed.
553 if (redraw_next && gui.in_use) 567 if (redraw_next && gui.in_use)
554 { 568 {
569 # ifndef FEAT_GUI_MSWIN
555 hl = ScreenAttrs[off_to + char_cells]; 570 hl = ScreenAttrs[off_to + char_cells];
556 if (hl > HL_ALL) 571 if (hl > HL_ALL)
557 hl = syn_attr2attr(hl); 572 hl = syn_attr2attr(hl);
558 if (hl & HL_BOLD) 573 if (hl & HL_BOLD)
574 # endif
559 redraw_this = TRUE; 575 redraw_this = TRUE;
560 } 576 }
561 #endif 577 #endif
562 // Do not redraw if under the popup menu. 578 // Do not redraw if under the popup menu.
563 if (redraw_this && skip_for_popup(row, col + coloff)) 579 if (redraw_this && skip_for_popup(row, col + coloff))
686 if (hl > HL_ALL) 702 if (hl > HL_ALL)
687 hl = syn_attr2attr(hl); 703 hl = syn_attr2attr(hl);
688 if (hl & HL_BOLD) 704 if (hl & HL_BOLD)
689 redraw_next = TRUE; 705 redraw_next = TRUE;
690 } 706 }
707 #endif
708 #ifdef FEAT_GUI_MSWIN
709 // MS-Windows antialiasing may spill over to the next character,
710 // redraw that one if this one changed, no matter attributes.
711 if (gui.in_use && changed_this)
712 redraw_next = TRUE;
691 #endif 713 #endif
692 ScreenAttrs[off_to] = ScreenAttrs[off_from]; 714 ScreenAttrs[off_to] = ScreenAttrs[off_from];
693 715
694 // For simplicity set the attributes of second half of a 716 // For simplicity set the attributes of second half of a
695 // double-wide character equal to the first half. 717 // double-wide character equal to the first half.