This commit is contained in:
tg 2005-05-25 23:39:10 +00:00
parent cd54ef8f51
commit 541c0caead
1 changed files with 95 additions and 93 deletions

26
edit.c
View File

@ -1,4 +1,4 @@
/** $MirOS: src/bin/mksh/edit.c,v 1.4 2005/05/25 23:31:05 tg Exp $ */
/** $MirOS: src/bin/mksh/edit.c,v 1.5 2005/05/25 23:39:10 tg Exp $ */
/* $OpenBSD: edit.c,v 1.29 2005/04/13 02:33:08 deraadt Exp $ */
/* $OpenBSD: edit.h,v 1.8 2005/03/28 21:28:22 deraadt Exp $ */
/* $OpenBSD: emacs.c,v 1.37 2005/03/30 17:16:37 deraadt Exp $ */
@ -10,7 +10,7 @@
#include <ctype.h>
#include <libgen.h>
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.4 2005/05/25 23:31:05 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.5 2005/05/25 23:39:10 tg Exp $");
#define BEL 0x07
@ -100,8 +100,7 @@ check_sigwinch(void)
* see the change cause the environ doesn't change.
*/
if (ws.ws_col) {
x_cols = ws.ws_col < MIN_COLS ? MIN_COLS :
ws.ws_col;
x_cols = ws.ws_col < MIN_COLS ? MIN_COLS : ws.ws_col;
if ((vp = typeset("COLUMNS", 0, 0, 0, 0)))
setint(vp, (long) ws.ws_col);
@ -224,9 +223,8 @@ x_mode(bool onoff)
if (memcmp(&edchars, &oldchars, sizeof(edchars)) != 0) {
x_emacs_keys(&edchars);
}
} else {
} else
tcsetattr(tty_fd, TCSADRAIN, &tty_state);
}
return prev;
}
@ -3965,7 +3963,8 @@ vi_cmd(int argcnt, const char *cmd)
ohnum = hnum;
}
break;
case '_': {
case '_':
{
int inspace;
char *p, *sp;
@ -3999,7 +3998,8 @@ vi_cmd(int argcnt, const char *cmd)
}
p = sp;
}
modified = 1; hnum = hlast;
modified = 1;
hnum = hlast;
if (es->cursor != es->linelen)
es->cursor++;
while (*p && !issp(*p)) {
@ -4019,7 +4019,8 @@ vi_cmd(int argcnt, const char *cmd)
}
break;
case '~': {
case '~':
{
char *p;
int i;
@ -4028,10 +4029,12 @@ vi_cmd(int argcnt, const char *cmd)
for (i = 0; i < argcnt; i++) {
p = &es->cbuf[es->cursor];
if (islower(*p)) {
modified = 1; hnum = hlast;
modified = 1;
hnum = hlast;
*p = toupper(*p);
} else if (isupper(*p)) {
modified = 1; hnum = hlast;
modified = 1;
hnum = hlast;
*p = tolower(*p);
}
if (es->cursor < es->linelen - 1)
@ -4088,7 +4091,6 @@ domove(int argcnt, const char *cmd, int sub)
int ncursor = 0;
switch (*cmd) {
case 'b':
if (!sub && es->cursor == 0)
return -1;