aboutsummaryrefslogtreecommitdiff
path: root/src/navigator.h
diff options
context:
space:
mode:
authorDmitrij D. Czarkoff <czarkoff@gmail.com>2016-04-26 22:07:02 +0200
committerDmitrij D. Czarkoff <czarkoff@gmail.com>2016-04-26 22:07:02 +0200
commitfe10d9d38f02dbfe229e40f96f9640c3568a7f69 (patch)
treed8c06b524331784d004b8a549004295c12067373 /src/navigator.h
parent4d2f36a98be483e021845e4e8fc17722a8aa800c (diff)
downloadimv-fe10d9d38f02dbfe229e40f96f9640c3568a7f69.tar.gz
Reimplement '-x' flag
This change effectively backs out f1737ddd06141afbe99f37af3b5c2d0f1df5fe7a, implementing the same functionality in a simpler and more correct way. Implementation details: * imv_navigator.wrapped - a new field that has value "0" by default; once navigator wraps around the list, this field recieves value "1". * imv_navigator_wrapped(&nav) - a new function that returns non-zero value iff navigator wrapped around the list. Currently just returns value of imv_navigator.wrapped. While at it, expanded "test_navigator_remove" and merged it with "test_navigator_add". Resulting test is called "test_navigator_add_remove". Fixes #94.
Diffstat (limited to 'src/navigator.h')
-rw-r--r--src/navigator.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/navigator.h b/src/navigator.h
index 1645cae..b539e8b 100644
--- a/src/navigator.h
+++ b/src/navigator.h
@@ -28,6 +28,7 @@ struct imv_navigator {
time_t *mtimes;
int last_move_direction;
int changed;
+ int wrapped;
};
/* Initialises an instance of imv_navigator */
@@ -47,11 +48,8 @@ void imv_navigator_add(struct imv_navigator *nav, const char *path,
* guaranteed to be valid until the next call to an imv_navigator method. */
const char *imv_navigator_selection(struct imv_navigator *nav);
-/* Change the currently selected path. dir = -1 for previous, 1 for next
- * cycle = 1 to go to the beginning of the file list if end is reached
- * cycle = 0 to return error instead
- * Returns 1 on success, 0 otherwise */
-int imv_navigator_select_rel(struct imv_navigator *nav, int dir, int cycle);
+/* Change the currently selected path. dir = -1 for previous, 1 for next. */
+void imv_navigator_select_rel(struct imv_navigator *nav, int dir);
/* Removes the given path. The current selection is updated if necessary,
* based on the last direction the selection moved. */
@@ -67,6 +65,9 @@ int imv_navigator_find_path(struct imv_navigator *nav, const char *path);
* changed since last called */
int imv_navigator_poll_changed(struct imv_navigator *nav, const int nopoll);
+/* Check whether navigator wrapped around paths list */
+int imv_navigator_wrapped(struct imv_navigator *nav);
+
#endif