Refactor inputwin.c

This commit is contained in:
James Booth
2015-01-18 22:55:51 +00:00
parent 8954adc620
commit 9ecdb39433
3 changed files with 142 additions and 104 deletions

View File

@@ -224,6 +224,18 @@ utf8_display_len(const char * const str)
return len;
}
gboolean
utf8_is_printable(const wint_t ch)
{
char bytes[MB_CUR_MAX+1];
size_t utf_len = wcrtomb(bytes, ch, NULL);
bytes[utf_len] = '\0';
gunichar unichar = g_utf8_get_char(bytes);
return g_unichar_isprint(unichar) && (ch != KEY_MOUSE);
}
char *
prof_getline(FILE *stream)
{