aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/done.ml7
-rw-r--r--lib/grep.ml4
-rw-r--r--lib/headlines.ml11
-rw-r--r--lib/help_screen.ml2
-rw-r--r--lib/todos.ml11
5 files changed, 19 insertions, 16 deletions
diff --git a/lib/done.ml b/lib/done.ml
index 5b8ad2c..650b9f7 100644
--- a/lib/done.ml
+++ b/lib/done.ml
@@ -24,8 +24,9 @@ let title ~tag =
let content_start = 2
let init ~goto_todo ~goto_headlines =
+ let hide_file_name = true in
let content = Grep.get_done () |> Grep.parse_todo_string in
- let content_pretty = Grep.pretty_format_todo content in
+ let content_pretty = Grep.pretty_format_todo ~hide_file_name content in
{ pos = 0, content_start
; scroll = 0
; content = content |> Array.of_list
@@ -34,7 +35,7 @@ let init ~goto_todo ~goto_headlines =
; goto_todo
; tag = ""
; output = None
- ; hide_file_name = false
+ ; hide_file_name
}
@@ -122,7 +123,7 @@ let rec render
t
{ state with
content = content |> Array.of_list
- ; content_pretty = content_pretty |> Array.of_list
+ ; content_pretty = content_pretty ~hide_file_name |> Array.of_list
; tag
})
; on_cancel =
diff --git a/lib/grep.ml b/lib/grep.ml
index 5989bc4..b5bdbea 100644
--- a/lib/grep.ml
+++ b/lib/grep.ml
@@ -94,7 +94,7 @@ let parse_todo_string s =
| _ -> raise (Not_A_Tuple (String.concat " SPLIT " split, message))))
-let pretty_format_todo ?(hide_file_name = false) parsed_headlines =
+let pretty_format_todo ~hide_file_name parsed_headlines =
let padding = get_padding_list parsed_headlines in
List.map
(fun (file_name, content) ->
@@ -238,7 +238,7 @@ let parse_headlines s =
(** Turns "2024-03-05.org:* Hello world" into "2024-03-05 | * Hello world" *)
-let pretty_format ?(hide_file_name = false) parsed_headlines =
+let pretty_format ~hide_file_name parsed_headlines =
let padding = get_padding_arr parsed_headlines in
Array.map
(fun (file_name, content) ->
diff --git a/lib/headlines.ml b/lib/headlines.ml
index 97eab20..6ed3ab3 100644
--- a/lib/headlines.ml
+++ b/lib/headlines.ml
@@ -24,7 +24,8 @@ let init ~goto_done_view ~goto_todos_view ~regexp =
print_endline "Regexp not found";
exit 0)
else (
- let content_pretty = content |> Grep.pretty_format in
+ let hide_file_name = true in
+ let content_pretty = content |> Grep.pretty_format ~hide_file_name in
{ pos = 0, 2
; scroll = 0
; content
@@ -33,7 +34,7 @@ let init ~goto_done_view ~goto_todos_view ~regexp =
; goto_todos_view
; output = None
; tag = regexp
- ; hide_file_name = false
+ ; hide_file_name
})
@@ -43,9 +44,9 @@ let title ~tag =
| a -> I.strf ~attr:A.(st bold) "%s > %s" "Notes" a |> I.pad ~l:0 ~t:0
-let refresh regexp =
+let refresh ~hide_file_name regexp =
let content = Grep.get_tagged_headlines regexp () |> Grep.parse_headlines in
- content, content |> Grep.pretty_format
+ content, content |> Grep.pretty_format ~hide_file_name
let rec render
@@ -266,7 +267,7 @@ let rec render
match Unix.wait () with
| _, _ ->
Common.Term.cursor t None;
- let content, content_pretty = refresh tag in
+ let content, content_pretty = refresh ~hide_file_name tag in
render t { state with content; content_pretty }
(* Capture resizing events *)
| exception Unix.Unix_error (Unix.EINTR, _, _) -> run_editor ()
diff --git a/lib/help_screen.ml b/lib/help_screen.ml
index 9d10010..e6baf42 100644
--- a/lib/help_screen.ml
+++ b/lib/help_screen.ml
@@ -33,7 +33,7 @@ let general_help_menu =
; "Done", "3"
; "Run Shell Command", "!"
; "Edit File in $EDITOR", "Enter, e"
- ; "Toggle Hide File Name", "h"
+ ; "Toggle File Name", "h"
]
diff --git a/lib/todos.ml b/lib/todos.ml
index 4ee911d..94fb5c8 100644
--- a/lib/todos.ml
+++ b/lib/todos.ml
@@ -25,7 +25,8 @@ let content_start = 2
let init ~goto_done ~goto_headlines =
let content = Grep.get_todos () |> Grep.parse_todo_string in
- let content_pretty = Grep.pretty_format_todo content in
+ let hide_file_name = true in
+ let content_pretty = Grep.pretty_format_todo ~hide_file_name content in
{ pos = 0, content_start
; scroll = 0
; content = content |> Array.of_list
@@ -34,17 +35,17 @@ let init ~goto_done ~goto_headlines =
; goto_done
; output = None
; tag = ""
- ; hide_file_name = false
+ ; hide_file_name
}
-let load_todos ?(hide_file_name = false) () =
+let load_todos ~hide_file_name () =
let todo_content = Grep.get_todos () |> Grep.parse_todo_string in
let todo_pretty = Grep.pretty_format_todo ~hide_file_name todo_content in
todo_content, todo_pretty
-let refresh ?(hide_file_name = false) tag =
+let refresh ~hide_file_name tag =
let content = Grep.get_tagged_todo tag () |> Grep.parse_todo_string in
let content_pretty = Grep.pretty_format_todo ~hide_file_name content in
content, content_pretty
@@ -145,7 +146,7 @@ let rec render
t
{ state with
content = content |> Array.of_list
- ; content_pretty = content_pretty |> Array.of_list
+ ; content_pretty = content_pretty ~hide_file_name |> Array.of_list
; tag
})
; on_cancel =