New command: i_alternate, go to last image, issue #65
This commit is contained in:
parent
8a652a786c
commit
f2a3d73212
10
commands.c
10
commands.c
@ -46,6 +46,7 @@ extern win_t win;
|
||||
|
||||
extern fileinfo_t *files;
|
||||
extern int filecnt, fileidx;
|
||||
extern int alternate;
|
||||
|
||||
extern int prefix;
|
||||
|
||||
@ -155,6 +156,15 @@ bool i_navigate(arg_t a) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool i_alternate(arg_t a) {
|
||||
if (mode == MODE_IMAGE) {
|
||||
load_image(alternate);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool it_first(arg_t a) {
|
||||
if (mode == MODE_IMAGE && fileidx != 0) {
|
||||
load_image(0);
|
||||
|
@ -49,6 +49,7 @@ bool t_reload_all(arg_t);
|
||||
bool it_reload_image(arg_t);
|
||||
bool it_remove_image(arg_t);
|
||||
bool i_navigate(arg_t);
|
||||
bool i_alternate(arg_t);
|
||||
bool it_first(arg_t);
|
||||
bool it_n_or_last(arg_t);
|
||||
bool i_navigate_frame(arg_t);
|
||||
|
@ -73,6 +73,7 @@ static const keymap_t keys[] = {
|
||||
{ false, XK_BackSpace, i_navigate, (arg_t) -1 },
|
||||
{ false, XK_bracketright, i_navigate, (arg_t) +10 },
|
||||
{ false, XK_bracketleft, i_navigate, (arg_t) -10 },
|
||||
{ true, XK_6, i_alternate, (arg_t) None },
|
||||
{ false, XK_g, it_first, (arg_t) None },
|
||||
{ false, XK_G, it_n_or_last, (arg_t) None },
|
||||
|
||||
|
2
main.c
2
main.c
@ -62,6 +62,7 @@ win_t win;
|
||||
|
||||
fileinfo_t *files;
|
||||
int filecnt, fileidx;
|
||||
int alternate;
|
||||
size_t filesize;
|
||||
|
||||
int prefix;
|
||||
@ -217,6 +218,7 @@ void load_image(int new) {
|
||||
}
|
||||
|
||||
files[new].loaded = true;
|
||||
alternate = fileidx;
|
||||
fileidx = new;
|
||||
if (stat(files[new].path, &fstats) == 0)
|
||||
filesize = fstats.st_size;
|
||||
|
Loading…
Reference in New Issue
Block a user