comparison src/popupwin.c @ 17506:74b6674b99fd v8.1.1751

patch 8.1.1751: when redrawing popups plines_win() may be called often commit https://github.com/vim/vim/commit/9d5ffceb3fea247a88d4d3936e97b7f488aab6ff Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jul 26 21:01:29 2019 +0200 patch 8.1.1751: when redrawing popups plines_win() may be called often Problem: When redrawing popups plines_win() may be called often. Solution: Pass a cache to mouse_comp_pos().
author Bram Moolenaar <Bram@vim.org>
date Fri, 26 Jul 2019 21:15:06 +0200
parents 57b9fca8c7d2
children 34966be2e856
comparison
equal deleted inserted replaced
17505:a76219d230b3 17506:74b6674b99fd
2591 } 2591 }
2592 2592
2593 // Only check which lines are to be updated if not already 2593 // Only check which lines are to be updated if not already
2594 // updating all lines. 2594 // updating all lines.
2595 if (mask == popup_mask_next) 2595 if (mask == popup_mask_next)
2596 {
2597 int *plines_cache = ALLOC_CLEAR_MULT(int, Rows);
2598 win_T *prev_wp = NULL;
2599
2596 for (line = 0; line < screen_Rows; ++line) 2600 for (line = 0; line < screen_Rows; ++line)
2597 { 2601 {
2598 int col_done = 0; 2602 int col_done = 0;
2599 2603
2600 for (col = 0; col < screen_Columns; ++col) 2604 for (col = 0; col < screen_Columns; ++col)
2623 // w_redraw_top and w_redr_bot. Only needs to be done 2627 // w_redraw_top and w_redr_bot. Only needs to be done
2624 // once for each window line. 2628 // once for each window line.
2625 wp = mouse_find_win(&line_cp, &col_cp, IGNORE_POPUP); 2629 wp = mouse_find_win(&line_cp, &col_cp, IGNORE_POPUP);
2626 if (wp != NULL) 2630 if (wp != NULL)
2627 { 2631 {
2632 if (wp != prev_wp)
2633 {
2634 vim_memset(plines_cache, 0, sizeof(int) * Rows);
2635 prev_wp = wp;
2636 }
2637
2628 if (line_cp >= wp->w_height) 2638 if (line_cp >= wp->w_height)
2629 // In (or below) status line 2639 // In (or below) status line
2630 wp->w_redr_status = TRUE; 2640 wp->w_redr_status = TRUE;
2631 // compute the position in the buffer line from the 2641 // compute the position in the buffer line from the
2632 // position on the screen 2642 // position on the screen
2633 else if (mouse_comp_pos(wp, &line_cp, &col_cp, 2643 else if (mouse_comp_pos(wp, &line_cp, &col_cp,
2634 &lnum)) 2644 &lnum, plines_cache))
2635 // past bottom 2645 // past bottom
2636 wp->w_redr_status = TRUE; 2646 wp->w_redr_status = TRUE;
2637 else 2647 else
2638 redrawWinline(wp, lnum); 2648 redrawWinline(wp, lnum);
2639 2649
2643 } 2653 }
2644 } 2654 }
2645 } 2655 }
2646 } 2656 }
2647 } 2657 }
2658
2659 vim_free(plines_cache);
2660 }
2648 } 2661 }
2649 2662
2650 /* 2663 /*
2651 * Return a string of "len" spaces in IObuff. 2664 * Return a string of "len" spaces in IObuff.
2652 */ 2665 */