Fix file iterator prev to work with hidden files present

custom
ailurux 2 months ago
parent 49e92c295e
commit ca74ace48c
  1. 4
      src/tangara/lua/file_iterator.cpp

@ -53,7 +53,7 @@ auto FileIterator::prev() -> void {
f_rewinddir(&dir_);
auto new_offset = offset_ - 1;
offset_ = -1;
for (int i = 0; i <= new_offset; i++) {
while (offset_ < new_offset) {
iterate(show_hidden_);
}
}
@ -72,9 +72,9 @@ auto FileIterator::iterate(bool show_hidden) -> bool {
return false;
} else {
// Update current value
offset_++;
bool hidden = (info.fattrib & AM_HID) > 0 || info.fname[0] == '.';
if (!hidden || show_hidden) {
offset_++;
current_ = FileEntry{
.index = offset_,
.isHidden = hidden,

Loading…
Cancel
Save