Mercurial > vim
comparison src/if_perl.xs @ 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 | 551ce1a137da |
children | d83068c95ba0 |
comparison
equal
deleted
inserted
replaced
31262:7f766b7e17d5 | 31263:d8e7d725a666 |
---|---|
1867 line = SvPV(ST(i),PL_na); | 1867 line = SvPV(ST(i),PL_na); |
1868 if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL) | 1868 if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL) |
1869 { | 1869 { |
1870 aco_save_T aco; | 1870 aco_save_T aco; |
1871 | 1871 |
1872 /* set curwin/curbuf for "vimbuf" and save some things */ | 1872 /* Set curwin/curbuf for "vimbuf" and save some things. */ |
1873 aucmd_prepbuf(&aco, vimbuf); | 1873 aucmd_prepbuf(&aco, vimbuf); |
1874 | 1874 if (curbuf == vimbuf) |
1875 if (u_savesub(lnum) == OK) | |
1876 { | 1875 { |
1877 ml_replace(lnum, (char_u *)line, TRUE); | 1876 /* Only when a window was found. */ |
1878 changed_bytes(lnum, 0); | 1877 if (u_savesub(lnum) == OK) |
1878 { | |
1879 ml_replace(lnum, (char_u *)line, TRUE); | |
1880 changed_bytes(lnum, 0); | |
1881 } | |
1882 | |
1883 /* restore curwin/curbuf and a few other things */ | |
1884 aucmd_restbuf(&aco); | |
1885 /* Careful: autocommands may have made "vimbuf" invalid! */ | |
1879 } | 1886 } |
1880 | |
1881 /* restore curwin/curbuf and a few other things */ | |
1882 aucmd_restbuf(&aco); | |
1883 /* Careful: autocommands may have made "vimbuf" invalid! */ | |
1884 } | 1887 } |
1885 } | 1888 } |
1886 } | 1889 } |
1887 | 1890 |
1888 void | 1891 void |
1919 { | 1922 { |
1920 aco_save_T aco; | 1923 aco_save_T aco; |
1921 | 1924 |
1922 /* set curwin/curbuf for "vimbuf" and save some things */ | 1925 /* set curwin/curbuf for "vimbuf" and save some things */ |
1923 aucmd_prepbuf(&aco, vimbuf); | 1926 aucmd_prepbuf(&aco, vimbuf); |
1924 | 1927 if (curbuf == vimbuf) |
1925 if (u_savedel(lnum, 1) == OK) | |
1926 { | 1928 { |
1927 ml_delete(lnum); | 1929 /* Only when a window was found. */ |
1928 check_cursor(); | 1930 if (u_savedel(lnum, 1) == OK) |
1929 deleted_lines_mark(lnum, 1L); | 1931 { |
1932 ml_delete(lnum); | |
1933 check_cursor(); | |
1934 deleted_lines_mark(lnum, 1L); | |
1935 } | |
1936 | |
1937 /* restore curwin/curbuf and a few other things */ | |
1938 aucmd_restbuf(&aco); | |
1939 /* Careful: autocommands may have made "vimbuf" | |
1940 * invalid! */ | |
1930 } | 1941 } |
1931 | |
1932 /* restore curwin/curbuf and a few other things */ | |
1933 aucmd_restbuf(&aco); | |
1934 /* Careful: autocommands may have made "vimbuf" invalid! */ | |
1935 | 1942 |
1936 update_curbuf(UPD_VALID); | 1943 update_curbuf(UPD_VALID); |
1937 } | 1944 } |
1938 } | 1945 } |
1939 } | 1946 } |
1961 { | 1968 { |
1962 aco_save_T aco; | 1969 aco_save_T aco; |
1963 | 1970 |
1964 /* set curwin/curbuf for "vimbuf" and save some things */ | 1971 /* set curwin/curbuf for "vimbuf" and save some things */ |
1965 aucmd_prepbuf(&aco, vimbuf); | 1972 aucmd_prepbuf(&aco, vimbuf); |
1966 | 1973 if (curbuf == vimbuf) |
1967 if (u_inssub(lnum + 1) == OK) | |
1968 { | 1974 { |
1969 ml_append(lnum, (char_u *)line, (colnr_T)0, FALSE); | 1975 /* Only when a window for "vimbuf" was found. */ |
1970 appended_lines_mark(lnum, 1L); | 1976 if (u_inssub(lnum + 1) == OK) |
1971 } | 1977 { |
1972 | 1978 ml_append(lnum, (char_u *)line, (colnr_T)0, FALSE); |
1973 /* restore curwin/curbuf and a few other things */ | 1979 appended_lines_mark(lnum, 1L); |
1974 aucmd_restbuf(&aco); | 1980 } |
1975 /* Careful: autocommands may have made "vimbuf" invalid! */ | 1981 |
1982 /* restore curwin/curbuf and a few other things */ | |
1983 aucmd_restbuf(&aco); | |
1984 /* Careful: autocommands may have made "vimbuf" invalid! */ | |
1985 } | |
1976 | 1986 |
1977 update_curbuf(UPD_VALID); | 1987 update_curbuf(UPD_VALID); |
1978 } | 1988 } |
1979 } | 1989 } |
1980 } | 1990 } |