mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 21:36:00 +01:00
honor search-hadjust setting in synctex forward search
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
fa06f015ba
commit
e17bb81cc3
1 changed files with 7 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "adjustment.h"
|
#include "adjustment.h"
|
||||||
|
|
||||||
|
#include <girara/session.h>
|
||||||
#include <girara/utils.h>
|
#include <girara/utils.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -173,6 +174,9 @@ highlight_rects(zathura_t* zathura, unsigned int page,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool search_hadjust = true;
|
||||||
|
girara_setting_get(zathura->ui.session, "search-hadjust", &search_hadjust);
|
||||||
|
|
||||||
/* compute the position of the center of the page */
|
/* compute the position of the center of the page */
|
||||||
double pos_x = 0;
|
double pos_x = 0;
|
||||||
double pos_y = 0;
|
double pos_y = 0;
|
||||||
|
@ -199,7 +203,9 @@ highlight_rects(zathura_t* zathura, unsigned int page,
|
||||||
double center_y = (rectangle.y1 + rectangle.y2) / 2;
|
double center_y = (rectangle.y1 + rectangle.y2) / 2;
|
||||||
|
|
||||||
pos_y += (center_y - (double)cell_height/2) / (double)doc_height;
|
pos_y += (center_y - (double)cell_height/2) / (double)doc_height;
|
||||||
|
if (search_hadjust == true) {
|
||||||
pos_x += (center_x - (double)cell_width/2) / (double)doc_width;
|
pos_x += (center_x - (double)cell_width/2) / (double)doc_width;
|
||||||
|
}
|
||||||
|
|
||||||
/* move to position */
|
/* move to position */
|
||||||
zathura_jumplist_add(zathura);
|
zathura_jumplist_add(zathura);
|
||||||
|
|
Loading…
Reference in a new issue