mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 04:46:01 +01:00
Use labels in buffered goto command
The page labels are now used in the buffered command bcmd_goto, so if this option is enabled and you try to reach page number 20, zathura first seraches for a label named like that and moves to that page instead of moving to page 20 in the document.
This commit is contained in:
parent
52b4eb464f
commit
5e45c8d608
1 changed files with 15 additions and 1 deletions
16
zathura.c
16
zathura.c
|
@ -2761,7 +2761,21 @@ bcmd_goto(char* buffer, Argument* argument)
|
|||
else if(!strcmp(buffer, "G"))
|
||||
set_page(Zathura.PDF.number_of_pages - 1);
|
||||
else
|
||||
set_page(atoi(g_strndup(buffer, b_length - 1)) - 1);
|
||||
{
|
||||
char* id = g_strndup(buffer, b_length - 1);
|
||||
int pid = atoi(id);
|
||||
|
||||
if(Zathura.Global.enable_labels)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < Zathura.PDF.number_of_pages; i++)
|
||||
if(!strcmp(id, Zathura.PDF.pages[i]->label))
|
||||
pid = Zathura.PDF.pages[i]->id;
|
||||
}
|
||||
|
||||
set_page(pid - 1);
|
||||
g_free(id);
|
||||
}
|
||||
|
||||
update_status();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue