diff options
author | Max Kellermann <max@duempel.org> | 2008-10-02 19:01:02 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-02 19:01:02 +0200 |
commit | ee9951222c4f0e3970466f6aba2e42dea21a6cdc (patch) | |
tree | e02b7d1ae6b5078df340485e1b81861a0aab9e12 /src/wreadln.c | |
parent | b693269fd9740a3074b84da5645f6bd9daa6486e (diff) | |
download | mpd-ee9951222c4f0e3970466f6aba2e42dea21a6cdc.tar.gz mpd-ee9951222c4f0e3970466f6aba2e42dea21a6cdc.tar.xz mpd-ee9951222c4f0e3970466f6aba2e42dea21a6cdc.zip |
charset: renamed my_strlen() to utf8_width()
my_strlen() is a bad name for the function, since the return value is
not a length, but a visible width on the screen. Rename it to
utf8_width() and change its return type to "unsigned".
Diffstat (limited to '')
-rw-r--r-- | src/wreadln.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wreadln.c b/src/wreadln.c index 840b73ba0..d01cfcb87 100644 --- a/src/wreadln.c +++ b/src/wreadln.c @@ -116,7 +116,7 @@ static inline void drawline(gint cursor, /* clear input area */ whline(w, ' ', width); /* print visible part of the line buffer */ - if(masked == TRUE) whline(w, '*', my_strlen(line)-start); + if(masked == TRUE) whline(w, '*', utf8_width(line) - start); else waddnstr(w, line+start, width); /* move the cursor to the correct position */ wmove(w, y, x0 + cursor-start); @@ -274,7 +274,7 @@ _wreadln(WINDOW *w, line[cursor] = 0; break; case KEY_CTRL_U: - cursor = my_strlen(line); + cursor = utf8_width(line); for (i = 0;i < cursor; i++) line[i] = '\0'; cursor = 0; @@ -290,7 +290,7 @@ _wreadln(WINDOW *w, break; case KEY_DC: /* handle delete key. As above */ case KEY_CTRL_D: - if (cursor <= (gint)my_strlen(line) - 1) { + if (cursor <= (gint)utf8_width(line) - 1) { for (i = cursor; line[i] != 0; i++) line[i] = line[i + 1]; } |