nsxiv6fed8db
Added [,] mappings for go 10 images back/forward
+16 −3
2 files changed
| @@ -43,8 +43,7 @@ img_t img; | |||
| 43 | 43 | win_t win; | |
| 44 | 44 | ||
| 45 | 45 | const char **filenames; | |
| 46 | − | unsigned int filecnt; | |
| 47 | − | unsigned int fileidx; | |
| 46 | + | int filecnt, fileidx; | |
| 48 | 47 | ||
| 49 | 48 | unsigned char timeout; | |
| 50 | 49 | ||
| @@ -168,6 +167,20 @@ void on_keypress(XEvent *ev) { | |||
| 168 | 167 | changed = 1; | |
| 169 | 168 | } | |
| 170 | 169 | break; | |
| 170 | + | case '[': | |
| 171 | + | if (fileidx != 0) { | |
| 172 | + | fileidx = MAX(0, fileidx - 10); | |
| 173 | + | img_load(&img, filenames[fileidx]); | |
| 174 | + | changed = 1; | |
| 175 | + | } | |
| 176 | + | break; | |
| 177 | + | case ']': | |
| 178 | + | if (fileidx != filecnt - 1) { | |
| 179 | + | fileidx = MIN(fileidx + 10, filecnt - 1); | |
| 180 | + | img_load(&img, filenames[fileidx]); | |
| 181 | + | changed = 1; | |
| 182 | + | } | |
| 183 | + | break; | |
| 171 | 184 | case 'g': | |
| 172 | 185 | if (fileidx != 0) { | |
| 173 | 186 | fileidx = 0; | |
| @@ -21,7 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | 22 | typedef struct options_s { | |
| 23 | 23 | const char **filenames; | |
| 24 | − | unsigned int filecnt; | |
| 24 | + | int filecnt; | |
| 25 | 25 | } options_t; | |
| 26 | 26 | ||
| 27 | 27 | extern const options_t *options; | |