mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-28 04:43:32 +00:00
`~a'',
`~i'' etc. cause vi to core dump
if the (file)buffer is empty (line=1, colum=0, len=0) Submitted by: batie@agora.rdrop.com (Alan Batie)
This commit is contained in:
parent
c55acb6213
commit
2868020397
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=14357
@ -84,6 +84,7 @@ v_ulcase(sp, ep, vp)
|
||||
u_long cnt;
|
||||
char *p;
|
||||
|
||||
len = 0;
|
||||
lno = vp->m_start.lno;
|
||||
cno = vp->m_start.cno;
|
||||
|
||||
@ -120,7 +121,10 @@ v_ulcase(sp, ep, vp)
|
||||
|
||||
/* Check to see if we tried to move past EOF. */
|
||||
if (file_gline(sp, ep, vp->m_final.lno, &len) == NULL) {
|
||||
(void)file_gline(sp, ep, --vp->m_final.lno, &len);
|
||||
/* line number start with 1, lno zero is illegal */
|
||||
if (vp->m_final.lno > 1)
|
||||
--vp->m_final.lno;
|
||||
(void)file_gline(sp, ep, vp->m_final.lno, &len);
|
||||
vp->m_final.cno = len == 0 ? 0 : len - 1;
|
||||
}
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user