11573Srgrimes/*- 21573Srgrimes * Copyright (c) 1992, 1993 31573Srgrimes * The Regents of the University of California. All rights reserved. 41573Srgrimes * 51573Srgrimes * This code is derived from software contributed to Berkeley by 61573Srgrimes * Christos Zoulas of Cornell University. 71573Srgrimes * 81573Srgrimes * Redistribution and use in source and binary forms, with or without 91573Srgrimes * modification, are permitted provided that the following conditions 101573Srgrimes * are met: 111573Srgrimes * 1. Redistributions of source code must retain the above copyright 121573Srgrimes * notice, this list of conditions and the following disclaimer. 131573Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141573Srgrimes * notice, this list of conditions and the following disclaimer in the 151573Srgrimes * documentation and/or other materials provided with the distribution. 16148834Sstefanf * 3. Neither the name of the University nor the names of its contributors 171573Srgrimes * may be used to endorse or promote products derived from this software 181573Srgrimes * without specific prior written permission. 191573Srgrimes * 201573Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 211573Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 221573Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 231573Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 241573Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 251573Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 261573Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 271573Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 281573Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 291573Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 301573Srgrimes * SUCH DAMAGE. 3184260Sobrien * 32268782Spfg * $NetBSD: emacs.c,v 1.22 2009/02/15 21:55:23 christos Exp $ 331573Srgrimes */ 341573Srgrimes 351573Srgrimes#if !defined(lint) && !defined(SCCSID) 361573Srgrimesstatic char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93"; 371573Srgrimes#endif /* not lint && not SCCSID */ 3884260Sobrien#include <sys/cdefs.h> 3984260Sobrien__FBSDID("$FreeBSD$"); 401573Srgrimes 418870Srgrimes/* 421573Srgrimes * emacs.c: Emacs functions 431573Srgrimes */ 441573Srgrimes#include "sys.h" 451573Srgrimes#include "el.h" 461573Srgrimes 471573Srgrimes/* em_delete_or_list(): 481573Srgrimes * Delete character under cursor or list completions if at end of line 491573Srgrimes * [^D] 501573Srgrimes */ 511573Srgrimesprotected el_action_t 521573Srgrimes/*ARGSUSED*/ 53167457Sstefanfem_delete_or_list(EditLine *el, int c) 541573Srgrimes{ 5584260Sobrien 5684260Sobrien if (el->el_line.cursor == el->el_line.lastchar) { 5784260Sobrien /* if I'm at the end */ 5884260Sobrien if (el->el_line.cursor == el->el_line.buffer) { 5984260Sobrien /* and the beginning */ 60167457Sstefanf term_writec(el, c); /* then do an EOF */ 6184260Sobrien return (CC_EOF); 6284260Sobrien } else { 6384260Sobrien /* 6484260Sobrien * Here we could list completions, but it is an 6584260Sobrien * error right now 6684260Sobrien */ 6784260Sobrien term_beep(el); 6884260Sobrien return (CC_ERROR); 6984260Sobrien } 7084260Sobrien } else { 71148834Sstefanf if (el->el_state.doingarg) 72148834Sstefanf c_delafter(el, el->el_state.argument); 73148834Sstefanf else 74148834Sstefanf c_delafter1(el); 7584260Sobrien if (el->el_line.cursor > el->el_line.lastchar) 7684260Sobrien el->el_line.cursor = el->el_line.lastchar; 7784260Sobrien /* bounds check */ 7884260Sobrien return (CC_REFRESH); 791573Srgrimes } 801573Srgrimes} 811573Srgrimes 821573Srgrimes 831573Srgrimes/* em_delete_next_word(): 841573Srgrimes * Cut from cursor to end of current word 851573Srgrimes * [M-d] 861573Srgrimes */ 871573Srgrimesprotected el_action_t 881573Srgrimes/*ARGSUSED*/ 89148834Sstefanfem_delete_next_word(EditLine *el, int c __unused) 901573Srgrimes{ 9184260Sobrien char *cp, *p, *kp; 921573Srgrimes 9384260Sobrien if (el->el_line.cursor == el->el_line.lastchar) 9484260Sobrien return (CC_ERROR); 951573Srgrimes 9684260Sobrien cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, 9784260Sobrien el->el_state.argument, ce__isword); 981573Srgrimes 9984260Sobrien for (p = el->el_line.cursor, kp = el->el_chared.c_kill.buf; p < cp; p++) 10084260Sobrien /* save the text */ 10184260Sobrien *kp++ = *p; 10284260Sobrien el->el_chared.c_kill.last = kp; 1031573Srgrimes 104268782Spfg c_delafter(el, (int)(cp - el->el_line.cursor)); /* delete after dot */ 10584260Sobrien if (el->el_line.cursor > el->el_line.lastchar) 10684260Sobrien el->el_line.cursor = el->el_line.lastchar; 10784260Sobrien /* bounds check */ 10884260Sobrien return (CC_REFRESH); 1091573Srgrimes} 1101573Srgrimes 1111573Srgrimes 1121573Srgrimes/* em_yank(): 1131573Srgrimes * Paste cut buffer at cursor position 1141573Srgrimes * [^Y] 1151573Srgrimes */ 1161573Srgrimesprotected el_action_t 1171573Srgrimes/*ARGSUSED*/ 118148834Sstefanfem_yank(EditLine *el, int c __unused) 1191573Srgrimes{ 12084260Sobrien char *kp, *cp; 1211573Srgrimes 122148834Sstefanf if (el->el_chared.c_kill.last == el->el_chared.c_kill.buf) 123148834Sstefanf return (CC_NORM); 1241573Srgrimes 12584260Sobrien if (el->el_line.lastchar + 12684260Sobrien (el->el_chared.c_kill.last - el->el_chared.c_kill.buf) >= 12784260Sobrien el->el_line.limit) 12884260Sobrien return (CC_ERROR); 1291573Srgrimes 13084260Sobrien el->el_chared.c_kill.mark = el->el_line.cursor; 13184260Sobrien cp = el->el_line.cursor; 1321573Srgrimes 13384260Sobrien /* open the space, */ 134268782Spfg c_insert(el, 135268782Spfg (int)(el->el_chared.c_kill.last - el->el_chared.c_kill.buf)); 13684260Sobrien /* copy the chars */ 13784260Sobrien for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++) 13884260Sobrien *cp++ = *kp; 1391573Srgrimes 14084260Sobrien /* if an arg, cursor at beginning else cursor at end */ 14184260Sobrien if (el->el_state.argument == 1) 14284260Sobrien el->el_line.cursor = cp; 1431573Srgrimes 14484260Sobrien return (CC_REFRESH); 1451573Srgrimes} 1461573Srgrimes 1471573Srgrimes 1481573Srgrimes/* em_kill_line(): 1491573Srgrimes * Cut the entire line and save in cut buffer 1501573Srgrimes * [^U] 1511573Srgrimes */ 1521573Srgrimesprotected el_action_t 1531573Srgrimes/*ARGSUSED*/ 154148834Sstefanfem_kill_line(EditLine *el, int c __unused) 1551573Srgrimes{ 15684260Sobrien char *kp, *cp; 1571573Srgrimes 15884260Sobrien cp = el->el_line.buffer; 15984260Sobrien kp = el->el_chared.c_kill.buf; 16084260Sobrien while (cp < el->el_line.lastchar) 16184260Sobrien *kp++ = *cp++; /* copy it */ 16284260Sobrien el->el_chared.c_kill.last = kp; 16384260Sobrien /* zap! -- delete all of it */ 16484260Sobrien el->el_line.lastchar = el->el_line.buffer; 16584260Sobrien el->el_line.cursor = el->el_line.buffer; 16684260Sobrien return (CC_REFRESH); 1671573Srgrimes} 1681573Srgrimes 1691573Srgrimes 1701573Srgrimes/* em_kill_region(): 1711573Srgrimes * Cut area between mark and cursor and save in cut buffer 1721573Srgrimes * [^W] 1731573Srgrimes */ 1741573Srgrimesprotected el_action_t 1751573Srgrimes/*ARGSUSED*/ 176148834Sstefanfem_kill_region(EditLine *el, int c __unused) 1771573Srgrimes{ 17884260Sobrien char *kp, *cp; 1791573Srgrimes 18084260Sobrien if (!el->el_chared.c_kill.mark) 18184260Sobrien return (CC_ERROR); 1821573Srgrimes 18384260Sobrien if (el->el_chared.c_kill.mark > el->el_line.cursor) { 18484260Sobrien cp = el->el_line.cursor; 18584260Sobrien kp = el->el_chared.c_kill.buf; 18684260Sobrien while (cp < el->el_chared.c_kill.mark) 18784260Sobrien *kp++ = *cp++; /* copy it */ 18884260Sobrien el->el_chared.c_kill.last = kp; 189268782Spfg c_delafter(el, (int)(cp - el->el_line.cursor)); 19084260Sobrien } else { /* mark is before cursor */ 19184260Sobrien cp = el->el_chared.c_kill.mark; 19284260Sobrien kp = el->el_chared.c_kill.buf; 19384260Sobrien while (cp < el->el_line.cursor) 19484260Sobrien *kp++ = *cp++; /* copy it */ 19584260Sobrien el->el_chared.c_kill.last = kp; 196268782Spfg c_delbefore(el, (int)(cp - el->el_chared.c_kill.mark)); 19784260Sobrien el->el_line.cursor = el->el_chared.c_kill.mark; 19884260Sobrien } 19984260Sobrien return (CC_REFRESH); 2001573Srgrimes} 2011573Srgrimes 2021573Srgrimes 2031573Srgrimes/* em_copy_region(): 2041573Srgrimes * Copy area between mark and cursor to cut buffer 2051573Srgrimes * [M-W] 2061573Srgrimes */ 2071573Srgrimesprotected el_action_t 2081573Srgrimes/*ARGSUSED*/ 209148834Sstefanfem_copy_region(EditLine *el, int c __unused) 2101573Srgrimes{ 21184260Sobrien char *kp, *cp; 2121573Srgrimes 213148834Sstefanf if (!el->el_chared.c_kill.mark) 21484260Sobrien return (CC_ERROR); 2151573Srgrimes 21684260Sobrien if (el->el_chared.c_kill.mark > el->el_line.cursor) { 21784260Sobrien cp = el->el_line.cursor; 21884260Sobrien kp = el->el_chared.c_kill.buf; 21984260Sobrien while (cp < el->el_chared.c_kill.mark) 22084260Sobrien *kp++ = *cp++; /* copy it */ 22184260Sobrien el->el_chared.c_kill.last = kp; 22284260Sobrien } else { 22384260Sobrien cp = el->el_chared.c_kill.mark; 22484260Sobrien kp = el->el_chared.c_kill.buf; 22584260Sobrien while (cp < el->el_line.cursor) 22684260Sobrien *kp++ = *cp++; /* copy it */ 22784260Sobrien el->el_chared.c_kill.last = kp; 22884260Sobrien } 22984260Sobrien return (CC_NORM); 2301573Srgrimes} 2311573Srgrimes 2321573Srgrimes 233148834Sstefanf/* em_gosmacs_transpose(): 2341573Srgrimes * Exchange the two characters before the cursor 2351573Srgrimes * Gosling emacs transpose chars [^T] 2361573Srgrimes */ 2371573Srgrimesprotected el_action_t 238148834Sstefanfem_gosmacs_transpose(EditLine *el, int c) 2391573Srgrimes{ 2401573Srgrimes 24184260Sobrien if (el->el_line.cursor > &el->el_line.buffer[1]) { 24284260Sobrien /* must have at least two chars entered */ 24384260Sobrien c = el->el_line.cursor[-2]; 24484260Sobrien el->el_line.cursor[-2] = el->el_line.cursor[-1]; 24584260Sobrien el->el_line.cursor[-1] = c; 24684260Sobrien return (CC_REFRESH); 24784260Sobrien } else 24884260Sobrien return (CC_ERROR); 2491573Srgrimes} 2501573Srgrimes 2511573Srgrimes 2521573Srgrimes/* em_next_word(): 2531573Srgrimes * Move next to end of current word 2541573Srgrimes * [M-f] 2551573Srgrimes */ 2561573Srgrimesprotected el_action_t 2571573Srgrimes/*ARGSUSED*/ 258148834Sstefanfem_next_word(EditLine *el, int c __unused) 2591573Srgrimes{ 26084260Sobrien if (el->el_line.cursor == el->el_line.lastchar) 26184260Sobrien return (CC_ERROR); 2621573Srgrimes 26384260Sobrien el->el_line.cursor = c__next_word(el->el_line.cursor, 26484260Sobrien el->el_line.lastchar, 26584260Sobrien el->el_state.argument, 26684260Sobrien ce__isword); 2671573Srgrimes 26884260Sobrien if (el->el_map.type == MAP_VI) 269148834Sstefanf if (el->el_chared.c_vcmd.action != NOP) { 27084260Sobrien cv_delfini(el); 27184260Sobrien return (CC_REFRESH); 27284260Sobrien } 27384260Sobrien return (CC_CURSOR); 2741573Srgrimes} 2751573Srgrimes 27684260Sobrien 2771573Srgrimes/* em_upper_case(): 2781573Srgrimes * Uppercase the characters from cursor to end of current word 2791573Srgrimes * [M-u] 2801573Srgrimes */ 2811573Srgrimesprotected el_action_t 2821573Srgrimes/*ARGSUSED*/ 283148834Sstefanfem_upper_case(EditLine *el, int c __unused) 2841573Srgrimes{ 28584260Sobrien char *cp, *ep; 2861573Srgrimes 28784260Sobrien ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, 28884260Sobrien el->el_state.argument, ce__isword); 2891573Srgrimes 29084260Sobrien for (cp = el->el_line.cursor; cp < ep; cp++) 291148834Sstefanf if (islower((unsigned char)*cp)) 292148834Sstefanf *cp = toupper((unsigned char)*cp); 2931573Srgrimes 29484260Sobrien el->el_line.cursor = ep; 29584260Sobrien if (el->el_line.cursor > el->el_line.lastchar) 29684260Sobrien el->el_line.cursor = el->el_line.lastchar; 29784260Sobrien return (CC_REFRESH); 2981573Srgrimes} 2991573Srgrimes 3001573Srgrimes 3011573Srgrimes/* em_capitol_case(): 3021573Srgrimes * Capitalize the characters from cursor to end of current word 3031573Srgrimes * [M-c] 3041573Srgrimes */ 3051573Srgrimesprotected el_action_t 3061573Srgrimes/*ARGSUSED*/ 307148834Sstefanfem_capitol_case(EditLine *el, int c __unused) 3081573Srgrimes{ 30984260Sobrien char *cp, *ep; 3101573Srgrimes 31184260Sobrien ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, 31284260Sobrien el->el_state.argument, ce__isword); 3131573Srgrimes 31484260Sobrien for (cp = el->el_line.cursor; cp < ep; cp++) { 315148834Sstefanf if (isalpha((unsigned char)*cp)) { 316148834Sstefanf if (islower((unsigned char)*cp)) 317148834Sstefanf *cp = toupper((unsigned char)*cp); 31884260Sobrien cp++; 31984260Sobrien break; 32084260Sobrien } 3211573Srgrimes } 32284260Sobrien for (; cp < ep; cp++) 323148834Sstefanf if (isupper((unsigned char)*cp)) 324148834Sstefanf *cp = tolower((unsigned char)*cp); 3251573Srgrimes 32684260Sobrien el->el_line.cursor = ep; 32784260Sobrien if (el->el_line.cursor > el->el_line.lastchar) 32884260Sobrien el->el_line.cursor = el->el_line.lastchar; 32984260Sobrien return (CC_REFRESH); 3301573Srgrimes} 3311573Srgrimes 33284260Sobrien 3331573Srgrimes/* em_lower_case(): 3341573Srgrimes * Lowercase the characters from cursor to end of current word 3351573Srgrimes * [M-l] 3361573Srgrimes */ 3371573Srgrimesprotected el_action_t 3381573Srgrimes/*ARGSUSED*/ 339148834Sstefanfem_lower_case(EditLine *el, int c __unused) 3401573Srgrimes{ 34184260Sobrien char *cp, *ep; 3421573Srgrimes 34384260Sobrien ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, 34484260Sobrien el->el_state.argument, ce__isword); 3451573Srgrimes 34684260Sobrien for (cp = el->el_line.cursor; cp < ep; cp++) 347148834Sstefanf if (isupper((unsigned char)*cp)) 348148834Sstefanf *cp = tolower((unsigned char)*cp); 3491573Srgrimes 35084260Sobrien el->el_line.cursor = ep; 35184260Sobrien if (el->el_line.cursor > el->el_line.lastchar) 35284260Sobrien el->el_line.cursor = el->el_line.lastchar; 35384260Sobrien return (CC_REFRESH); 3541573Srgrimes} 3551573Srgrimes 3561573Srgrimes 3571573Srgrimes/* em_set_mark(): 3581573Srgrimes * Set the mark at cursor 3591573Srgrimes * [^@] 3601573Srgrimes */ 3611573Srgrimesprotected el_action_t 3621573Srgrimes/*ARGSUSED*/ 363148834Sstefanfem_set_mark(EditLine *el, int c __unused) 3641573Srgrimes{ 36584260Sobrien 36684260Sobrien el->el_chared.c_kill.mark = el->el_line.cursor; 36784260Sobrien return (CC_NORM); 3681573Srgrimes} 3691573Srgrimes 3701573Srgrimes 3711573Srgrimes/* em_exchange_mark(): 3728870Srgrimes * Exchange the cursor and mark 3731573Srgrimes * [^X^X] 3741573Srgrimes */ 3751573Srgrimesprotected el_action_t 3761573Srgrimes/*ARGSUSED*/ 377148834Sstefanfem_exchange_mark(EditLine *el, int c __unused) 3781573Srgrimes{ 37984260Sobrien char *cp; 3801573Srgrimes 38184260Sobrien cp = el->el_line.cursor; 38284260Sobrien el->el_line.cursor = el->el_chared.c_kill.mark; 38384260Sobrien el->el_chared.c_kill.mark = cp; 38484260Sobrien return (CC_CURSOR); 3851573Srgrimes} 3861573Srgrimes 38784260Sobrien 3881573Srgrimes/* em_universal_argument(): 3891573Srgrimes * Universal argument (argument times 4) 3901573Srgrimes * [^U] 3911573Srgrimes */ 3921573Srgrimesprotected el_action_t 3931573Srgrimes/*ARGSUSED*/ 394148834Sstefanfem_universal_argument(EditLine *el, int c __unused) 3951573Srgrimes{ /* multiply current argument by 4 */ 39684260Sobrien 39784260Sobrien if (el->el_state.argument > 1000000) 39884260Sobrien return (CC_ERROR); 39984260Sobrien el->el_state.doingarg = 1; 40084260Sobrien el->el_state.argument *= 4; 40184260Sobrien return (CC_ARGHACK); 4021573Srgrimes} 4031573Srgrimes 40484260Sobrien 4051573Srgrimes/* em_meta_next(): 4061573Srgrimes * Add 8th bit to next character typed 4071573Srgrimes * [<ESC>] 4081573Srgrimes */ 4091573Srgrimesprotected el_action_t 4101573Srgrimes/*ARGSUSED*/ 411148834Sstefanfem_meta_next(EditLine *el, int c __unused) 4121573Srgrimes{ 41384260Sobrien 41484260Sobrien el->el_state.metanext = 1; 41584260Sobrien return (CC_ARGHACK); 4161573Srgrimes} 4171573Srgrimes 4181573Srgrimes 4191573Srgrimes/* em_toggle_overwrite(): 4201573Srgrimes * Switch from insert to overwrite mode or vice versa 4211573Srgrimes */ 4221573Srgrimesprotected el_action_t 4231573Srgrimes/*ARGSUSED*/ 424148834Sstefanfem_toggle_overwrite(EditLine *el, int c __unused) 4251573Srgrimes{ 42684260Sobrien 42784260Sobrien el->el_state.inputmode = (el->el_state.inputmode == MODE_INSERT) ? 42884260Sobrien MODE_REPLACE : MODE_INSERT; 42984260Sobrien return (CC_NORM); 4301573Srgrimes} 4311573Srgrimes 4321573Srgrimes 4331573Srgrimes/* em_copy_prev_word(): 4341573Srgrimes * Copy current word to cursor 4351573Srgrimes */ 4361573Srgrimesprotected el_action_t 4371573Srgrimes/*ARGSUSED*/ 438148834Sstefanfem_copy_prev_word(EditLine *el, int c __unused) 4391573Srgrimes{ 44084260Sobrien char *cp, *oldc, *dp; 4411573Srgrimes 44284260Sobrien if (el->el_line.cursor == el->el_line.buffer) 44384260Sobrien return (CC_ERROR); 4441573Srgrimes 44584260Sobrien oldc = el->el_line.cursor; 44684260Sobrien /* does a bounds check */ 44784260Sobrien cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, 44884260Sobrien el->el_state.argument, ce__isword); 4491573Srgrimes 450268782Spfg c_insert(el, (int)(oldc - cp)); 45184260Sobrien for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++) 45284260Sobrien *dp++ = *cp; 4531573Srgrimes 45484260Sobrien el->el_line.cursor = dp;/* put cursor at end */ 4551573Srgrimes 45684260Sobrien return (CC_REFRESH); 4571573Srgrimes} 4581573Srgrimes 4591573Srgrimes 4601573Srgrimes/* em_inc_search_next(): 4611573Srgrimes * Emacs incremental next search 4621573Srgrimes */ 4631573Srgrimesprotected el_action_t 4641573Srgrimes/*ARGSUSED*/ 465148834Sstefanfem_inc_search_next(EditLine *el, int c __unused) 4661573Srgrimes{ 46784260Sobrien 46884260Sobrien el->el_search.patlen = 0; 46984260Sobrien return (ce_inc_search(el, ED_SEARCH_NEXT_HISTORY)); 4701573Srgrimes} 4711573Srgrimes 4721573Srgrimes 4731573Srgrimes/* em_inc_search_prev(): 4741573Srgrimes * Emacs incremental reverse search 4751573Srgrimes */ 4761573Srgrimesprotected el_action_t 4771573Srgrimes/*ARGSUSED*/ 478148834Sstefanfem_inc_search_prev(EditLine *el, int c __unused) 4791573Srgrimes{ 48084260Sobrien 48184260Sobrien el->el_search.patlen = 0; 48284260Sobrien return (ce_inc_search(el, ED_SEARCH_PREV_HISTORY)); 4831573Srgrimes} 484148834Sstefanf 485148834Sstefanf 486148834Sstefanf/* em_delete_prev_char(): 487148834Sstefanf * Delete the character to the left of the cursor 488148834Sstefanf * [^?] 489148834Sstefanf */ 490148834Sstefanfprotected el_action_t 491148834Sstefanf/*ARGSUSED*/ 492148834Sstefanfem_delete_prev_char(EditLine *el, int c __unused) 493148834Sstefanf{ 494148834Sstefanf 495148834Sstefanf if (el->el_line.cursor <= el->el_line.buffer) 496148834Sstefanf return (CC_ERROR); 497148834Sstefanf 498148834Sstefanf if (el->el_state.doingarg) 499148834Sstefanf c_delbefore(el, el->el_state.argument); 500148834Sstefanf else 501148834Sstefanf c_delbefore1(el); 502148834Sstefanf el->el_line.cursor -= el->el_state.argument; 503148834Sstefanf if (el->el_line.cursor < el->el_line.buffer) 504148834Sstefanf el->el_line.cursor = el->el_line.buffer; 505148834Sstefanf return (CC_REFRESH); 506148834Sstefanf} 507