Mercurial > vim
changeset 918:a07007166d51 v7.0.044
updated for version 7.0-044
author | vimboss |
---|---|
date | Tue, 08 Aug 2006 14:45:44 +0000 |
parents | 94164a5b0626 |
children | 3cd88bdcd97d |
files | src/if_perl.xs src/version.c |
diffstat | 2 files changed, 58 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -1056,7 +1056,6 @@ Set(vimbuf, ...) int i; long lnum; char *line; - buf_T *savebuf; PPCODE: if (buf_valid(vimbuf)) { @@ -1069,14 +1068,31 @@ Set(vimbuf, ...) line = SvPV(ST(i),PL_na); if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL) { - savebuf = curbuf; + #ifdef FEAT_AUTOCMD + aco_save_T aco; + + /* set curwin/curbuf for "vimbuf" and save some things */ + aucmd_prepbuf(&aco, vimbuf); + #else + buf_T *save_curbuf = curbuf; + curbuf = vimbuf; + curwin->w_buffer = vimbuf; + #endif if (u_savesub(lnum) == OK) { ml_replace(lnum, (char_u *)line, TRUE); changed_bytes(lnum, 0); } - curbuf = savebuf; + + #ifdef FEAT_AUTOCMD + /* restore curwin/curbuf and a few other things */ + aucmd_restbuf(&aco); + /* Careful: autocommands may have made "vimbuf" invalid! */ + #else + curwin->w_buffer = save_curbuf; + curbuf = save_curbuf; + #endif } } } @@ -1087,7 +1103,6 @@ Delete(vimbuf, ...) PREINIT: long i, lnum = 0, count = 0; - buf_T *savebuf; PPCODE: if (buf_valid(vimbuf)) { @@ -1114,16 +1129,31 @@ Delete(vimbuf, ...) { if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count) { - savebuf = curbuf; + buf_T *save_curbuf = curbuf; + #ifdef FEAT_AUTOCMD + aco_save_T aco; + + /* set curwin/curbuf for "vimbuf" and save some things */ + aucmd_prepbuf(&aco, vimbuf); + #else curbuf = vimbuf; + curwin->w_buffer = vimbuf; + #endif if (u_savedel(lnum, 1) == OK) { ml_delete(lnum, 0); deleted_lines_mark(lnum, 1L); - if (savebuf == curbuf) + if (save_curbuf == curbuf) check_cursor(); } - curbuf = savebuf; + #ifdef FEAT_AUTOCMD + /* restore curwin/curbuf and a few other things */ + aucmd_restbuf(&aco); + /* Careful: autocommands may have made "vimbuf" invalid! */ + #else + curwin->w_buffer = save_curbuf; + curbuf = save_curbuf; + #endif update_curbuf(VALID); } } @@ -1138,7 +1168,6 @@ Append(vimbuf, ...) int i; long lnum; char *line; - buf_T *savebuf; PPCODE: if (buf_valid(vimbuf)) { @@ -1151,14 +1180,31 @@ Append(vimbuf, ...) line = SvPV(ST(i),PL_na); if (lnum >= 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL) { - savebuf = curbuf; + #ifdef FEAT_AUTOCMD + aco_save_T aco; + + /* set curwin/curbuf for "vimbuf" and save some things */ + aucmd_prepbuf(&aco, vimbuf); + #else + buf_T *save_curbuf = curbuf; + curbuf = vimbuf; + curwin->w_buffer = vimbuf; + #endif if (u_inssub(lnum + 1) == OK) { ml_append(lnum, (char_u *)line, (colnr_T)0, FALSE); appended_lines_mark(lnum, 1L); } - curbuf = savebuf; + + #ifdef FEAT_AUTOCMD + /* restore curwin/curbuf and a few other things */ + aucmd_restbuf(&aco); + /* Careful: autocommands may have made "vimbuf" invalid! */ + #else + curwin->w_buffer = save_curbuf; + curbuf = save_curbuf; + #endif update_curbuf(VALID); } }