Commit
Author: Kevin Schoon [kevinschoon@gmail.com]
Hash: df3e810aa03bce580517cc283cfb97ef8d7ba27f
Timestamp: Tue, 02 Feb 2021 19:52:07 +0000 (3 years ago)

+25 -18 +/-1 browse
fix spacing in note list (again)
1diff --git a/lib/note.ml b/lib/note.ml
2index 2d61ab9..4c96074 100644
3--- a/lib/note.ml
4+++ b/lib/note.ml
5 @@ -213,26 +213,33 @@ module Display = struct
6
7 let to_cells columns notes =
8 let header =
9- List.map ~f:(fun column -> (Config.Column.to_string column, [ Bold; Underlined ])) columns
10+ List.map
11+ ~f:(fun column ->
12+ (Config.Column.to_string column, [ Bold; Underlined ]))
13+ columns
14+ in
15+ let note_cells =
16+ List.fold ~init:[]
17+ ~f:(fun accm note ->
18+ accm
19+ @ [
20+ List.map
21+ ~f:(fun column ->
22+ match column with
23+ | `Title -> (get_title note, [ Reset ])
24+ | `Description -> (get_description note, [ Reset ])
25+ | `Tags -> (String.concat ~sep:"|" (get_tags note), [ Reset ])
26+ | `WordCount ->
27+ ( Core.sprintf "%d"
28+ (List.length (Util.to_words note.markdown)),
29+ [ Reset ] )
30+ | `Slug -> (Slug.to_string note.slug, [ Reset ]))
31+ columns;
32+ ])
33+ notes
34 in
35- let note_cells = List.fold ~init: [] ~f: (fun accm note ->
36- accm @ [ List.map ~f: (fun column ->
37- match column with
38- | `Title ->
39- ((get_title note), [Reset])
40- | `Description ->
41- ((get_description note), [Reset])
42- | `Tags ->(String.concat ~sep:"|" (get_tags note), [ Reset ])
43- | `WordCount ->
44- ( Core.sprintf "%d" (List.length (Util.to_words note.markdown)),
45- [ Reset ] )
46- | `Slug -> (Slug.to_string note.slug, [Reset])
47- ) columns ]
48- ) notes in
49-
50 [ header ] @ note_cells
51
52-
53 let fixed_spacing cells =
54 (* find the maximum column length for all cells *)
55 List.fold ~init:[]
56 @@ -243,7 +250,7 @@ module Display = struct
57 let current_max =
58 match List.nth accm i with Some len -> len | None -> 0
59 in
60- if col_length > current_max then col_length + 1 else current_max)
61+ if col_length > current_max then col_length+2 else current_max)
62 row)
63 cells
64