-/* $OpenBSD: vi.c,v 1.33 2015/09/18 07:28:24 nicm Exp $ */
+/* $OpenBSD: vi.c,v 1.34 2015/10/15 19:36:50 mmcc Exp $ */
/*
* vi command editing
case '~': {
char *p;
+ unsigned char c;
int i;
if (es->linelen == 0)
return -1;
for (i = 0; i < argcnt; i++) {
p = &es->cbuf[es->cursor];
- if (islower((unsigned char)*p)) {
+ c = (unsigned char)*p;
+ if (islower(c)) {
modified = 1; hnum = hlast;
- *p = toupper(*p);
- } else if (isupper((unsigned char)*p)) {
+ *p = toupper(c);
+ } else if (isupper(c)) {
modified = 1; hnum = hlast;
- *p = tolower(*p);
+ *p = tolower(c);
}
if (es->cursor < es->linelen - 1)
es->cursor++;