File src/flist_pos.c changed (mode: 100644) (index 9589b9c53..996be165e) |
... |
... |
static int get_column_top_pos(const view_t *view); |
47 |
47 |
static int get_column_bottom_pos(const view_t *view); |
static int get_column_bottom_pos(const view_t *view); |
48 |
48 |
static const char * get_last_ext(const char name[]); |
static const char * get_last_ext(const char name[]); |
49 |
49 |
static int is_mismatched_entry(const dir_entry_t *entry); |
static int is_mismatched_entry(const dir_entry_t *entry); |
50 |
|
static int find_next(const view_t *view, entry_predicate pred); |
|
51 |
|
static int find_prev(const view_t *view, entry_predicate pred); |
|
|
50 |
|
static int find_next(const view_t *view, int from, entry_predicate pred); |
|
51 |
|
static int find_prev(const view_t *view, int from, entry_predicate pred); |
52 |
52 |
static int file_can_be_displayed(const char directory[], const char filename[]); |
static int file_can_be_displayed(const char directory[], const char filename[]); |
53 |
53 |
|
|
54 |
54 |
int |
int |
|
... |
... |
fpos_prev_dir_sibling(const view_t *view) |
740 |
740 |
int |
int |
741 |
741 |
fpos_next_dir(const view_t *view) |
fpos_next_dir(const view_t *view) |
742 |
742 |
{ |
{ |
743 |
|
return find_next(view, &fentry_is_dir); |
|
|
743 |
|
return find_next(view, view->list_pos, &fentry_is_dir); |
744 |
744 |
} |
} |
745 |
745 |
|
|
746 |
746 |
int |
int |
747 |
747 |
fpos_prev_dir(const view_t *view) |
fpos_prev_dir(const view_t *view) |
748 |
748 |
{ |
{ |
749 |
|
return find_prev(view, &fentry_is_dir); |
|
|
749 |
|
return find_prev(view, view->list_pos, &fentry_is_dir); |
750 |
750 |
} |
} |
751 |
751 |
|
|
752 |
752 |
int |
int |
753 |
753 |
fpos_next_selected(const view_t *view) |
fpos_next_selected(const view_t *view) |
754 |
754 |
{ |
{ |
755 |
|
return find_next(view, &is_entry_selected); |
|
|
755 |
|
return find_next(view, view->list_pos, &is_entry_selected); |
756 |
756 |
} |
} |
757 |
757 |
|
|
758 |
758 |
int |
int |
759 |
759 |
fpos_prev_selected(const view_t *view) |
fpos_prev_selected(const view_t *view) |
760 |
760 |
{ |
{ |
761 |
|
return find_prev(view, &is_entry_selected); |
|
|
761 |
|
return find_prev(view, view->list_pos, &is_entry_selected); |
762 |
762 |
} |
} |
763 |
763 |
|
|
764 |
764 |
int |
int |
765 |
765 |
fpos_next_mismatch(const view_t *view) |
fpos_next_mismatch(const view_t *view) |
766 |
766 |
{ |
{ |
767 |
767 |
return (view->custom.type == CV_DIFF) |
return (view->custom.type == CV_DIFF) |
768 |
|
? find_next(view, &is_mismatched_entry) |
|
|
768 |
|
? find_next(view, view->list_pos, &is_mismatched_entry) |
769 |
769 |
: view->list_pos; |
: view->list_pos; |
770 |
770 |
} |
} |
771 |
771 |
|
|
|
... |
... |
int |
773 |
773 |
fpos_prev_mismatch(const view_t *view) |
fpos_prev_mismatch(const view_t *view) |
774 |
774 |
{ |
{ |
775 |
775 |
return (view->custom.type == CV_DIFF) |
return (view->custom.type == CV_DIFF) |
776 |
|
? find_prev(view, &is_mismatched_entry) |
|
|
776 |
|
? find_prev(view, view->list_pos, &is_mismatched_entry) |
777 |
777 |
: view->list_pos; |
: view->list_pos; |
778 |
778 |
} |
} |
779 |
779 |
|
|
|
... |
... |
is_mismatched_entry(const dir_entry_t *entry) |
800 |
800 |
/* Finds position of the next entry matching the predicate. Returns new |
/* Finds position of the next entry matching the predicate. Returns new |
801 |
801 |
* position which isn't changed if no next directory is found. */ |
* position which isn't changed if no next directory is found. */ |
802 |
802 |
static int |
static int |
803 |
|
find_next(const view_t *view, entry_predicate pred) |
|
|
803 |
|
find_next(const view_t *view, int from, entry_predicate pred) |
804 |
804 |
{ |
{ |
805 |
|
int pos = view->list_pos; |
|
|
805 |
|
int pos = from; |
806 |
806 |
while(++pos < view->list_rows) |
while(++pos < view->list_rows) |
807 |
807 |
{ |
{ |
808 |
808 |
if(pred(&view->dir_entry[pos])) |
if(pred(&view->dir_entry[pos])) |
|
... |
... |
find_next(const view_t *view, entry_predicate pred) |
816 |
816 |
/* Finds position of the previous entry matching the predicate. Returns new |
/* Finds position of the previous entry matching the predicate. Returns new |
817 |
817 |
* position which isn't changed if no previous directory is found. */ |
* position which isn't changed if no previous directory is found. */ |
818 |
818 |
static int |
static int |
819 |
|
find_prev(const view_t *view, entry_predicate pred) |
|
|
819 |
|
find_prev(const view_t *view, int from, entry_predicate pred) |
820 |
820 |
{ |
{ |
821 |
|
int pos = view->list_pos; |
|
|
821 |
|
int pos = from; |
822 |
822 |
while(--pos >= 0) |
while(--pos >= 0) |
823 |
823 |
{ |
{ |
824 |
824 |
if(pred(&view->dir_entry[pos])) |
if(pred(&view->dir_entry[pos])) |