• Fix problem with ^w fix that broke 'B'

Found by Daniel LEVAI
  Fix by Darrin Chandler
  ok millert@
  From merdely@obsd
• more tabs→spaces while here
This commit is contained in:
tg 2009-06-10 19:33:16 +00:00
parent 0432f97ffe
commit 3cec01a6fd

12
edit.c
View File

@ -1,7 +1,7 @@
/* $OpenBSD: edit.c,v 1.33 2007/08/02 10:50:25 fgsch Exp $ */ /* $OpenBSD: edit.c,v 1.33 2007/08/02 10:50:25 fgsch Exp $ */
/* $OpenBSD: edit.h,v 1.8 2005/03/28 21:28:22 deraadt Exp $ */ /* $OpenBSD: edit.h,v 1.8 2005/03/28 21:28:22 deraadt Exp $ */
/* $OpenBSD: emacs.c,v 1.42 2009/06/02 06:47:47 halex Exp $ */ /* $OpenBSD: emacs.c,v 1.42 2009/06/02 06:47:47 halex Exp $ */
/* $OpenBSD: vi.c,v 1.24 2009/06/04 04:03:22 merdely Exp $ */ /* $OpenBSD: vi.c,v 1.25 2009/06/10 15:08:46 merdely Exp $ */
/*- /*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009
@ -25,7 +25,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.168 2009/06/10 18:12:44 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/edit.c,v 1.169 2009/06/10 19:33:16 tg Exp $");
/* tty driver characters we are interested in */ /* tty driver characters we are interested in */
typedef struct { typedef struct {
@ -4030,7 +4030,7 @@ vi_insert(int ch)
} }
if (ch == edchars.werase) { if (ch == edchars.werase) {
if (es->cursor != 0) { if (es->cursor != 0) {
tcursor = Backword(1); tcursor = backword(1);
memmove(&es->cbuf[tcursor], &es->cbuf[es->cursor], memmove(&es->cbuf[tcursor], &es->cbuf[es->cursor],
es->linelen - es->cursor); es->linelen - es->cursor);
es->linelen -= es->cursor - tcursor; es->linelen -= es->cursor - tcursor;
@ -5007,11 +5007,9 @@ Backword(int argcnt)
ncursor = es->cursor; ncursor = es->cursor;
while (ncursor > 0 && argcnt--) { while (ncursor > 0 && argcnt--) {
while (--ncursor >= 0 && while (--ncursor >= 0 && ksh_isspace(es->cbuf[ncursor]))
!ksh_isalnux(es->cbuf[ncursor]))
; ;
while (ncursor >= 0 && while (ncursor >= 0 && !ksh_isspace(es->cbuf[ncursor]))
ksh_isalnux(es->cbuf[ncursor]))
ncursor--; ncursor--;
ncursor++; ncursor++;
} }