62 lines
1.0 KiB
Plaintext
62 lines
1.0 KiB
Plaintext
--- src/cmd/ksh93/edit/vi.c
|
|
+++ src/cmd/ksh93/edit/vi.c 2006-05-31 15:09:12.000000000 +0000
|
|
@@ -389,6 +397,9 @@
|
|
if(!yankbuf)
|
|
{
|
|
yankbuf = (genchar*)malloc(MAXLINE*CHARSIZE);
|
|
+ }
|
|
+ if (!vp->lastline)
|
|
+ {
|
|
vp->lastline = (genchar*)malloc(MAXLINE*CHARSIZE);
|
|
}
|
|
if( vp->last_cmd == '\0' )
|
|
@@ -400,6 +411,8 @@
|
|
vp->lastmotion = '\0';
|
|
vp->lastrepeat = 1;
|
|
vp->repeat = 1;
|
|
+ if (!yankbuf)
|
|
+ return(-1);
|
|
*yankbuf = 0;
|
|
}
|
|
|
|
@@ -1065,7 +1078,7 @@
|
|
|
|
/*** save characters to be deleted ***/
|
|
|
|
- if( mode != 'c' )
|
|
+ if( mode != 'c' && yankbuf )
|
|
{
|
|
i = cp[nchars];
|
|
cp[nchars] = 0;
|
|
@@ -2027,6 +2040,9 @@
|
|
{
|
|
register int i;
|
|
|
|
+ if (vp->lastline == NULL)
|
|
+ return;
|
|
+
|
|
if( (i = cur_virt - first_virt + 1) > 0 )
|
|
{
|
|
/*** save last thing user typed ***/
|
|
@@ -2272,6 +2288,11 @@
|
|
p = yankbuf;
|
|
}
|
|
|
|
+ if (!p)
|
|
+ {
|
|
+ return(BAD);
|
|
+ }
|
|
+
|
|
addin:
|
|
switch( c )
|
|
{
|
|
@@ -2530,6 +2551,8 @@
|
|
vp->lastmotion = c;
|
|
if( c == 'y' )
|
|
{
|
|
+ if (!yankbuf)
|
|
+ return(BAD);
|
|
gencpy(yankbuf, virtual);
|
|
}
|
|
else if(!delmotion(vp, c, 'y'))
|