Mercurial > vim
comparison src/userfunc.c @ 11325:77f3b7316d8b v8.0.0548
patch 8.0.0548: saving the redo buffer only works one time
commit https://github.com/vim/vim/commit/d4863aa99e0527e9505c79cbeafc68a6832200bf
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Apr 7 19:50:12 2017 +0200
patch 8.0.0548: saving the redo buffer only works one time
Problem: Saving the redo buffer only works one time, resulting in the "."
command not working well for a function call inside another
function call. (Ingo Karkat)
Solution: Save the redo buffer at every user function call. (closes #1619)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 07 Apr 2017 20:00:04 +0200 |
parents | 4ae86195f559 |
children | 57c452316da1 |
comparison
equal
deleted
inserted
replaced
11324:c9adf54ef624 | 11325:77f3b7316d8b |
---|---|
1406 else if ((fp->uf_flags & FC_DICT) && selfdict == NULL) | 1406 else if ((fp->uf_flags & FC_DICT) && selfdict == NULL) |
1407 error = ERROR_DICT; | 1407 error = ERROR_DICT; |
1408 else | 1408 else |
1409 { | 1409 { |
1410 int did_save_redo = FALSE; | 1410 int did_save_redo = FALSE; |
1411 save_redo_T save_redo; | |
1411 | 1412 |
1412 /* | 1413 /* |
1413 * Call the user function. | 1414 * Call the user function. |
1414 * Save and restore search patterns, script variables and | 1415 * Save and restore search patterns, script variables and |
1415 * redo buffer. | 1416 * redo buffer. |
1417 save_search_patterns(); | 1418 save_search_patterns(); |
1418 #ifdef FEAT_INS_EXPAND | 1419 #ifdef FEAT_INS_EXPAND |
1419 if (!ins_compl_active()) | 1420 if (!ins_compl_active()) |
1420 #endif | 1421 #endif |
1421 { | 1422 { |
1422 saveRedobuff(); | 1423 saveRedobuff(&save_redo); |
1423 did_save_redo = TRUE; | 1424 did_save_redo = TRUE; |
1424 } | 1425 } |
1425 ++fp->uf_calls; | 1426 ++fp->uf_calls; |
1426 call_user_func(fp, argcount, argvars, rettv, | 1427 call_user_func(fp, argcount, argvars, rettv, |
1427 firstline, lastline, | 1428 firstline, lastline, |
1429 if (--fp->uf_calls <= 0 && fp->uf_refcount <= 0) | 1430 if (--fp->uf_calls <= 0 && fp->uf_refcount <= 0) |
1430 /* Function was unreferenced while being used, free it | 1431 /* Function was unreferenced while being used, free it |
1431 * now. */ | 1432 * now. */ |
1432 func_clear_free(fp, FALSE); | 1433 func_clear_free(fp, FALSE); |
1433 if (did_save_redo) | 1434 if (did_save_redo) |
1434 restoreRedobuff(); | 1435 restoreRedobuff(&save_redo); |
1435 restore_search_patterns(); | 1436 restore_search_patterns(); |
1436 error = ERROR_NONE; | 1437 error = ERROR_NONE; |
1437 } | 1438 } |
1438 } | 1439 } |
1439 } | 1440 } |