mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-01 03:06:01 +01:00
Support :digits (Closes: #41)
Thanks to Serge Guelton for the patch. Applied with some small modifications.
This commit is contained in:
parent
33ac8b2c33
commit
471c011f8d
1 changed files with 23 additions and 2 deletions
25
zathura.c
25
zathura.c
|
@ -4017,6 +4017,24 @@ bcmd_goto(char* buffer, Argument* argument)
|
||||||
update_status();
|
update_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
try_goto(const char* buffer)
|
||||||
|
{
|
||||||
|
char* endptr = NULL;
|
||||||
|
long page_number = strtol(buffer, &endptr, 10) - 1;
|
||||||
|
if(*endptr)
|
||||||
|
/* conversion error */
|
||||||
|
return FALSE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* behave like vim: <= 1 => first line, >= #lines => last line */
|
||||||
|
page_number = MAX(0, MIN(Zathura.PDF.number_of_pages - 1, page_number));
|
||||||
|
set_page(page_number);
|
||||||
|
update_status();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
bcmd_scroll(char* buffer, Argument* argument)
|
bcmd_scroll(char* buffer, Argument* argument)
|
||||||
{
|
{
|
||||||
|
@ -4331,8 +4349,11 @@ cb_inputbar_activate(GtkEntry* entry, gpointer data)
|
||||||
if(retv)
|
if(retv)
|
||||||
isc_abort(NULL);
|
isc_abort(NULL);
|
||||||
|
|
||||||
if(!succ)
|
if(!succ) {
|
||||||
notify(ERROR, "Unknown command.");
|
/* it maybe a goto command */
|
||||||
|
if(!try_goto(command))
|
||||||
|
notify(ERROR, "Unknown command.");
|
||||||
|
}
|
||||||
|
|
||||||
Argument arg = { HIDE };
|
Argument arg = { HIDE };
|
||||||
isc_completion(&arg);
|
isc_completion(&arg);
|
||||||
|
|
Loading…
Reference in a new issue