mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 09:06:02 +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();
|
||||
}
|
||||
|
||||
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
|
||||
bcmd_scroll(char* buffer, Argument* argument)
|
||||
{
|
||||
|
@ -4331,8 +4349,11 @@ cb_inputbar_activate(GtkEntry* entry, gpointer data)
|
|||
if(retv)
|
||||
isc_abort(NULL);
|
||||
|
||||
if(!succ)
|
||||
notify(ERROR, "Unknown command.");
|
||||
if(!succ) {
|
||||
/* it maybe a goto command */
|
||||
if(!try_goto(command))
|
||||
notify(ERROR, "Unknown command.");
|
||||
}
|
||||
|
||||
Argument arg = { HIDE };
|
||||
isc_completion(&arg);
|
||||
|
|
Loading…
Reference in a new issue