struct stat sb;
int r = -1, presel, selstartid = 0, selendid = 0;
const uchar_t opener_flags = (cfg.cliopener ? F_CLI : (F_NOTRACE | F_NOSTDIN | F_NOWAIT));
- bool watch = FALSE;
+ bool watch = FALSE, cd = TRUE;
ino_t inode = 0;
#ifndef NOMOUSE
}
#endif
- if (order) {
+ if (order && cd) {
if (cfgsort[cfg.curctx] != '0') {
if (cfgsort[cfg.curctx] == 'z')
set_sort_flags('c');
} else
cfgsort[cfg.curctx] = cfgsort[CTX_MAX];
}
+ cd = TRUE;
populate(path, lastname);
if (g_state.interrupt) {
/* Scroll down */
if (event.bstate == BUTTON5_PRESSED && ndents
&& (cfg.rollover || (cur != ndents - 1))) {
- if (!cfg.rollover && cur >= ndents - scroll_lines)
- move_cursor(ndents-1, 0);
- else
- move_cursor((cur + scroll_lines) % ndents, 0);
+ move_cursor((!cfg.rollover && cur >= ndents - scroll_lines)
+ ? (ndents - 1) : ((cur + scroll_lines) % ndents), 0);
break;
}
#endif
/* Start watching the directory */
watch = TRUE;
copycurname();
+ cd = FALSE;
goto begin;
}
case SEL_NAV_IN: // fallthrough
case SEL_OPEN:
/* Cannot descend in empty directories */
- if (!ndents)
+ if (!ndents) {
+ cd = FALSE;
goto begin;
+ }
pent = &pdents[cur];
mkpath(path, pent->name, newpath);
presel = 0;
break;
}
- if (presel == FILTER) /* Refresh dir and filter again */
+ if (presel == FILTER) { /* Refresh dir and filter again */
+ cd = FALSE;
goto begin;
+ }
goto nochange;
case SEL_MFLTR: // fallthrough
case SEL_HIDDEN: // fallthrough
clearfilter();
}
copycurname();
+ cd = FALSE;
goto begin;
case SEL_DETAIL:
cfg.showdetail ^= 1;
/* Save current */
copycurname();
/* Repopulate as directory content may have changed */
+ cd = FALSE;
goto begin;
}
case SEL_SEL:
if (cfg.filtermode || filterset())
presel = FILTER;
+ cd = FALSE;
goto begin;
}
}
xstrsncpy(lastname, xbasename(newpath), NAME_MAX+1);
else
copycurname();
+ cd = FALSE;
goto begin;
}
case SEL_ARCHIVE: // fallthrough
xstrsncpy(lastname, tmp, NAME_MAX + 1);
clearfilter(); /* Archive name may not match */
clearselection(); /* Archive operation complete */
+ cd = FALSE;
goto begin;
}
continue;
clearfilter();
}
+ cd = FALSE;
goto begin;
}
case SEL_PLUGIN:
goto nochange;
/* Repopulate as directory content may have changed */
+ cd = FALSE;
goto begin;
case SEL_UMOUNT:
presel = MSG_ZERO;
/* Dir removed, go to next entry */
copynextname(lastname);
+ cd = FALSE;
goto begin;
#ifndef NOSSN
case SEL_SESSIONS:
case SEL_TIMETYPE:
if (!set_time_type(&presel))
goto nochange;
+ cd = FALSE;
goto begin;
case SEL_QUITCTX: // fallthrough
case SEL_QUITCD: // fallthrough