emacs.c (256281) | emacs.c (268782) |
---|---|
1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Christos Zoulas of Cornell University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * | 1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Christos Zoulas of Cornell University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * |
32 * $NetBSD: emacs.c,v 1.21 2006/03/06 21:11:56 christos Exp $ | 32 * $NetBSD: emacs.c,v 1.22 2009/02/15 21:55:23 christos Exp $ |
33 */ 34 35#if !defined(lint) && !defined(SCCSID) 36static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93"; 37#endif /* not lint && not SCCSID */ 38#include <sys/cdefs.h> | 33 */ 34 35#if !defined(lint) && !defined(SCCSID) 36static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93"; 37#endif /* not lint && not SCCSID */ 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: stable/10/lib/libedit/emacs.c 167457 2007-03-11 18:30:22Z stefanf $"); | 39__FBSDID("$FreeBSD: stable/10/lib/libedit/emacs.c 268782 2014-07-17 02:14:25Z pfg $"); |
40 41/* 42 * emacs.c: Emacs functions 43 */ 44#include "sys.h" 45#include "el.h" 46 47/* em_delete_or_list(): --- 48 unchanged lines hidden (view full) --- 96 cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, 97 el->el_state.argument, ce__isword); 98 99 for (p = el->el_line.cursor, kp = el->el_chared.c_kill.buf; p < cp; p++) 100 /* save the text */ 101 *kp++ = *p; 102 el->el_chared.c_kill.last = kp; 103 | 40 41/* 42 * emacs.c: Emacs functions 43 */ 44#include "sys.h" 45#include "el.h" 46 47/* em_delete_or_list(): --- 48 unchanged lines hidden (view full) --- 96 cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, 97 el->el_state.argument, ce__isword); 98 99 for (p = el->el_line.cursor, kp = el->el_chared.c_kill.buf; p < cp; p++) 100 /* save the text */ 101 *kp++ = *p; 102 el->el_chared.c_kill.last = kp; 103 |
104 c_delafter(el, cp - el->el_line.cursor); /* delete after dot */ | 104 c_delafter(el, (int)(cp - el->el_line.cursor)); /* delete after dot */ |
105 if (el->el_line.cursor > el->el_line.lastchar) 106 el->el_line.cursor = el->el_line.lastchar; 107 /* bounds check */ 108 return (CC_REFRESH); 109} 110 111 112/* em_yank(): --- 13 unchanged lines hidden (view full) --- 126 (el->el_chared.c_kill.last - el->el_chared.c_kill.buf) >= 127 el->el_line.limit) 128 return (CC_ERROR); 129 130 el->el_chared.c_kill.mark = el->el_line.cursor; 131 cp = el->el_line.cursor; 132 133 /* open the space, */ | 105 if (el->el_line.cursor > el->el_line.lastchar) 106 el->el_line.cursor = el->el_line.lastchar; 107 /* bounds check */ 108 return (CC_REFRESH); 109} 110 111 112/* em_yank(): --- 13 unchanged lines hidden (view full) --- 126 (el->el_chared.c_kill.last - el->el_chared.c_kill.buf) >= 127 el->el_line.limit) 128 return (CC_ERROR); 129 130 el->el_chared.c_kill.mark = el->el_line.cursor; 131 cp = el->el_line.cursor; 132 133 /* open the space, */ |
134 c_insert(el, el->el_chared.c_kill.last - el->el_chared.c_kill.buf); | 134 c_insert(el, 135 (int)(el->el_chared.c_kill.last - el->el_chared.c_kill.buf)); |
135 /* copy the chars */ 136 for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++) 137 *cp++ = *kp; 138 139 /* if an arg, cursor at beginning else cursor at end */ 140 if (el->el_state.argument == 1) 141 el->el_line.cursor = cp; 142 --- 37 unchanged lines hidden (view full) --- 180 return (CC_ERROR); 181 182 if (el->el_chared.c_kill.mark > el->el_line.cursor) { 183 cp = el->el_line.cursor; 184 kp = el->el_chared.c_kill.buf; 185 while (cp < el->el_chared.c_kill.mark) 186 *kp++ = *cp++; /* copy it */ 187 el->el_chared.c_kill.last = kp; | 136 /* copy the chars */ 137 for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++) 138 *cp++ = *kp; 139 140 /* if an arg, cursor at beginning else cursor at end */ 141 if (el->el_state.argument == 1) 142 el->el_line.cursor = cp; 143 --- 37 unchanged lines hidden (view full) --- 181 return (CC_ERROR); 182 183 if (el->el_chared.c_kill.mark > el->el_line.cursor) { 184 cp = el->el_line.cursor; 185 kp = el->el_chared.c_kill.buf; 186 while (cp < el->el_chared.c_kill.mark) 187 *kp++ = *cp++; /* copy it */ 188 el->el_chared.c_kill.last = kp; |
188 c_delafter(el, cp - el->el_line.cursor); | 189 c_delafter(el, (int)(cp - el->el_line.cursor)); |
189 } else { /* mark is before cursor */ 190 cp = el->el_chared.c_kill.mark; 191 kp = el->el_chared.c_kill.buf; 192 while (cp < el->el_line.cursor) 193 *kp++ = *cp++; /* copy it */ 194 el->el_chared.c_kill.last = kp; | 190 } else { /* mark is before cursor */ 191 cp = el->el_chared.c_kill.mark; 192 kp = el->el_chared.c_kill.buf; 193 while (cp < el->el_line.cursor) 194 *kp++ = *cp++; /* copy it */ 195 el->el_chared.c_kill.last = kp; |
195 c_delbefore(el, cp - el->el_chared.c_kill.mark); | 196 c_delbefore(el, (int)(cp - el->el_chared.c_kill.mark)); |
196 el->el_line.cursor = el->el_chared.c_kill.mark; 197 } 198 return (CC_REFRESH); 199} 200 201 202/* em_copy_region(): 203 * Copy area between mark and cursor to cut buffer --- 237 unchanged lines hidden (view full) --- 441 if (el->el_line.cursor == el->el_line.buffer) 442 return (CC_ERROR); 443 444 oldc = el->el_line.cursor; 445 /* does a bounds check */ 446 cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, 447 el->el_state.argument, ce__isword); 448 | 197 el->el_line.cursor = el->el_chared.c_kill.mark; 198 } 199 return (CC_REFRESH); 200} 201 202 203/* em_copy_region(): 204 * Copy area between mark and cursor to cut buffer --- 237 unchanged lines hidden (view full) --- 442 if (el->el_line.cursor == el->el_line.buffer) 443 return (CC_ERROR); 444 445 oldc = el->el_line.cursor; 446 /* does a bounds check */ 447 cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, 448 el->el_state.argument, ce__isword); 449 |
449 c_insert(el, oldc - cp); | 450 c_insert(el, (int)(oldc - cp)); |
450 for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++) 451 *dp++ = *cp; 452 453 el->el_line.cursor = dp;/* put cursor at end */ 454 455 return (CC_REFRESH); 456} 457 --- 48 unchanged lines hidden --- | 451 for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++) 452 *dp++ = *cp; 453 454 el->el_line.cursor = dp;/* put cursor at end */ 455 456 return (CC_REFRESH); 457} 458 --- 48 unchanged lines hidden --- |