NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/48502: vi(1) no longer moves the cursor when yanking text using a mark



>Number:         48502
>Category:       bin
>Synopsis:       vi(1) no longer moves the cursor when yanking text using a mark
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 05 17:15:00 +0000 2014
>Originator:     M. Levinson
>Release:        NetBSD 6.99.28 from 2014-01-02
>Organization:
>Environment:
     $NetBSD: v_mark.c,v 1.2 2013/11/22 15:52:06 christos Exp $
Architecture: x86_64
Machine: amd64
>Description:
        When yanking or deleting text between the cursor and a mark on an
        earlier line, vi no longer moves the cursor to the mark (as it did in
        the past) because revision 1.2 of external/bsd/nvi/dist/vi/v_mark.c
        removed an unneeded variable but left a dangling "else" where its
        value was formerly assigned. Revision 1.2 of v_search.c has an
        analogous change with the same problem.

        (Those changes originated in revision 1.3 of dist/nvi/vi/v_mark.c
        and revision 1.5 of dist/nvi/vi/v_search.c before nvi was relocated
        to external/bsd.)

>How-To-Repeat:
        vi /path/to/some/file
        set a mark with the command "ma"
        move the cursor down a few lines with a command such as "5j"
        yank back to the mark with the command "y'a"
          (or alternatively, delete back to the mark with the command "d'a")

        The cursor location is unchanged, whereas in the past vi would move
        the cursor to the mark as described in the comments in v_yank.c and
        v_mark.c.

>Fix:

diff -u src/external/bsd/nvi/dist/vi/v_mark.c 
src/external/bsd/nvi/dist/vi/v_mark.c
--- src/external/bsd/nvi/dist/vi/v_mark.c
+++ src/external/bsd/nvi/dist/vi/v_mark.c
@@ -169,7 +169,7 @@ mark(SCR *sp, VICMD *vp, int getmark, enum which cmd)
                m = vp->m_start;
                vp->m_start = vp->m_stop;
                vp->m_stop = m;
-       } else
+       }
 
        /*
         * Yank cursor motion, when associated with marks as motion commands,
diff -u src/external/bsd/nvi/dist/vi/v_search.c 
src/external/bsd/nvi/dist/vi/v_search.c
--- src/external/bsd/nvi/dist/vi/v_search.c
+++ src/external/bsd/nvi/dist/vi/v_search.c
@@ -525,7 +525,7 @@ v_correct(SCR *sp, VICMD *vp, int isdelta)
                m = vp->m_start;
                vp->m_start = vp->m_stop;
                vp->m_stop = m;
-       } else
+       }
 
        /*
         * BACKWARD:



Home | Main Index | Thread Index | Old Index