Make escape exit link nav mode (when active) instead of quiting
authormalc <av1474@comtv.ru>
Wed, 14 Nov 2012 20:45:35 +0000 (15 00:45 +0400)
committermalc <av1474@comtv.ru>
Wed, 14 Nov 2012 20:45:35 +0000 (15 00:45 +0400)
main.ml

diff --git a/main.ml b/main.ml
index 7c21aad..4ad9395 100644 (file)
--- a/main.ml
+++ b/main.ml
@@ -4734,12 +4734,18 @@ let viewkeyboard key mask =
           Wsi.setcursor Wsi.CURSOR_INHERIT;
           G.postRedisplay "kill zoom rect";
       | _ ->
-          match state.ranchors with
-          | [] -> raise Quit
-          | (path, password, anchor) :: rest ->
-              state.ranchors <- rest;
-              state.anchor <- anchor;
-              opendoc path password
+          begin match state.mode with
+          | LinkNav _ ->
+              state.mode <- View;
+              G.postRedisplay "esc leave linknav"
+          | _ ->
+              match state.ranchors with
+              | [] -> raise Quit
+              | (path, password, anchor) :: rest ->
+                  state.ranchors <- rest;
+                  state.anchor <- anchor;
+                  opendoc path password
+          end;
       end;
 
   | 0xff08 ->                           (* backspace *)