comparison src/if_ruby.c @ 31263:d8e7d725a666 v9.0.0965

patch 9.0.0965: using one window for executing autocommands is insufficient Commit: https://github.com/vim/vim/commit/e76062c078debed0df818f70e4db14ad7a7cb53a Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 28 18:51:43 2022 +0000 patch 9.0.0965: using one window for executing autocommands is insufficient Problem: Using one window for executing autocommands is insufficient. Solution: Use up to five windows for executing autocommands.
author Bram Moolenaar <Bram@vim.org>
date Mon, 28 Nov 2022 20:00:05 +0100
parents 684e6dfa2fba
children 27c9212d10aa
comparison
equal deleted inserted replaced
31262:7f766b7e17d5 31263:d8e7d725a666
1369 char *line = StringValuePtr(str); 1369 char *line = StringValuePtr(str);
1370 aco_save_T aco; 1370 aco_save_T aco;
1371 1371
1372 if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL) 1372 if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL)
1373 { 1373 {
1374 // set curwin/curbuf for "buf" and save some things 1374 // Set curwin/curbuf for "buf" and save some things.
1375 aucmd_prepbuf(&aco, buf); 1375 aucmd_prepbuf(&aco, buf);
1376 1376 if (curbuf == buf)
1377 if (u_savesub(n) == OK)
1378 { 1377 {
1379 ml_replace(n, (char_u *)line, TRUE); 1378 // Only when it worked to set "curbuf".
1380 changed(); 1379 if (u_savesub(n) == OK)
1380 {
1381 ml_replace(n, (char_u *)line, TRUE);
1382 changed();
1381 #ifdef SYNTAX_HL 1383 #ifdef SYNTAX_HL
1382 syn_changed(n); // recompute syntax hl. for this line 1384 syn_changed(n); // recompute syntax hl. for this line
1383 #endif 1385 #endif
1386 }
1387
1388 // restore curwin/curbuf and a few other things
1389 aucmd_restbuf(&aco);
1390 // Careful: autocommands may have made "buf" invalid!
1384 } 1391 }
1385
1386 // restore curwin/curbuf and a few other things
1387 aucmd_restbuf(&aco);
1388 // Careful: autocommands may have made "buf" invalid!
1389 1392
1390 update_curbuf(UPD_NOT_VALID); 1393 update_curbuf(UPD_NOT_VALID);
1391 } 1394 }
1392 else 1395 else
1393 { 1396 {
1413 long n = NUM2LONG(num); 1416 long n = NUM2LONG(num);
1414 aco_save_T aco; 1417 aco_save_T aco;
1415 1418
1416 if (n > 0 && n <= buf->b_ml.ml_line_count) 1419 if (n > 0 && n <= buf->b_ml.ml_line_count)
1417 { 1420 {
1418 // set curwin/curbuf for "buf" and save some things 1421 // Set curwin/curbuf for "buf" and save some things.
1419 aucmd_prepbuf(&aco, buf); 1422 aucmd_prepbuf(&aco, buf);
1420 1423 if (curbuf == buf)
1421 if (u_savedel(n, 1) == OK)
1422 { 1424 {
1423 ml_delete(n); 1425 // Only when it worked to set "curbuf".
1424 1426 if (u_savedel(n, 1) == OK)
1425 // Changes to non-active buffers should properly refresh 1427 {
1426 // SegPhault - 01/09/05 1428 ml_delete(n);
1427 deleted_lines_mark(n, 1L); 1429
1428 1430 // Changes to non-active buffers should properly refresh
1429 changed(); 1431 // SegPhault - 01/09/05
1432 deleted_lines_mark(n, 1L);
1433
1434 changed();
1435 }
1436
1437 // restore curwin/curbuf and a few other things
1438 aucmd_restbuf(&aco);
1439 // Careful: autocommands may have made "buf" invalid!
1430 } 1440 }
1431
1432 // restore curwin/curbuf and a few other things
1433 aucmd_restbuf(&aco);
1434 // Careful: autocommands may have made "buf" invalid!
1435 1441
1436 update_curbuf(UPD_NOT_VALID); 1442 update_curbuf(UPD_NOT_VALID);
1437 } 1443 }
1438 else 1444 else
1439 { 1445 {
1456 } 1462 }
1457 else if (n >= 0 && n <= buf->b_ml.ml_line_count) 1463 else if (n >= 0 && n <= buf->b_ml.ml_line_count)
1458 { 1464 {
1459 // set curwin/curbuf for "buf" and save some things 1465 // set curwin/curbuf for "buf" and save some things
1460 aucmd_prepbuf(&aco, buf); 1466 aucmd_prepbuf(&aco, buf);
1461 1467 if (curbuf == buf)
1462 if (u_inssub(n + 1) == OK)
1463 { 1468 {
1464 ml_append(n, (char_u *) line, (colnr_T) 0, FALSE); 1469 // Only when it worked to set "curbuf".
1465 1470 if (u_inssub(n + 1) == OK)
1466 // Changes to non-active buffers should properly refresh screen 1471 {
1467 // SegPhault - 12/20/04 1472 ml_append(n, (char_u *) line, (colnr_T) 0, FALSE);
1468 appended_lines_mark(n, 1L); 1473
1469 1474 // Changes to non-active buffers should properly refresh screen
1470 changed(); 1475 // SegPhault - 12/20/04
1476 appended_lines_mark(n, 1L);
1477
1478 changed();
1479 }
1480
1481 // restore curwin/curbuf and a few other things
1482 aucmd_restbuf(&aco);
1483 // Careful: autocommands may have made "buf" invalid!
1471 } 1484 }
1472
1473 // restore curwin/curbuf and a few other things
1474 aucmd_restbuf(&aco);
1475 // Careful: autocommands may have made "buf" invalid!
1476 1485
1477 update_curbuf(UPD_NOT_VALID); 1486 update_curbuf(UPD_NOT_VALID);
1478 } 1487 }
1479 else 1488 else
1480 { 1489 {