aboutsummaryrefslogtreecommitdiff
path: root/lib/headlines.ml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/headlines.ml17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/headlines.ml b/lib/headlines.ml
index b30903d..0633a73 100644
--- a/lib/headlines.ml
+++ b/lib/headlines.ml
@@ -4,6 +4,7 @@ open Notty
module Input_screen = Input_screen
module Stitched_article = Stitched_article
module Help_screen = Help_screen
+module Todos = Todos
type state =
{ pos : int * int
@@ -12,6 +13,7 @@ type state =
; content_pretty : string array
}
+(* TODO: Add page title *)
let rec render t ({ pos; scroll; content; content_pretty } as state) =
let x, y = pos in
let img =
@@ -48,7 +50,16 @@ let rec render t ({ pos; scroll; content; content_pretty } as state) =
| `Mouse ((`Press _ | `Drag), (_, y), _) ->
render t { state with pos = 0, min y content_length }
| `Key (`ASCII '?', []) -> Help_screen.render t { go_back = (fun () -> render t state) }
- | `Key (`ASCII '@', []) ->
+ | `Key (`ASCII 't', []) ->
+ let todo_content = Grep.get_todos () |> Grep.parse_todo_string in
+ let todo_pretty = Grep.pretty_format_todo todo_content in
+ let todo_state =
+ Todos.init
+ ~content:(todo_content |> Array.of_list)
+ ~content_pretty:(todo_pretty |> Array.of_list)
+ in
+ Todos.render t todo_state
+ | `Key (`ASCII 's', []) ->
let content =
Array.map
(fun (file_name, _) -> Grep.get_full_file_content_content file_name)
@@ -67,11 +78,11 @@ let rec render t ({ pos; scroll; content; content_pretty } as state) =
; scroll = 0
; go_back = (fun () -> render t state)
}
- | `Key (`ASCII 's', []) ->
+ | `Key (`ASCII 'r', []) ->
let (input_state : Input_screen.state) =
{ screen = img
; user_input = ""
- ; prompt = "GREP: "
+ ; prompt = "REGEXP: "
; on_enter =
(fun tag ->
let content = Grep.get_tagged_headlines tag () |> Grep.parse_headlines in