Remove bogus(?) assert
[llpp.git] / help.ml
blob93cd219fa1f9c7549dbdf74fcca2a01cda6ccd2b
1 let keys =
2 {|-----Quitting-----
3 escape/q - quit
4 Q - quit without saving the configuration or changes
5 W - save changes
7 -----Movement-----
8 up/down arrow - scroll up/down
9 left/right arrow - pan left/right (when zoomed in)
10 Ctrl-arrows - half a screen width/height scoll/pan
11 space - go to the next page
12 delete - go to the previous page
13 pageup/pagedown - go forward/backward one screen-full
14 g/G - go to first/last page
15 home/end - go to first/last page
17 -----Advanced Movement / History-----
18 backspace - go back after jumping (clicking link and suchlike)[1]
19 Alt-left/right arrow - go backward/forward in history
20 0..9 - enter page number to jump to
21 t - align top of the screen with the top of the page
22 <,> - rotate
23 Ctrl-pageup/pagedown - align top of the screen with first/last visible page
24 F - go to hinted link
25 if auto scrolling is active:
26 up/down arrows and mouse buttons 3/4 will make scrolling go faster/slower
28 -----Mouse-----
29 primary mouse button - click on link or select text[2]
30 when Shift is held - run "synctex command" with coordinates of the point[3]
31 when Ctrl is held - pan
32 zoom to block - when in block zoom mode
33 otherwise - pan if there's no text/link under the cursor
34 mouse buttons 3/4 - scroll up/down (aka mouse wheel)
35 when Shift is held - pan left/right
36 when Ctrl is held - zoom
37 mouse buttons 5/6 - pan left/right (aka horizontal mouse wheel)
38 secondary mouse button - select rectangle to zoom to
39 when Shift is held - add text annotation
41 Note:
42 moving mouse while holding primary mouse button will pan the page,
43 if the mouse is over selectable element (text/link) holding Ctrl
44 will make the page pan instead of the default action (selecting text/
45 clicking link)
47 -----Bookmarks-----
48 m - create named bookmark
49 ~ - create quick bookmark
51 -----Zoom-----
52 Ctrl+Shift up/down - set previous zoom level
53 B - toggle zoom block mode
54 w - change height of the window to encompass all of the page
55 Alt-c - center view
56 Ctrl-+/Ctrl-= - zoom in
57 Ctrl-- - zoom out
58 Ctrl-0 - reset zoom and panning
59 Ctrl-1 - fit tallest page
60 Ctrl-2 - fit tallest page height exactly
61 Ctrl-3 - cycle fit models
62 Ctrl-4 - 1:1 zoom
63 Ctrl-9/F9 - enter bird's eye view
65 -----Actions-----
66 u - dehighlight
67 r - reload document[4]
68 y - select link and paste its description to the clipboard
69 | - pipe selection through specified command
70 x - run pax command on selected region
71 Ctrl-p - launch a command with the document path as an argument
72 return - (in link navigation mode) follow link
73 = - show current position
74 e - view error log
76 -----Search-----
77 /,? - enter text to search for (/ - forward, ? - backward)
78 n - repeat last search (forward)
79 p, N - repeat last search (backward)
80 z[zbt] - "zoom in" on the first search result
81 Ctrl-g - interrupt search
83 -----Settings / Modes-----
84 [/] - decrease/increase page brightness
85 + - set page bias
86 - - toggle/set tunable
87 b - toggle scroll bar
88 l - toggle highlighting of the links
89 f - toggle fullscreen
90 insert - toggle link navigation mode
91 o - switch to outline/table of contents mode
92 ' - switch to bookmark mode
93 F1 - switch to help mode
94 Alt-F1 - switch to history mode
95 i - switch to info mode
96 P - switch to "presentation" mode
97 c - switch to previous column layout
98 a - auto scroll mode
100 -----Tunables-----
101 -i - toggle case sensitivity of searches
102 -R<number> - rotate
103 -v - toggle verbosity
104 -Z<number> - set zoom (percent)
105 -T - toggle trimming of margins
106 -I - invert colors
107 -M - toggle pax mode
108 -C<number> - set column count
109 -x<string> - set command to run on selection
110 -f - toggle "what's under cursor" identification
111 - (or "what's currently selected" in link navigation mode)
112 - (font name of the text under cursor or link target)
114 -----Bird's eye mode-----
115 Ctrl-9/F9/esc - leave bird's eye view
116 Ctrl-l - center the view on the currently selected page
117 (page)up/(page)down - navigate
118 home/end - go to first/last page
119 enter - select the page and leave bird's eye mode
120 primary mouse button - select the page under cursor and leave bird's eye mode
122 -----Outline/bookmark/help/info/history mode-----
123 esc - leave outline/bookmark mode
124 up/down - select previous/next item
125 alpha-numeric - quick search
126 Ctrl-s - repeat search (forward)
127 Ctrl-r - repeat search (backward)
128 Ctrl-l - center on current item
129 Ctrl-left/right - pan text left/right
130 Ctrl-up/down - scroll view up/down
131 Ctrl-insert - copy active item's text to clipboard
133 -----Outline/history mode-----
134 left/right - go up/down a level
135 Shift-left/right - go to prev/next item of same or higher level
136 Ctrl-a - toggle auto narrowing
137 / - enter auto narrowing
138 tab - begin nested narrowing
139 Ctrl-n - narrow to search pattern
140 Ctrl-u - undo narrowing
141 Ctrl-S - synchronize
143 -----Info mode-----
144 enter - toggle/enter new value for selected parameter
146 -----When entering search pattern/page number-----
147 up/down arrow - previous/next entered text
148 enter - confirm
149 Ctrl-g/esc - cancel
151 double/triple/quadruple/quintuple clicks in view mode will pipe the
152 word/line/block/page through pax command when Ctrl is held and
153 selection command otherwise
155 [1] if the document was previously visited initial backspace will
156 jump to the last visited place
158 [2] C&P
160 [3] arguments to the command are:
161 1 = path to the document
162 2 = zero based page number
163 3 = X coordinate within the page
164 4 = Y …
166 [4] document will also be reloaded upon reception of the HUP signal
168 -----Caveat emptor-----
169 o Text selection is limited to a single page
170 o Text searching is very naive|}
172 open Utils
174 let gotourl launcher url =
175 let command = Str.global_replace Utils.Re.percent url launcher in
176 try ignore @@ spawn command []
177 with exn -> dolog "failed to execute `%s': %s" command @@ exntos exn
179 let gotouri launcher uri =
180 if emptystr launcher
181 then dolog "%s" uri
182 else
183 if nonemptystr @@ geturl uri
184 then gotourl launcher uri
185 else dolog "obtained empty url from uri %S" uri
187 let version () =
188 Printf.sprintf "llpp %s, ocaml %s (%d bit), fitz %s"
189 (Ffi.llpp_version ()) Sys.ocaml_version Sys.word_size (Ffi.fz_version ())
191 let fixup =
192 let gr = Str.global_replace in
193 let dash = Str.regexp {|\([^ ]*\) +- +\(.*\)|}
194 and head = Str.regexp {|-----\(.*\)-----|}
195 and wcAp = Str.regexp "C&P" in
196 fun s -> gr dash "\\1\t\\2" @@ gr head "\xc2\xb7\\1" @@ gr wcAp Wsi.cAp s
198 let makehelp launcher =
199 version ()
200 :: "(searching in this text works just by typing (i.e. no initial '/'))"
201 :: E.s :: String.split_on_char '\n' keys |>
202 List.map (fun s ->
203 let s = fixup s in
204 match geturl s with
205 | "" -> (s, 0, None)
206 | url -> (s, 0, Some (fun uioh -> gotourl launcher url; uioh))