A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/c29a14d1fa58d5472bd14fec99c5b4228ed38b24 below:

reduce cursorline redrawing when jumping around · neovim/neovim@c29a14d · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+10

-32

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+10

-32

lines changed Original file line number Diff line number Diff line change

@@ -119,7 +119,6 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)

119 119

update_topline_win(win);

120 120 121 121

redraw_later(win, VALID);

122 -

redraw_for_cursorline(win);

123 122

win->w_redr_status = true;

124 123

}

125 124 Original file line number Diff line number Diff line change

@@ -95,33 +95,15 @@ static void comp_botline(win_T *wp)

95 95

win_check_anchored_floats(wp);

96 96

}

97 97 98 -

void reset_cursorline(void)

99 -

{

100 -

curwin->w_last_cursorline = 0;

101 -

}

102 - 103 98

// Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is set.

104 99

void redraw_for_cursorline(win_T *wp)

105 100

FUNC_ATTR_NONNULL_ALL

106 101

{

107 102

if ((wp->w_p_rnu || win_cursorline_standout(wp))

108 103

&& (wp->w_valid & VALID_CROW) == 0

109 104

&& !pum_visible()) {

110 -

if (wp->w_p_rnu) {

111 -

// win_line() will redraw the number column only.

112 -

redraw_later(wp, VALID);

113 -

}

114 -

if (win_cursorline_standout(wp)) {

115 -

if (wp->w_redr_type <= VALID && wp->w_last_cursorline != 0) {

116 -

// "w_last_cursorline" may be outdated, worst case we redraw

117 -

// too much. This is optimized for moving the cursor around in

118 -

// the current window.

119 -

redrawWinline(wp, wp->w_last_cursorline);

120 -

redrawWinline(wp, wp->w_cursor.lnum);

121 -

} else {

122 -

redraw_later(wp, SOME_VALID);

123 -

}

124 -

}

105 +

// win_line() will redraw the number column and cursorline only.

106 +

redraw_later(wp, VALID);

125 107

}

126 108

}

127 109 Original file line number Diff line number Diff line change

@@ -3962,11 +3962,8 @@ static char *set_bool_option(const int opt_idx, char_u *const varp, const int va

3962 3962

} else if ((int *)varp == &p_lnr) {

3963 3963

// 'langnoremap' -> !'langremap'

3964 3964

p_lrm = !p_lnr;

3965 -

} else if ((int *)varp == &curwin->w_p_cul && !value && old_value) {

3966 -

// 'cursorline'

3967 -

reset_cursorline();

3968 -

// 'undofile'

3969 3965

} else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) {

3966 +

// 'undofile'

3970 3967

// Only take action when the option was set. When reset we do not

3971 3968

// delete the undo file, the option may be set again without making

3972 3969

// any changes in between.

Original file line number Diff line number Diff line change

@@ -737,9 +737,6 @@ static void win_update(win_T *wp, DecorProviders *providers)

737 737

#define DID_FOLD 3 // updated a folded line

738 738

int did_update = DID_NONE;

739 739

linenr_T syntax_last_parsed = 0; // last parsed text line

740 -

// remember the current w_last_cursorline, it changes when drawing the new

741 -

// cursor line

742 -

linenr_T last_cursorline = wp->w_last_cursorline;

743 740

linenr_T mod_top = 0;

744 741

linenr_T mod_bot = 0;

745 742

int save_got_int;

@@ -1326,6 +1323,8 @@ static void win_update(win_T *wp, DecorProviders *providers)

1326 1323

DecorProviders line_providers;

1327 1324

decor_providers_invoke_win(wp, providers, &line_providers, &provider_err);

1328 1325 1326 +

bool cursorline_standout = win_cursorline_standout(wp);

1327 + 1329 1328

for (;;) {

1330 1329

/* stop updating when reached the end of the window (check for _past_

1331 1330

* the end of the window is at the end of the loop) */

@@ -1370,8 +1369,8 @@ static void win_update(win_T *wp, DecorProviders *providers)

1370 1369

// if lines were inserted or deleted

1371 1370

|| (wp->w_match_head != NULL

1372 1371

&& buf->b_mod_xlines != 0)))))

1373 -

|| (wp->w_p_cul && (lnum == wp->w_cursor.lnum

1374 -

|| lnum == last_cursorline))) {

1372 +

|| (cursorline_standout && lnum == wp->w_cursor.lnum)

1373 +

|| lnum == wp->w_last_cursorline) {

1375 1374

if (lnum == mod_top) {

1376 1375

top_to_mod = false;

1377 1376

}

@@ -1604,6 +1603,9 @@ static void win_update(win_T *wp, DecorProviders *providers)

1604 1603

* End of loop over all window lines.

1605 1604

*/

1606 1605 1606 +

// Now that the window has been redrawn with the old and new cursor line,

1607 +

// update w_last_cursorline.

1608 +

wp->w_last_cursorline = cursorline_standout ? wp->w_cursor.lnum : 0;

1607 1609 1608 1610

if (idx > wp->w_lines_valid) {

1609 1611

wp->w_lines_valid = idx;

@@ -2383,8 +2385,6 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc

2383 2385

}

2384 2386

area_highlighting = true;

2385 2387

}

2386 -

// Update w_last_cursorline even if Visual mode is active.

2387 -

wp->w_last_cursorline = wp->w_cursor.lnum;

2388 2388

}

2389 2389 2390 2390

memset(sattrs, 0, sizeof(sattrs));

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4