aboutsummaryrefslogtreecommitdiff
path: root/lib/stitched_article.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stitched_article.ml')
-rw-r--r--lib/stitched_article.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/stitched_article.ml b/lib/stitched_article.ml
index bbdf7f4..c5c31d3 100644
--- a/lib/stitched_article.ml
+++ b/lib/stitched_article.ml
@@ -2,6 +2,7 @@ module Grep = Grep
module Common = Common
open Notty
module Input_screen = Input_screen
+module Help_screen = Help_screen
type state =
{ pos : int * int
@@ -62,6 +63,7 @@ let rec render t ({ pos; scroll; content_pretty; go_back; content } as state) =
render t { state with pos = 0, min y content_length }
| `Key (`ASCII 'j', []) | `Key (`ASCII 'N', [ `Ctrl ]) -> scroll_down ()
| `Key (`ASCII 'k', []) | `Key (`ASCII 'P', [ `Ctrl ]) -> scroll_up ()
+ | `Key (`ASCII '?', []) -> Help_screen.render t { go_back = (fun () -> render t state) }
| `Key (`ASCII 'e', []) | `Key (`Enter, []) ->
(* Editor might be set with extra args, in that case we need to separate these *)
let[@warning "-8"] (editor :: args) =
@@ -69,6 +71,8 @@ let rec render t ({ pos; scroll; content_pretty; go_back; content } as state) =
in
let selected_file, line_number, _, file_number_offset = Array.get content y in
let full_path_file = Grep.execution_directory ^ "/" ^ selected_file in
+ (* Because each file title consists of two lines, we need to account for the offset
+ it adds by removing the file_number *)
let line_number_arg = "+" ^ Int.to_string (line_number - file_number_offset) in
let full_args =
Array.append (Array.of_list args) [| line_number_arg; full_path_file |]