forked from aniani/vim
updated for version 7.3.1303
Problem: Undo is synced whenever CTRL-R = is called, breaking some plugins. Solution: Only break undo when calling setline() or append().
This commit is contained in:
@@ -8135,9 +8135,9 @@ ins_reg()
|
|||||||
# ifdef USE_IM_CONTROL
|
# ifdef USE_IM_CONTROL
|
||||||
int im_on = im_get_status();
|
int im_on = im_get_status();
|
||||||
# endif
|
# endif
|
||||||
/* Sync undo, so the effect of e.g., setline() can be undone. */
|
/* Sync undo when evaluating the expression calls setline() or
|
||||||
u_sync(TRUE);
|
* append(), so that it can be undone separately. */
|
||||||
ins_need_undo = TRUE;
|
u_sync_once = 2;
|
||||||
|
|
||||||
regname = get_expr_register();
|
regname = get_expr_register();
|
||||||
# ifdef USE_IM_CONTROL
|
# ifdef USE_IM_CONTROL
|
||||||
@@ -8178,6 +8178,9 @@ ins_reg()
|
|||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
}
|
}
|
||||||
--no_u_sync;
|
--no_u_sync;
|
||||||
|
if (u_sync_once == 1)
|
||||||
|
ins_need_undo = TRUE;
|
||||||
|
u_sync_once = 0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_CMDL_INFO
|
#ifdef FEAT_CMDL_INFO
|
||||||
clear_showcmd();
|
clear_showcmd();
|
||||||
|
17
src/eval.c
17
src/eval.c
@@ -8742,6 +8742,14 @@ f_append(argvars, rettv)
|
|||||||
typval_T *tv;
|
typval_T *tv;
|
||||||
long added = 0;
|
long added = 0;
|
||||||
|
|
||||||
|
/* When coming here from Insert mode, sync undo, so that this can be
|
||||||
|
* undone separately from what was previously inserted. */
|
||||||
|
if (u_sync_once == 2)
|
||||||
|
{
|
||||||
|
u_sync_once = 1; /* notify that u_sync() was called */
|
||||||
|
u_sync(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
lnum = get_tv_lnum(argvars);
|
lnum = get_tv_lnum(argvars);
|
||||||
if (lnum >= 0
|
if (lnum >= 0
|
||||||
&& lnum <= curbuf->b_ml.ml_line_count
|
&& lnum <= curbuf->b_ml.ml_line_count
|
||||||
@@ -16408,6 +16416,15 @@ f_setline(argvars, rettv)
|
|||||||
rettv->vval.v_number = 1; /* FAIL */
|
rettv->vval.v_number = 1; /* FAIL */
|
||||||
if (line == NULL || lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1)
|
if (line == NULL || lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* When coming here from Insert mode, sync undo, so that this can be
|
||||||
|
* undone separately from what was previously inserted. */
|
||||||
|
if (u_sync_once == 2)
|
||||||
|
{
|
||||||
|
u_sync_once = 1; /* notify that u_sync() was called */
|
||||||
|
u_sync(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
if (lnum <= curbuf->b_ml.ml_line_count)
|
if (lnum <= curbuf->b_ml.ml_line_count)
|
||||||
{
|
{
|
||||||
/* existing line, replace it */
|
/* existing line, replace it */
|
||||||
|
@@ -916,6 +916,10 @@ EXTERN int no_zero_mapping INIT(= 0); /* mapping zero not allowed */
|
|||||||
EXTERN int allow_keys INIT(= FALSE); /* allow key codes when no_mapping
|
EXTERN int allow_keys INIT(= FALSE); /* allow key codes when no_mapping
|
||||||
* is set */
|
* is set */
|
||||||
EXTERN int no_u_sync INIT(= 0); /* Don't call u_sync() */
|
EXTERN int no_u_sync INIT(= 0); /* Don't call u_sync() */
|
||||||
|
#ifdef FEAT_EVAL
|
||||||
|
EXTERN int u_sync_once INIT(= 0); /* Call u_sync() once when evaluating
|
||||||
|
an expression. */
|
||||||
|
#endif
|
||||||
|
|
||||||
EXTERN int restart_edit INIT(= 0); /* call edit when next cmd finished */
|
EXTERN int restart_edit INIT(= 0); /* call edit when next cmd finished */
|
||||||
EXTERN int arrow_used; /* Normally FALSE, set to TRUE after
|
EXTERN int arrow_used; /* Normally FALSE, set to TRUE after
|
||||||
|
@@ -93,7 +93,17 @@ ob
|
|||||||
:set ul=100
|
:set ul=100
|
||||||
o1a2=setline('.','1234')
|
o1a2=setline('.','1234')
|
||||||
|
|
||||||
uu:%w >>test.out
|
uu:"
|
||||||
|
oc
|
||||||
|
:set ul=100
|
||||||
|
o1a2=setline('.','1234')
|
||||||
|
|
||||||
|
u:"
|
||||||
|
od
|
||||||
|
:set ul=100
|
||||||
|
o1a2=string(123)
|
||||||
|
u:"
|
||||||
|
:%w >>test.out
|
||||||
:qa!
|
:qa!
|
||||||
ENDTEST
|
ENDTEST
|
||||||
|
|
||||||
|
@@ -44,3 +44,6 @@ three
|
|||||||
|
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
|
c
|
||||||
|
12
|
||||||
|
d
|
||||||
|
@@ -728,6 +728,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1303,
|
||||||
/**/
|
/**/
|
||||||
1302,
|
1302,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user