version 1.28, 2005/11/18 20:56:53 |
version 1.29, 2005/11/18 23:37:31 |
|
|
|
|
undo_add_delete(curwp->w_dotp, curwp->w_doto, n); |
undo_add_delete(curwp->w_dotp, curwp->w_doto, n); |
|
|
/* |
|
* HACK - doesn't matter, and fixes back-over-nl bug for empty |
|
* kill buffers. |
|
*/ |
|
if (kused == kstart) |
|
kflag = KFORW; |
|
|
|
while (n != 0) { |
while (n != 0) { |
dotp = curwp->w_dotp; |
dotp = curwp->w_dotp; |
doto = curwp->w_doto; |
doto = curwp->w_doto; |
|
|
lchange(WFEDIT); |
lchange(WFEDIT); |
/* Scrunch text */ |
/* Scrunch text */ |
cp1 = &dotp->l_text[doto]; |
cp1 = &dotp->l_text[doto]; |
if (kflag == KFORW) { |
if (kchunk(cp1, chunk, kflag) == FALSE) |
while (ksize - kused < chunk) |
return(FALSE); |
if (kgrow(kflag) == FALSE) |
|
return (FALSE); |
|
bcopy(cp1, &(kbufp[kused]), (int)chunk); |
|
kused += chunk; |
|
} else if (kflag == KBACK) { |
|
while (kstart < chunk) |
|
if (kgrow(kflag) == FALSE) |
|
return (FALSE); |
|
bcopy(cp1, &(kbufp[kstart - chunk]), (int)chunk); |
|
kstart -= chunk; |
|
} else if (kflag != KNONE) |
|
panic("broken ldelete call"); |
|
for (cp2 = cp1 + chunk; cp2 < &dotp->l_text[dotp->l_used]; |
for (cp2 = cp1 + chunk; cp2 < &dotp->l_text[dotp->l_used]; |
cp2++) |
cp2++) |
*cp1++ = *cp2; |
*cp1++ = *cp2; |
|
|
if (n < 0 || n + kstart >= kused) |
if (n < 0 || n + kstart >= kused) |
return (-1); |
return (-1); |
return (CHARMASK(kbufp[n + kstart])); |
return (CHARMASK(kbufp[n + kstart])); |
|
} |
|
|
|
/* |
|
* Copy a string into the kill buffer. kflag gives direction. |
|
* if KNONE, do nothing. |
|
*/ |
|
int |
|
kchunk(char *cp1, RSIZE chunk, int kflag) |
|
{ |
|
/* |
|
* HACK - doesn't matter, and fixes back-over-nl bug for empty |
|
* kill buffers. |
|
*/ |
|
if (kused == kstart) |
|
kflag = KFORW; |
|
|
|
if (kflag == KFORW) { |
|
while (ksize - kused < chunk) |
|
if (kgrow(kflag) == FALSE) |
|
return (FALSE); |
|
bcopy(cp1, &(kbufp[kused]), (int)chunk); |
|
kused += chunk; |
|
} else if (kflag == KBACK) { |
|
while (kstart < chunk) |
|
if (kgrow(kflag) == FALSE) |
|
return (FALSE); |
|
bcopy(cp1, &(kbufp[kstart - chunk]), (int)chunk); |
|
kstart -= chunk; |
|
} else if (kflag != KNONE) |
|
panic("broken ldelete call"); |
|
|
|
return (TRUE); |
} |
} |