diff --git a/Makefile b/Makefile index 7e39f32..0103fc5 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ DOBJECTS = ${SOURCE:.c=.do} all: options ${PROJECT} options: - @echo ${PROJECT} buld options: + @echo ${PROJECT} build options: @echo "CFLAGS = ${CFLAGS}" @echo "LDFLAGS = ${LDFLAGS}" @echo "DFLAGS = ${DFLAGS}" diff --git a/config.def.h b/config.def.h index 921c061..9840278 100644 --- a/config.def.h +++ b/config.def.h @@ -107,6 +107,7 @@ BufferCommand buffer_commands[] = { {"^zI$", bcmd_zoom, { ZOOM_IN } }, {"^zO$", bcmd_zoom, { ZOOM_OUT } }, {"^z0$", bcmd_zoom, { ZOOM_ORIGINAL } }, + {"^[0-9]+Z$", bcmd_zoom, { ZOOM_SPECIFIC } }, }; /* special commands */ diff --git a/zathura.c b/zathura.c index 5e49177..2c0cc46 100644 --- a/zathura.c +++ b/zathura.c @@ -24,8 +24,8 @@ enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, NORMAL, HIGHLIGHT, INSERT, VISUAL, DELETE_LAST_WORD, DEFAULT, ERROR, WARNING, NEXT_GROUP, PREVIOUS_GROUP, - ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, FORWARD, - BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH, + ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, ZOOM_SPECIFIC, + FORWARD, BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH, CONTINUOUS }; /* typedefs */ @@ -1984,11 +1984,29 @@ bcmd_zoom(char* buffer, Argument* argument) { if((Zathura.PDF.scale + ZOOM_STEP) <= ZOOM_MAX) Zathura.PDF.scale += ZOOM_STEP; + else + Zathura.PDF.scale = ZOOM_MAX; } else if(argument->n == ZOOM_OUT) { if((Zathura.PDF.scale - ZOOM_STEP) >= ZOOM_MIN) Zathura.PDF.scale -= ZOOM_STEP; + else + Zathura.PDF.scale = ZOOM_MIN; + } + else if(argument->n == ZOOM_SPECIFIC) + { + int b_length = strlen(buffer); + if(b_length < 1) + return; + + int value = atoi(g_strndup(buffer, b_length - 1)); + if(value <= ZOOM_MIN) + Zathura.PDF.scale = ZOOM_MIN; + else if(value >= ZOOM_MAX) + Zathura.PDF.scale = ZOOM_MAX; + else + Zathura.PDF.scale = value; } else Zathura.PDF.scale = 100;