aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/vis.c b/vis.c
index f82ab89..6c44b12 100644
--- a/vis.c
+++ b/vis.c
@@ -615,15 +615,14 @@ static void op_case_change(OperatorContext *c) {
len = text_bytes_get(vis->win->text, c->range.start, len, buf);
size_t rem = len;
for (char *cur = buf; rem > 0; cur++, rem--) {
- if (isascii((unsigned char)*cur)) {
- if (c->arg->i == 0) {
- *cur = islower((unsigned char)*cur) ?
- toupper((unsigned char)*cur) :
- tolower((unsigned char)*cur) ;
- } else if (c->arg->i > 0)
- *cur = toupper((unsigned char)*cur);
+ int ch = (unsigned char)*cur;
+ if (isascii(ch)) {
+ if (c->arg->i == 0)
+ *cur = islower(ch) ? toupper(ch) : tolower(ch);
+ else if (c->arg->i > 0)
+ *cur = toupper(ch);
else
- *cur = tolower((unsigned char)*cur);
+ *cur = tolower(ch);
}
}