comparison 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
comparison
equal deleted inserted replaced
32478:8117806f2947 32479:87f59a64efab
948 frame_T *frp, *curfrp, *frp2, *prevfrp; 948 frame_T *frp, *curfrp, *frp2, *prevfrp;
949 int before; 949 int before;
950 int minheight; 950 int minheight;
951 int wmh1; 951 int wmh1;
952 int did_set_fraction = FALSE; 952 int did_set_fraction = FALSE;
953 int retval = FAIL;
954
955 // Do not redraw here, curwin->w_buffer may be invalid.
956 ++RedrawingDisabled;
953 957
954 if (flags & WSP_TOP) 958 if (flags & WSP_TOP)
955 oldwin = firstwin; 959 oldwin = firstwin;
956 else if (flags & WSP_BOT) 960 else if (flags & WSP_BOT)
957 oldwin = lastwin; 961 oldwin = lastwin;
962 if (ONE_WINDOW && p_ls == 1 && oldwin->w_status_height == 0) 966 if (ONE_WINDOW && p_ls == 1 && oldwin->w_status_height == 0)
963 { 967 {
964 if (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL) 968 if (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL)
965 { 969 {
966 emsg(_(e_not_enough_room)); 970 emsg(_(e_not_enough_room));
967 return FAIL; 971 goto theend;
968 } 972 }
969 need_status = STATUS_HEIGHT; 973 need_status = STATUS_HEIGHT;
970 } 974 }
971 975
972 #ifdef FEAT_GUI 976 #ifdef FEAT_GUI
1020 needed += minwidth; 1024 needed += minwidth;
1021 } 1025 }
1022 if (available < needed && new_wp == NULL) 1026 if (available < needed && new_wp == NULL)
1023 { 1027 {
1024 emsg(_(e_not_enough_room)); 1028 emsg(_(e_not_enough_room));
1025 return FAIL; 1029 goto theend;
1026 } 1030 }
1027 if (new_size == 0) 1031 if (new_size == 0)
1028 new_size = oldwin->w_width / 2; 1032 new_size = oldwin->w_width / 2;
1029 if (new_size > available - minwidth - 1) 1033 if (new_size > available - minwidth - 1)
1030 new_size = available - minwidth - 1; 1034 new_size = available - minwidth - 1;
1103 needed += minheight; 1107 needed += minheight;
1104 } 1108 }
1105 if (available < needed && new_wp == NULL) 1109 if (available < needed && new_wp == NULL)
1106 { 1110 {
1107 emsg(_(e_not_enough_room)); 1111 emsg(_(e_not_enough_room));
1108 return FAIL; 1112 goto theend;
1109 } 1113 }
1110 oldwin_height = oldwin->w_height; 1114 oldwin_height = oldwin->w_height;
1111 if (need_status) 1115 if (need_status)
1112 { 1116 {
1113 oldwin->w_status_height = STATUS_HEIGHT; 1117 oldwin->w_status_height = STATUS_HEIGHT;
1186 } 1190 }
1187 1191
1188 if (new_wp == NULL) 1192 if (new_wp == NULL)
1189 { 1193 {
1190 if (wp == NULL) 1194 if (wp == NULL)
1191 return FAIL; 1195 goto theend;
1192 1196
1193 new_frame(wp); 1197 new_frame(wp);
1194 if (wp->w_frame == NULL) 1198 if (wp->w_frame == NULL)
1195 { 1199 {
1196 win_free(wp, NULL); 1200 win_free(wp, NULL);
1197 return FAIL; 1201 goto theend;
1198 } 1202 }
1199 1203
1200 // make the contents of the new window the same as the current one 1204 // make the contents of the new window the same as the current one
1201 win_init(wp, curwin, flags); 1205 win_init(wp, curwin, flags);
1202 } 1206 }
1433 | WEE_TRIGGER_ENTER_AUTOCMDS | WEE_TRIGGER_LEAVE_AUTOCMDS); 1437 | WEE_TRIGGER_ENTER_AUTOCMDS | WEE_TRIGGER_LEAVE_AUTOCMDS);
1434 if (flags & WSP_VERT) 1438 if (flags & WSP_VERT)
1435 p_wiw = i; 1439 p_wiw = i;
1436 else 1440 else
1437 p_wh = i; 1441 p_wh = i;
1438 1442 retval = OK;
1439 return OK; 1443
1444 theend:
1445 if (RedrawingDisabled > 0)
1446 --RedrawingDisabled;
1447 return retval;
1440 } 1448 }
1441 1449
1442 1450
1443 /* 1451 /*
1444 * Initialize window "newp" from window "oldp". 1452 * Initialize window "newp" from window "oldp".
2458 nexttp = first_tabpage; 2466 nexttp = first_tabpage;
2459 break; 2467 break;
2460 } 2468 }
2461 } 2469 }
2462 2470
2463 --RedrawingDisabled; 2471 if (RedrawingDisabled > 0)
2472 --RedrawingDisabled;
2464 2473
2465 if (count != tabpage_index(NULL)) 2474 if (count != tabpage_index(NULL))
2466 apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); 2475 apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);
2467 } 2476 }
2468 2477