mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-23 17:01:05 +02:00
zsh-workers/8590
This commit is contained in:
parent
9873dda3aa
commit
dd00cca82e
4 changed files with 18 additions and 3 deletions
|
@ -400,8 +400,13 @@ compquote tmp1 tmp4
|
|||
done
|
||||
|
||||
if [[ -z "$tmp4" ]]; then
|
||||
PREFIX="${opre}${osuf}"
|
||||
SUFFIX=""
|
||||
if [[ "$osuf" = */* ]]; then
|
||||
PREFIX="${opre}${osuf}"
|
||||
SUFFIX=""
|
||||
else
|
||||
PREFIX="${opre}"
|
||||
SUFFIX="${osuf}"
|
||||
fi
|
||||
tmp4="$testpath"
|
||||
compquote tmp4 tmp1
|
||||
compadd -Qf -p "$linepath$tmp4" \
|
||||
|
|
|
@ -107,6 +107,7 @@ struct change {
|
|||
int off; /* offset of the text changes */
|
||||
char *del; /* characters to delete (metafied) */
|
||||
char *ins; /* characters to insert (metafied) */
|
||||
int old_cs, new_cs; /* old and new cursor positions */
|
||||
};
|
||||
|
||||
#define CH_NEXT (1<<0) /* next structure is also part of this change */
|
||||
|
|
|
@ -512,6 +512,9 @@ docomplete(int lst)
|
|||
char *s, *ol;
|
||||
int olst = lst, chl = 0, ne = noerrs, ocs, ret = 0;
|
||||
|
||||
if (undoing)
|
||||
setlastline();
|
||||
|
||||
if (runhookdef(BEFORECOMPLETEHOOK, (void *) &lst))
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ struct cutbuffer vibuf[35];
|
|||
/**/
|
||||
char *lastline;
|
||||
/**/
|
||||
int lastlinesz, lastll;
|
||||
int lastlinesz, lastll, lastcs;
|
||||
|
||||
/* size of line buffer */
|
||||
|
||||
|
@ -438,6 +438,7 @@ initundo(void)
|
|||
curchange->del = curchange->ins = NULL;
|
||||
lastline = zalloc(lastlinesz = linesz);
|
||||
memcpy(lastline, line, lastll = ll);
|
||||
lastcs = cs;
|
||||
}
|
||||
|
||||
/**/
|
||||
|
@ -511,6 +512,8 @@ mkundoent(void)
|
|||
ch->next = NULL;
|
||||
ch->hist = histline;
|
||||
ch->off = pre;
|
||||
ch->old_cs = lastcs;
|
||||
ch->new_cs = cs;
|
||||
if(suf + pre == lastll)
|
||||
ch->del = NULL;
|
||||
else
|
||||
|
@ -541,6 +544,7 @@ setlastline(void)
|
|||
if(lastlinesz != linesz)
|
||||
lastline = realloc(lastline, lastlinesz = linesz);
|
||||
memcpy(lastline, line, lastll = ll);
|
||||
lastcs = cs;
|
||||
}
|
||||
|
||||
/* move backwards through the change list */
|
||||
|
@ -578,6 +582,7 @@ unapplychange(struct change *ch)
|
|||
else
|
||||
line[cs++] = STOUC(*c);
|
||||
}
|
||||
cs = ch->old_cs;
|
||||
}
|
||||
|
||||
/* move forwards through the change list */
|
||||
|
@ -616,6 +621,7 @@ applychange(struct change *ch)
|
|||
else
|
||||
line[cs++] = STOUC(*c);
|
||||
}
|
||||
cs = ch->new_cs;
|
||||
}
|
||||
|
||||
/* vi undo: toggle between the end of the undo list and the preceding point */
|
||||
|
|
Loading…
Reference in a new issue