From 2c121f79ddc29f13514059bf730d6c9ab06f6f3a Mon Sep 17 00:00:00 2001 From: malc Date: Sun, 17 Feb 2013 14:51:41 +0400 Subject: [PATCH] Do not change the position if remote goto target is visible --- main.ml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/main.ml b/main.ml index 9c62bfd..9143478 100644 --- a/main.ml +++ b/main.ml @@ -6996,9 +6996,16 @@ let ract cmds = let sw = float w1 /. w in let x = sw *. x in let x = leftx + state.x + truncate x in - if x < 0 || x >= state.winw - state.scrollw - then state.x <- state.x - x; - gotopage pageno top; + let newpan = + if x < 0 || x >= state.winw - state.scrollw + then (state.x <- state.x - x; true) + else false + in + let y, h = getpageyh pageno in + let y = y + (truncate (top *. float h)) in + let dy = y - state.y in + if newpan || not (dy > 0 && dy < state.winh - state.hscrollh) + then gotoy y ) ) | "goto1" :: args :: [] -> scan args "%u %f" gotopage -- 2.11.4.GIT