This commit is contained in:
malc 2012-02-05 20:13:50 +04:00
parent 1c0afdfa49
commit 9b591030b5
2 changed files with 26 additions and 14 deletions

1
KEYS
View file

@ -74,6 +74,7 @@ tunables
-t - set thumbnail width (pixels)
-T - toggle trimming of margins
-I - invert colors
-C - set column count
-f - toggle "what's under cursor" identification
(only font name of the text under cursor and link target currently)

39
main.ml
View file

@ -646,6 +646,19 @@ let intentry_with_suffix text key =
TEcont text
;;
let columns_to_string (n, a, b) =
if a = 0 && b = 0
then Printf.sprintf "%d" n
else Printf.sprintf "%d,%d,%d" n a b;
;;
let columns_of_string s =
try
(int_of_string s, 0, 0)
with _ ->
Scanf.sscanf s "%u,%u,%u" (fun n a b -> (n, a, b));
;;
let writecmd fd s =
let len = String.length s in
let n = 4 + len in
@ -2278,6 +2291,17 @@ let optentry mode _ key =
in
TEswitch ("auto scroll step: ", "", None, intentry, ondone)
| 'C' ->
let ondone s =
try
let n, a, b = columns_of_string s in
setcolumns n a b;
with exc ->
state.text <- Printf.sprintf "bad columns `%s': %s"
s (Printexc.to_string exc)
in
TEswitch ("columns: ", "", None, textentry, ondone)
| 'Z' ->
let ondone s =
try
@ -3380,19 +3404,6 @@ let describe_location () =
(fn+1) (ln+1) state.pagecount percent
;;
let columns_to_string (n, a, b) =
if a = 0 && b = 0
then Printf.sprintf "%d" n
else Printf.sprintf "%d,%d,%d" n a b;
;;
let columns_of_string s =
try
(int_of_string s, 0, 0)
with _ ->
Scanf.sscanf s "%u,%u,%u" (fun n a b -> (n, a, b));
;;
let enterinfomode =
let btos b = if b then "\xe2\x88\x9a" else "" in
let showextended = ref false in
@ -4121,7 +4132,7 @@ let viewkeyboard key =
| '-' ->
let ondone msg = state.text <- msg in
enttext (
"option [acfhilpstvAPRSZTI]: ", "", None,
"option [acfhilpstvACPRSZTI]: ", "", None,
optentry state.mode, ondone
)