stitch

Note taking for messy minimalists

git clone git://mccd.space/stitch
commit 4c895f9e4a8607fb06c712aaca50a82d23eca05b
parent 6c54bef75d51070c6c171790f43e02f84641fc8a
Author: Marc Coquand <marc@mccd.space>
Date:   Mon, 20 May 2024 09:37:12 -0500

Reformat title with search; add to todo and done

Diffstat:
Mlib/done.ml | 14+++++++++++---
Mlib/headlines.ml | 2+-
Mlib/todos.ml | 14+++++++++++---
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/lib/done.ml b/lib/done.ml
@@ -15,7 +15,12 @@ type state =
   ; hide_file_name : bool
   }
 
-let title = I.strf ~attr:A.(st bold) "%s" "Done" |> I.pad ~l:0 ~t:0
+let title ~tag =
+  match tag with
+  | "" -> I.strf ~attr:A.(st bold) "%s" "Done" |> I.pad ~l:0 ~t:0
+  | a -> I.strf ~attr:A.(st bold) "%s > %s" "Done" a |> I.pad ~l:0 ~t:0
+
+
 let content_start = 2
 
 let init ~goto_todo ~goto_headlines =
@@ -49,7 +54,7 @@ let rec render
    ; goto_todo
    ; output
    ; hide_file_name
-   ; _
+   ; tag
    } as state)
   =
   let x, y = pos in
@@ -75,7 +80,10 @@ let rec render
         (content_pretty |> Basic.array_drop scroll)
     in
     let open I in
-    Array.fold_left (fun sum el -> el </> sum) (title </> dot </> output_info) elements
+    Array.fold_left
+      (fun sum el -> el </> sum)
+      (title ~tag </> dot </> output_info)
+      elements
   in
   Common.Term.image t img;
   let content_end = Array.length content_pretty + (content_start - 1) in
diff --git a/lib/headlines.ml b/lib/headlines.ml
@@ -45,7 +45,7 @@ let init ~goto_done_view ~goto_todos_view ~regexp =
 let title ~tag =
   match tag with
   | "" -> I.strf ~attr:A.(st bold) "%s" "Notes" |> I.pad ~l:0 ~t:0
-  | a -> I.strf ~attr:A.(st bold) "%s - %s" "Notes" a |> I.pad ~l:0 ~t:0
+  | a -> I.strf ~attr:A.(st bold) "%s > %s" "Notes" a |> I.pad ~l:0 ~t:0
 
 
 let rec render
diff --git a/lib/todos.ml b/lib/todos.ml
@@ -15,7 +15,12 @@ type state =
   ; hide_file_name : bool
   }
 
-let title = I.strf ~attr:A.(st bold) "%s" "Todo" |> I.pad ~l:0 ~t:0
+let title ~tag =
+  match tag with
+  | "" -> I.strf ~attr:A.(st bold) "%s" "Todo" |> I.pad ~l:0 ~t:0
+  | a -> I.strf ~attr:A.(st bold) "%s > %s" "Todo" a |> I.pad ~l:0 ~t:0
+
+
 let content_start = 2
 
 let init ~goto_done ~goto_headlines =
@@ -49,7 +54,7 @@ let rec render
    ; goto_done
    ; output
    ; hide_file_name
-   ; _
+   ; tag
    } as state)
   =
   let x, y = pos in
@@ -76,7 +81,10 @@ let rec render
         (content_pretty |> Basic.array_drop scroll)
     in
     let open I in
-    Array.fold_left (fun sum el -> el </> sum) (title </> dot </> output_info) elements
+    Array.fold_left
+      (fun sum el -> el </> sum)
+      (title ~tag </> dot </> output_info)
+      elements
   in
   Common.Term.image t img;
   let content_end = Array.length content_pretty + (content_start - 1) in