usr/src/cmd/vi/port/ex_voper.c
changeset 9521 b061a79d3d1a
parent 9519 fc2830e2f3c4
child 9694 78fafb281255
equal deleted inserted replaced
9520:017f1b58f68b 9521:b061a79d3d1a
     1 /*
     1 /*
     2  * CDDL HEADER START
     2  * CDDL HEADER START
     3  *
     3  *
     4  * The contents of this file are subject to the terms of the
     4  * The contents of this file are subject to the terms of the
     5  * Common Development and Distribution License (the "License").
     5  * Common Development and Distribution License, Version 1.0 only
     6  * You may not use this file except in compliance with the License.
     6  * (the "License").  You may not use this file except in compliance
       
     7  * with the License.
     7  *
     8  *
     8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     9  * or http://www.opensolaris.org/os/licensing.
    10  * or http://www.opensolaris.org/os/licensing.
    10  * See the License for the specific language governing permissions
    11  * See the License for the specific language governing permissions
    11  * and limitations under the License.
    12  * and limitations under the License.
    17  * information: Portions Copyright [yyyy] [name of copyright owner]
    18  * information: Portions Copyright [yyyy] [name of copyright owner]
    18  *
    19  *
    19  * CDDL HEADER END
    20  * CDDL HEADER END
    20  */
    21  */
    21 /*
    22 /*
    22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
    23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
    23  * Use is subject to license terms.
    24  * Use is subject to license terms.
    24  */
    25  */
    25 
    26 
    26 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
    27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
    27 /*	  All Rights Reserved  	*/
    28 /*	  All Rights Reserved  	*/
    28 
    29 
    29 
    30 
    30 /*
    31 /*
    31  * Copyright (c) 1981 Regents of the University of California
    32  * Copyright (c) 1981 Regents of the University of California
    32  */
    33  */
       
    34 
       
    35 #pragma ident	"%Z%%M%	%I%	%E% SMI"
    33 
    36 
    34 #include "ex.h"
    37 #include "ex.h"
    35 #include "ex_tty.h"
    38 #include "ex_tty.h"
    36 #include "ex_vis.h"
    39 #include "ex_vis.h"
    37 #include <regexpr.h>
    40 #include <regexpr.h>
    50 #define	blank()		isspace(wcursor[0])
    53 #define	blank()		isspace(wcursor[0])
    51 #endif /* PRESUNEUC */
    54 #endif /* PRESUNEUC */
    52 #define	forbid(a)	if (a) goto errlab;
    55 #define	forbid(a)	if (a) goto errlab;
    53 
    56 
    54 unsigned char	vscandir[2] =	{ '/', 0 };
    57 unsigned char	vscandir[2] =	{ '/', 0 };
    55 
       
    56 static int get_addr();
       
    57 
    58 
    58 /*
    59 /*
    59  * Decode an operator/operand type command.
    60  * Decode an operator/operand type command.
    60  * Eventually we switch to an operator subroutine in ex_vops.c.
    61  * Eventually we switch to an operator subroutine in ex_vops.c.
    61  * The work here is setting up a function variable to point
    62  * The work here is setting up a function variable to point
    81 	short d;
    82 	short d;
    82 /* #ifdef PTR_ADDRESSES */
    83 /* #ifdef PTR_ADDRESSES */
    83 	int mouse_x;
    84 	int mouse_x;
    84 	int mouse_y;
    85 	int mouse_y;
    85 	int oline;
    86 	int oline;
       
    87 	static int get_addr();
    86 /* #endif PTR_ADDRESSES */
    88 /* #endif PTR_ADDRESSES */
    87 
    89 
    88 	moveop = vmove, deleteop = (int (*)())vdelete;
    90 	moveop = vmove, deleteop = (int (*)())vdelete;
    89 	wcursor = cursor;
    91 	wcursor = cursor;
    90 	wdot = NOLINE;
    92 	wdot = NOLINE;
   224  *	Look for lines longer than one line - note  odd case at zero
   226  *	Look for lines longer than one line - note  odd case at zero
   225  */
   227  */
   226 		if (i) {
   228 		if (i) {
   227 			if (vlinfo[i - 1].vdepth > 1) {
   229 			if (vlinfo[i - 1].vdepth > 1) {
   228 				mouse_x += WCOLS * (mouse_y -
   230 				mouse_x += WCOLS * (mouse_y -
   229 				    (vlinfo[i].vliny -
   231 					(vlinfo[i].vliny -
   230 				    (vlinfo[i - 1].vdepth - 1)));
   232 					(vlinfo[i - 1].vdepth - 1)));
   231 			}
   233 			}
   232 		}
   234 		}
   233 		else
   235 		else
   234 		{
   236 		{
   235 			mouse_x += WCOLS * (mouse_y - 1);
   237 			mouse_x += WCOLS * (mouse_y - 1);
   741 		forbid(wdot == NOLINE);
   743 		forbid(wdot == NOLINE);
   742 		forbid(Xhadcnt);
   744 		forbid(Xhadcnt);
   743 		vmoving = 0;
   745 		vmoving = 0;
   744 		wcursor = d == '`' ? ncols[c - 'a'] : 0;
   746 		wcursor = d == '`' ? ncols[c - 'a'] : 0;
   745 		if (opf == vmove && (wdot != dot ||
   747 		if (opf == vmove && (wdot != dot ||
   746 		    (d == '`' && wcursor != cursor)))
   748 			(d == '`' && wcursor != cursor)))
   747 			markDOT();
   749 			markDOT();
   748 		if (wcursor) {
   750 		if (wcursor) {
   749 			vsave();
   751 			vsave();
   750 			getline(*wdot);
   752 			getline(*wdot);
   751 			if (wcursor > strend(linebuf))
   753 			if (wcursor > strend(linebuf))