Mercurial > vim
comparison src/screen.c @ 9848:664276833670 v7.4.2199
commit https://github.com/vim/vim/commit/107abd2ca53c31fd3bb40d77ff296e98eaae2975
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 12 14:08:25 2016 +0200
patch 7.4.2199
Problem: In the GUI the cursor is hidden when redrawing any window,
causing flicker.
Solution: Only undraw the cursor when updating the window it's in.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 12 Aug 2016 14:15:05 +0200 |
parents | a990e7ed260b |
children | 4eea48b76d03 |
comparison
equal
deleted
inserted
replaced
9847:9dd04cad0feb | 9848:664276833670 |
---|---|
496 static int did_intro = FALSE; | 496 static int did_intro = FALSE; |
497 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD) | 497 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD) |
498 int did_one; | 498 int did_one; |
499 #endif | 499 #endif |
500 #ifdef FEAT_GUI | 500 #ifdef FEAT_GUI |
501 int did_undraw = FALSE; | |
501 int gui_cursor_col; | 502 int gui_cursor_col; |
502 int gui_cursor_row; | 503 int gui_cursor_row; |
503 #endif | 504 #endif |
504 | 505 |
505 /* Don't do anything if the screen structures are (not yet) valid. */ | 506 /* Don't do anything if the screen structures are (not yet) valid. */ |
695 # endif | 696 # endif |
696 #ifdef FEAT_GUI | 697 #ifdef FEAT_GUI |
697 /* Remove the cursor before starting to do anything, because | 698 /* Remove the cursor before starting to do anything, because |
698 * scrolling may make it difficult to redraw the text under | 699 * scrolling may make it difficult to redraw the text under |
699 * it. */ | 700 * it. */ |
700 if (gui.in_use) | 701 if (gui.in_use && wp == curwin) |
701 { | 702 { |
702 gui_cursor_col = gui.cursor_col; | 703 gui_cursor_col = gui.cursor_col; |
703 gui_cursor_row = gui.cursor_row; | 704 gui_cursor_row = gui.cursor_row; |
704 gui_undraw_cursor(); | 705 gui_undraw_cursor(); |
706 did_undraw = TRUE; | |
705 } | 707 } |
706 #endif | 708 #endif |
707 } | 709 } |
708 #endif | 710 #endif |
709 win_update(wp); | 711 win_update(wp); |
755 /* Redraw the cursor and update the scrollbars when all screen updating is | 757 /* Redraw the cursor and update the scrollbars when all screen updating is |
756 * done. */ | 758 * done. */ |
757 if (gui.in_use) | 759 if (gui.in_use) |
758 { | 760 { |
759 out_flush(); /* required before updating the cursor */ | 761 out_flush(); /* required before updating the cursor */ |
760 if (did_one && !gui_mch_is_blink_off()) | 762 if (did_undraw && !gui_mch_is_blink_off()) |
761 { | 763 { |
762 /* Put the GUI position where the cursor was, gui_update_cursor() | 764 /* Put the GUI position where the cursor was, gui_update_cursor() |
763 * uses that. */ | 765 * uses that. */ |
764 gui.col = gui_cursor_col; | 766 gui.col = gui_cursor_col; |
765 gui.row = gui_cursor_row; | 767 gui.row = gui_cursor_row; |
9677 #endif | 9679 #endif |
9678 | 9680 |
9679 #ifdef FEAT_GUI | 9681 #ifdef FEAT_GUI |
9680 /* Don't update the GUI cursor here, ScreenLines[] is invalid until the | 9682 /* Don't update the GUI cursor here, ScreenLines[] is invalid until the |
9681 * scrolling is actually carried out. */ | 9683 * scrolling is actually carried out. */ |
9682 gui_dont_update_cursor(); | 9684 gui_dont_update_cursor(row + off <= gui.cursor_row); |
9683 #endif | 9685 #endif |
9684 | 9686 |
9685 if (*T_CCS != NUL) /* cursor relative to region */ | 9687 if (*T_CCS != NUL) /* cursor relative to region */ |
9686 cursor_row = row; | 9688 cursor_row = row; |
9687 else | 9689 else |
9779 #endif | 9781 #endif |
9780 return OK; | 9782 return OK; |
9781 } | 9783 } |
9782 | 9784 |
9783 /* | 9785 /* |
9784 * delete lines on the screen and update ScreenLines[] | 9786 * Delete lines on the screen and update ScreenLines[]. |
9785 * 'end' is the line after the scrolled part. Normally it is Rows. | 9787 * "end" is the line after the scrolled part. Normally it is Rows. |
9786 * When scrolling region used 'off' is the offset from the top for the region. | 9788 * When scrolling region used "off" is the offset from the top for the region. |
9787 * 'row' and 'end' are relative to the start of the region. | 9789 * "row" and "end" are relative to the start of the region. |
9788 * | 9790 * |
9789 * Return OK for success, FAIL if the lines are not deleted. | 9791 * Return OK for success, FAIL if the lines are not deleted. |
9790 */ | 9792 */ |
9791 int | 9793 int |
9792 screen_del_lines( | 9794 screen_del_lines( |
9898 #endif | 9900 #endif |
9899 | 9901 |
9900 #ifdef FEAT_GUI | 9902 #ifdef FEAT_GUI |
9901 /* Don't update the GUI cursor here, ScreenLines[] is invalid until the | 9903 /* Don't update the GUI cursor here, ScreenLines[] is invalid until the |
9902 * scrolling is actually carried out. */ | 9904 * scrolling is actually carried out. */ |
9903 gui_dont_update_cursor(); | 9905 gui_dont_update_cursor(gui.cursor_row >= row + off |
9906 && gui.cursor_row < end + off); | |
9904 #endif | 9907 #endif |
9905 | 9908 |
9906 if (*T_CCS != NUL) /* cursor relative to region */ | 9909 if (*T_CCS != NUL) /* cursor relative to region */ |
9907 { | 9910 { |
9908 cursor_row = row; | 9911 cursor_row = row; |