mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 13:51:31 +00:00
experimenting with mblen
This commit is contained in:
parent
2e33c577b1
commit
49ae9b655a
13
nnn.c
13
nnn.c
|
@ -1189,6 +1189,7 @@ unescape(const char *str)
|
|||
static void
|
||||
printent(struct entry *ent, int sel)
|
||||
{
|
||||
return;
|
||||
static int ncols;
|
||||
|
||||
if (PATH_MAX + 16 < COLS)
|
||||
|
@ -1274,7 +1275,17 @@ printent_long(struct entry *ent, int sel)
|
|||
else if (ent->mode & 0100)
|
||||
snprintf(g_buf, ncols, "%s%-16.16s %8.8s* %s*", CURSYM(sel), buf, coolsize(ent->size), unescape(ent->name));
|
||||
else
|
||||
snprintf(g_buf, ncols, "%s%-16.16s %8.8s %s", CURSYM(sel), buf, coolsize(ent->size), unescape(ent->name));
|
||||
{
|
||||
// experimenting in this section
|
||||
const char *c = unescape(ent->name);
|
||||
unsigned int i;
|
||||
int count=0;
|
||||
for(i=0;i<strlen(c);i++)
|
||||
count+=mblen(c+i, MB_CUR_MAX);
|
||||
|
||||
snprintf(g_buf, ncols, "%s%-16.16s %8.8s %s--%d", CURSYM(sel), buf, coolsize(ent->size), unescape(ent->name), count);
|
||||
|
||||
}
|
||||
} else {
|
||||
if (S_ISDIR(ent->mode))
|
||||
snprintf(g_buf, ncols, "%s%-16.16s %8.8s/ %s/", CURSYM(sel), buf, coolsize(ent->blocks << 9), unescape(ent->name));
|
||||
|
|
Loading…
Reference in a new issue