Two bug fixes.
1. Make sure cmdname NUL-terminates its arguments. 2. Fix the elogapply warning, hopefully.
This commit is contained in:
parent
97f2be1c5f
commit
5e77b8bb61
2 changed files with 31 additions and 43 deletions
|
|
@ -137,7 +137,6 @@ edittext(Window *w, int q, Rune *r, int nr)
|
|||
case Inactive:
|
||||
return "permission denied";
|
||||
case Inserting:
|
||||
w->neditwrsel += nr;
|
||||
eloginsert(f, q, r, nr);
|
||||
return nil;
|
||||
case Collecting:
|
||||
|
|
@ -215,7 +214,7 @@ c_cmd(Text *t, Cmd *cp)
|
|||
{
|
||||
elogreplace(t->file, addr.r.q0, addr.r.q1, cp->u.text->r, cp->u.text->n);
|
||||
t->q0 = addr.r.q0;
|
||||
t->q1 = addr.r.q0+cp->u.text->n;
|
||||
t->q1 = addr.r.q1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -520,7 +519,7 @@ s_cmd(Text *t, Cmd *cp)
|
|||
if(!didsub && nest==0)
|
||||
editerror("no substitution");
|
||||
t->q0 = addr.r.q0;
|
||||
t->q1 = addr.r.q1+delta;
|
||||
t->q1 = addr.r.q1;
|
||||
return TRUE;
|
||||
|
||||
Err:
|
||||
|
|
@ -602,7 +601,6 @@ runpipe(Text *t, int cmd, Rune *cr, int ncr, int state)
|
|||
w = t->w;
|
||||
t->q0 = addr.r.q0;
|
||||
t->q1 = addr.r.q1;
|
||||
w->neditwrsel = 0;
|
||||
if(cmd == '<' || cmd=='|')
|
||||
elogdelete(t->file, t->q0, t->q1);
|
||||
}
|
||||
|
|
@ -632,10 +630,6 @@ runpipe(Text *t, int cmd, Rune *cr, int ncr, int state)
|
|||
editing = Inactive;
|
||||
if(t!=nil && t->w!=nil)
|
||||
winlock(t->w, 'M');
|
||||
if(state == Inserting){
|
||||
t->q0 = addr.r.q0;
|
||||
t->q1 = addr.r.q0 + t->w->neditwrsel;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -746,7 +740,7 @@ append(File *f, Cmd *cp, long p)
|
|||
if(cp->u.text->n > 0)
|
||||
eloginsert(f, p, cp->u.text->r, cp->u.text->n);
|
||||
f->curtext->q0 = p;
|
||||
f->curtext->q1 = p+cp->u.text->n;
|
||||
f->curtext->q1 = p;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1307,8 +1301,10 @@ cmdname(File *f, String *str, int set)
|
|||
runemove(r, s, n);
|
||||
}else{
|
||||
newname = dirname(f->curtext, runestrdup(s), n);
|
||||
r = newname.r;
|
||||
n = newname.nr;
|
||||
r = runemalloc(n+1);
|
||||
runemove(r, newname.r, n);
|
||||
free(newname.r);
|
||||
}
|
||||
fc.f = f;
|
||||
fc.r = r;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue