From 0333c3e7d6521f469c00fce979d195e269a25375 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Tue, 9 Feb 2021 22:06:05 +0100 Subject: [PATCH] Compute center_x only when needed --- zathura/shortcuts.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zathura/shortcuts.c b/zathura/shortcuts.c index 2b0d29e..28a2b3a 100644 --- a/zathura/shortcuts.c +++ b/zathura/shortcuts.c @@ -982,11 +982,11 @@ sc_search(girara_session_t* session, girara_argument_t* argument, /* compute the center of the rectangle, which will be aligned to the center of the viewport */ - double center_x = (rectangle.x1 + rectangle.x2) / 2; - double center_y = (rectangle.y1 + rectangle.y2) / 2; - + const double center_y = (rectangle.y1 + rectangle.y2) / 2; pos_y += (center_y - (double)cell_height/2) / (double)doc_height; + if (search_hadjust == true) { + const double center_x = (rectangle.x1 + rectangle.x2) / 2; pos_x += (center_x - (double)cell_width/2) / (double)doc_width; }