comparison src/gui_gtk_x11.c @ 8510:9f5bd031530d v7.4.1545

commit https://github.com/vim/vim/commit/b4ebf9ae3b93d082ab3b9f4aab2f6729f77fa46a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 12 16:28:18 2016 +0100 patch 7.4.1545 Problem: GTK3: horizontal cursor movement in Visual selection not good. Solution: Make it work better. (Kazunobu Kuriyama)
author Christian Brabandt <cb@256bit.org>
date Sat, 12 Mar 2016 16:30:04 +0100
parents 8877ea0a27ec
children 1b38596644ba
comparison
equal deleted inserted replaced
8509:10f405d5daba 8510:9f5bd031530d
648 static gboolean 648 static gboolean
649 gui_gtk3_should_draw_cursor(void) 649 gui_gtk3_should_draw_cursor(void)
650 { 650 {
651 unsigned int cond = 0; 651 unsigned int cond = 0;
652 cond |= gui_gtk_is_blink_on(); 652 cond |= gui_gtk_is_blink_on();
653 cond |= is_key_pressed; 653 if (gui.cursor_col >= gui.col)
654 cond |= is_key_pressed;
654 cond |= gui.in_focus == FALSE; 655 cond |= gui.in_focus == FALSE;
655 return cond; 656 return cond;
656 } 657 }
657 658
658 static gboolean 659 static gboolean
684 { 685 {
685 const cairo_rectangle_t rect = list->rectangles[i]; 686 const cairo_rectangle_t rect = list->rectangles[i];
686 if (blink_mode) 687 if (blink_mode)
687 gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height); 688 gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height);
688 else 689 else
689 gui_redraw(rect.x, rect.y, rect.width, rect.height); 690 {
691 if (get_real_state() & VISUAL)
692 gui_gtk3_redraw(rect.x, rect.y,
693 rect.width, rect.height);
694 else
695 gui_redraw(rect.x, rect.y, rect.width, rect.height);
696 }
690 } 697 }
691 } 698 }
692 cairo_rectangle_list_destroy(list); 699 cairo_rectangle_list_destroy(list);
693 700
701 if (get_real_state() & VISUAL)
702 {
703 if (gui.cursor_row == gui.row && gui.cursor_col >= gui.col)
704 gui_update_cursor(TRUE, TRUE);
705 }
706
694 cairo_paint(cr); 707 cairo_paint(cr);
695 } 708 }
696 gui.by_signal = FALSE; 709 gui.by_signal = FALSE;
697 710
698 /* Add the cursor to the window if necessary.*/ 711 /* Add the cursor to the window if necessary.*/
699 if (gui_gtk3_should_draw_cursor()) 712 if (gui_gtk3_should_draw_cursor() && blink_mode)
700 gui_gtk3_update_cursor(cr); 713 gui_gtk3_update_cursor(cr);
701 714
702 return FALSE; 715 return FALSE;
703 } 716 }
704 #else /* !GTK_CHECK_VERSION(3,0,0) */ 717 #else /* !GTK_CHECK_VERSION(3,0,0) */