module Cursor.Brick.TextField where
import Cursor.List.NonEmpty
import Cursor.TextField
import Brick.Types as Brick
import Brick.Widgets.Core as Brick
import Cursor.Brick.Text
selectedTextFieldCursorWidget :: n -> TextFieldCursor -> Widget n
selectedTextFieldCursorWidget n (TextFieldCursor tfc) =
flip foldNonEmptyCursor tfc $ \befores current afters ->
vBox $
concat
[ map textWidget befores
, [selectedTextCursorWidget n current]
, map textWidget afters
]
textFieldCursorWidget :: TextFieldCursor -> Widget n
textFieldCursorWidget (TextFieldCursor tfc) =
flip foldNonEmptyCursor tfc $ \befores current afters ->
vBox $
concat
[ map textWidget befores
, [textCursorWidget current]
, map textWidget afters
]