Browse Source

New command: i_alternate, go to last image, issue #65

master
Bert Münnich 12 years ago
parent
commit
f2a3d73212
4 changed files with 14 additions and 0 deletions
  1. +10
    -0
      commands.c
  2. +1
    -0
      commands.h
  3. +1
    -0
      config.def.h
  4. +2
    -0
      main.c

+ 10
- 0
commands.c View File

@@ -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);


+ 1
- 0
commands.h View File

@@ -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);


+ 1
- 0
config.def.h View File

@@ -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
- 0
main.c View File

@@ -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…
Cancel
Save