terminal user interface to jujutsu. Focused on speed and clarity
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

support configurable cursor style for edit field

Eli Dowling ecd5a9e5 46dda730

+4 -3
+3 -3
forks/nottui/lib/nottui/widgets/nottui_widgets.ml
··· 101 101 102 102 let sub' str p l = if p = 0 && l = String.length str then str else String.sub str p l 103 103 104 - let edit_field ?(focus = Focus.make ()) ?(attr_focused = A.(empty)) state ~on_change ~on_submit = 104 + let edit_field ?(focus = Focus.make ()) ?(attr_cursor=A.(bg lightblue ++ fg black ++ st bold)) ?(attr_focused = A.(empty)) state ~on_change ~on_submit = 105 105 let update focus_h focus (text, pos) = 106 106 let pos = clampi pos ~min:0 ~max:(String.length text) in 107 107 let content = ··· 119 119 @ 120 120 if pos < String.length text 121 121 then 122 - [ I.string A.(bg lightblue ++ fg black ++ attr ++ st bold) (sub' text pos 1) 122 + [ I.string A.(attr++ attr_cursor) (sub' text pos 1) 123 123 ; I.string attr (sub' text (pos + 1) (len - pos - 1)) 124 124 ] 125 - else [ I.string A.(bg lightblue ++ fg black) " " ]) 125 + else [ I.string A.(st underline ++attr_cursor) " " ]) 126 126 else [ I.string A.(st underline) (if text = "" then " " else text) ] 127 127 in 128 128 let handler = function
+1
forks/nottui/lib/nottui/widgets/nottui_widgets.mli
··· 14 14 Supports navigating with arrow keys *) 15 15 val edit_field 16 16 : ?focus:Focus.handle 17 + -> ?attr_cursor:attr 17 18 -> ?attr_focused:attr 18 19 -> (string * int) Lwd.t 19 20 -> on_change:(string * int -> unit)