From 3603d54710d1d44727ef5a66401a19ea62d19df0 Mon Sep 17 00:00:00 2001 From: malc Date: Sat, 9 Sep 2017 15:50:11 +0300 Subject: [PATCH] "Fix" describe_location Address #57. Still far from ideal, in split columns mode duplicate page numbers will be reported plus there's no neat split into ranges, maybe some other day. --- main.ml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/main.ml b/main.ml index eb13a41..3c5098d 100644 --- a/main.ml +++ b/main.ml @@ -3317,22 +3317,20 @@ let setcheckers enabled = ;; let describe_location () = - let fn = page_of_y state.y in - let ln = page_of_y (state.y + state.winh - 1) in - let maxy = maxy () in + let pages = + let layout = layout state.x state.y state.winw state.winh in + List.map (fun l -> string_of_int (l.pageno + 1)) layout + in let percent = + let maxy = maxy () in if maxy <= 0 then 100. else 100. *. (float state.y /. float maxy) in - if fn = ln - then - Printf.sprintf "page %d of %d [%.2f%%]" - (fn+1) state.pagecount percent - else - Printf.sprintf - "pages %d-%d of %d [%.2f%%]" - (fn+1) (ln+1) state.pagecount percent + match pages with + | s :: [] -> Printf.sprintf "page %s of %d [%.2f%%]" s state.pagecount percent + | ss -> Printf.sprintf "pages [%s] of %d [%.2f%%]" (String.concat "," ss) + state.pagecount percent ;; let setpresentationmode v = -- 2.11.4.GIT