Mercurial > vim
diff src/window.c @ 32479:87f59a64efab v9.0.1571
patch 9.0.1571: RedrawingDisabled not used consistently
Commit: https://github.com/vim/vim/commit/79cdf026f1b8a16298ee73be497c4bd5f3458cde
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 20 14:07:00 2023 +0100
patch 9.0.1571: RedrawingDisabled not used consistently
Problem: RedrawingDisabled not used consistently.
Solution: Avoid RedrawingDisabled going negative. Set RedrawingDisabled in
win_split_ins(). (closes #11961)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 20 May 2023 15:15:05 +0200 |
parents | 48b95cef8fa2 |
children | d6055989fa27 |
line wrap: on
line diff
--- a/src/window.c +++ b/src/window.c @@ -950,6 +950,10 @@ win_split_ins( int minheight; int wmh1; int did_set_fraction = FALSE; + int retval = FAIL; + + // Do not redraw here, curwin->w_buffer may be invalid. + ++RedrawingDisabled; if (flags & WSP_TOP) oldwin = firstwin; @@ -964,7 +968,7 @@ win_split_ins( if (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL) { emsg(_(e_not_enough_room)); - return FAIL; + goto theend; } need_status = STATUS_HEIGHT; } @@ -1022,7 +1026,7 @@ win_split_ins( if (available < needed && new_wp == NULL) { emsg(_(e_not_enough_room)); - return FAIL; + goto theend; } if (new_size == 0) new_size = oldwin->w_width / 2; @@ -1105,7 +1109,7 @@ win_split_ins( if (available < needed && new_wp == NULL) { emsg(_(e_not_enough_room)); - return FAIL; + goto theend; } oldwin_height = oldwin->w_height; if (need_status) @@ -1188,13 +1192,13 @@ win_split_ins( if (new_wp == NULL) { if (wp == NULL) - return FAIL; + goto theend; new_frame(wp); if (wp->w_frame == NULL) { win_free(wp, NULL); - return FAIL; + goto theend; } // make the contents of the new window the same as the current one @@ -1435,8 +1439,12 @@ win_split_ins( p_wiw = i; else p_wh = i; - - return OK; + retval = OK; + +theend: + if (RedrawingDisabled > 0) + --RedrawingDisabled; + return retval; } @@ -2460,7 +2468,8 @@ close_windows( } } - --RedrawingDisabled; + if (RedrawingDisabled > 0) + --RedrawingDisabled; if (count != tabpage_index(NULL)) apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);