summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-11-04 15:33:26 -0500
committerTavian Barnes <tavianator@tavianator.com>2020-11-04 15:33:26 -0500
commitffa9f8803ef2e0e9ffbfa8169dc6d7d338b14116 (patch)
tree59412d34b927d07a9f877dab303ca76eda15df77 /eval.c
parent0aaf5f0bd4d4eb76c17c37371e6706830f0857bb (diff)
downloadbfs-ffa9f8803ef2e0e9ffbfa8169dc6d7d338b14116.tar.xz
eval: Fix the status bar to only print the parent again
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/eval.c b/eval.c
index e0298af..6837e44 100644
--- a/eval.c
+++ b/eval.c
@@ -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;