summaryrefslogtreecommitdiffstats
path: root/src/if_perl.xs
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-11-28 18:51:43 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-28 18:51:43 +0000
commite76062c078debed0df818f70e4db14ad7a7cb53a (patch)
treee43b3b076fdea909c460219e896237a8924ccb6b /src/if_perl.xs
parent74a694dbe20bb7dea4e06f474cf62e20f9c92f1d (diff)
patch 9.0.0965: using one window for executing autocommands is insufficientv9.0.0965
Problem: Using one window for executing autocommands is insufficient. Solution: Use up to five windows for executing autocommands.
Diffstat (limited to 'src/if_perl.xs')
-rw-r--r--src/if_perl.xs62
1 files changed, 36 insertions, 26 deletions
diff --git a/src/if_perl.xs b/src/if_perl.xs
index 34315be719..c69ed9ef1f 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -1869,18 +1869,21 @@ Set(vimbuf, ...)
{
aco_save_T aco;
- /* set curwin/curbuf for "vimbuf" and save some things */
+ /* Set curwin/curbuf for "vimbuf" and save some things. */
aucmd_prepbuf(&aco, vimbuf);
-
- if (u_savesub(lnum) == OK)
+ if (curbuf == vimbuf)
{
- ml_replace(lnum, (char_u *)line, TRUE);
- changed_bytes(lnum, 0);
- }
+ /* Only when a window was found. */
+ if (u_savesub(lnum) == OK)
+ {
+ ml_replace(lnum, (char_u *)line, TRUE);
+ changed_bytes(lnum, 0);
+ }
- /* restore curwin/curbuf and a few other things */
- aucmd_restbuf(&aco);
- /* Careful: autocommands may have made "vimbuf" invalid! */
+ /* restore curwin/curbuf and a few other things */
+ aucmd_restbuf(&aco);
+ /* Careful: autocommands may have made "vimbuf" invalid! */
+ }
}
}
}
@@ -1921,18 +1924,22 @@ Delete(vimbuf, ...)
/* set curwin/curbuf for "vimbuf" and save some things */
aucmd_prepbuf(&aco, vimbuf);
-
- if (u_savedel(lnum, 1) == OK)
+ if (curbuf == vimbuf)
{
- ml_delete(lnum);
- check_cursor();
- deleted_lines_mark(lnum, 1L);
+ /* Only when a window was found. */
+ if (u_savedel(lnum, 1) == OK)
+ {
+ ml_delete(lnum);
+ check_cursor();
+ deleted_lines_mark(lnum, 1L);
+ }
+
+ /* restore curwin/curbuf and a few other things */
+ aucmd_restbuf(&aco);
+ /* Careful: autocommands may have made "vimbuf"
+ * invalid! */
}
- /* restore curwin/curbuf and a few other things */
- aucmd_restbuf(&aco);
- /* Careful: autocommands may have made "vimbuf" invalid! */
-
update_curbuf(UPD_VALID);
}
}
@@ -1963,16 +1970,19 @@ Append(vimbuf, ...)
/* set curwin/curbuf for "vimbuf" and save some things */
aucmd_prepbuf(&aco, vimbuf);
-
- if (u_inssub(lnum + 1) == OK)
+ if (curbuf == vimbuf)
{
- ml_append(lnum, (char_u *)line, (colnr_T)0, FALSE);
- appended_lines_mark(lnum, 1L);
- }
+ /* Only when a window for "vimbuf" was found. */
+ if (u_inssub(lnum + 1) == OK)
+ {
+ ml_append(lnum, (char_u *)line, (colnr_T)0, FALSE);
+ appended_lines_mark(lnum, 1L);
+ }
- /* restore curwin/curbuf and a few other things */
- aucmd_restbuf(&aco);
- /* Careful: autocommands may have made "vimbuf" invalid! */
+ /* restore curwin/curbuf and a few other things */
+ aucmd_restbuf(&aco);
+ /* Careful: autocommands may have made "vimbuf" invalid! */
+ }
update_curbuf(UPD_VALID);
}