diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-11-04 15:33:26 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-11-04 15:33:26 -0500 |
commit | ffa9f8803ef2e0e9ffbfa8169dc6d7d338b14116 (patch) | |
tree | 59412d34b927d07a9f877dab303ca76eda15df77 /eval.c | |
parent | 0aaf5f0bd4d4eb76c17c37371e6706830f0857bb (diff) | |
download | bfs-ffa9f8803ef2e0e9ffbfa8169dc6d7d338b14116.tar.xz |
eval: Fix the status bar to only print the parent again
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1070,16 +1070,18 @@ static void eval_status(struct eval_state *state, struct bfs_bar *bar, struct ti goto out_rhs; } + const char *path = ftwbuf->path; + size_t pathlen = ftwbuf->nameoff; + if (ftwbuf->depth == 0) { + pathlen = strlen(path); + } + // Try to make sure even wide characters fit in the status bar size_t pathmax = width - rhslen - 3; size_t pathwidth = 0; - - const char *path = ftwbuf->path; - size_t pathlen = strlen(path); - mbstate_t mb; memset(&mb, 0, sizeof(mb)); - while (*path) { + while (pathlen > 0) { wchar_t wc; size_t len = mbrtowc(&wc, path, pathlen, &mb); int width; |