- Fix mouse input translation in scrollable elements
- Breaking Change:
Reflex.Vty.Widget.Scroll.scrollable
's type has changed. The child widget no longer has to return images (seecaptureImages
below), but can return a value. Specifically, the child widget type has gone fromm (Behavior t Image, Event t ())
tom (Event t (), a)
. - Breaking Change: Instance of
HasImageWriter
must now implementcaptureImages
, a function that allows theImage
s produced by a widget to be intercepted and not rendered. This is used to implementscrollable
.
- Extend version bounds
- Update to use latest version of vty (for cross-platform support)
- Fix an issue where the cursor tag is not used for an empty string in
displayLineWithAlignment
- Change
inputInFocusedRegion
to filter mouse scroll wheel input based on if the region under than the mouse rather than using mouse drag tracking - Add MonadCatch, MonadThrow, and MonadMask instances (relies on reflex-0.9.2.0 or greater)
- Breaking change:
scrollableText
now takes aScrollableConfiguration
instead of just anEvent t Int
of lines to scroll by. Replacing ascrollableText myEvent
invocation withscrollableText (def { _scrollableConfig_scrollBy = myEvent })
should recover the old behavior.scrollableText
now returns aScrollable t
instead of aBehavior (Int, Int)
. The secondInt
, representing the total number of lines, is part of theScrollable
record. The firstInt
, representing the current scroll position is replaced by theScrollPos
in theScrollable
output.ScrollPos
is a new type that captures whether ascrollableText
is scrolled to the very top, very bottom, or somewhere in between.
scrollableText
can now be given a starting scroll position and an event that scrolls it to a particular position.scrollableText
can be configured to remain scrolled to the bottom on new output, either always or whenever the user is scrolled to the bottom and new output appears.- Added a new
scrollable
widget inReflex.Vty.Widget.Scroll
that allows vertical scrolling when anImage
is taller than the widget's height. - Add
ctrlc
, a convenience function that returns an event that fires when a Ctrl+c keypress is detected - Fix several issues with wide chars, cursor position and word wrapping in Zipper.hs
- Add
centerText
function to Reflex.Vty.Widget.Box
- Support ghc-9.6
- Loosen version bounds and support GHC 9.4.4
- Add
MonadHold t (Performable m)
andMonadFix (Performable m)
instances toMonadVtyApp
- Breaking Changes:
- Added mouse tracking to the behavior of
pane
such that- Mouse actions that start outside of the region are not tracked
- Mouse drag sequences that start OFF the region are NOT reported
- Mouse drag sequences that start ON the region and drag off ARE reported
- Introduce
MonadHold
constraint topane
- Added
MonadHold
constraint to several methods that usepane
- Added mouse tracking to the behavior of
- Loosen version bounds and support GHC 9.4
- Replace
mempty
withdefAttr
for Attr from Graphics.Vty to make it compatible with vty-5.34
- Re-design
textInput
,TextInput
andTextInputConfig
.- Allows users to implement more complex behavior.
_textInputConfig_modify
is now applied to the text-value oftextInput
after user input events such as mouse clicks and keyboard input. This may change the observable behavior.
- Loosen version bounds on ref-tf and vty
- Module Reorganization: The following modules have been added (and are all re-exported by Reflex.Vty):
- Reflex.Vty.Widget.Box for all the box functions and datatypes
- Reflex.Vty.Widget.Input.Mouse for clicking, dragging, and scrolling
- Reflex.Vty.Widget.Split contains
splitV
,splitH
, etc - Reflex.Vty.Widget.Text contains text rendering functions like
text
anddisplay
- Bugfixes:
- Remove text-icu dependency and switch to
wcwidth
from vty package to compute character width inData.Text.Zipper
. goToDisplayLinePosition
inData.Text.Zipper
correctly accounts for character width now.- #37
Layout
should support focus changes through nested layouts (thanks @pdlla for getting this started -- see entry on Layout and Focus below). - Fix distribution of available space when it cannot be evenly distributed. Previously, all leftover space would be allocated to the first stretchable widget.
- Remove text-icu dependency and switch to
- Breaking Changes:
- Layout and focus have been substantially refactored to fix #37 and support a wider variety of layouts and focus switching requirements.
- Added a new
HasFocus
class (the old one is nowHasFocusReader
) to produce focusable elements, and manage focus state. See the "Focus" section of the Reflex.Vty.Widget.Layout module documentation. Layout
no longer has any focus-tracking responsibility. See the "Layout" section of the Reflex.Vty.Widget.Layout module documentation.tile
no longer takes a configuration record and no longer requires that its child widget return a focus request event. Focus requests are instead handled using calls torequestFocus
in the child widget.- Calls to
fixed
andstretch
must now be replaced withtile . fixed
andtile . stretch
stretch
now takes a minimum size argument- Added
flex
which is equivalent tostretch 0
tabNavigation
no longer returns anEvent
. Instead it callsrequestFocus
directly with the appropriateRefocus_Shift
value.- Added
axis
(inHasLayout
), a lower-level primitive which is used to implementrow
andcol
. - Added
region
(inHasLayout
), which is used to claim screen real estate and used to implementtile
andgrout
- Added
grout
, a container element that is not itself focusable (though its children can be)
- Added a new
- Removed
VtyWidget
and replaced it with a number of separate classes and monad transformers- Replace
HasDisplaySize
withHasDisplayRegion
which carries around a region instead of just a width and height.displayWidth
anddisplayHeight
are now functions implemented in terms ofaskRegion
instead of class methods. - Add a
DisplayRegion
monad transformer - Rename
ImageWriter
toHasImageWriter
- Introduce an
ImageWriter
monad transformer - Rename
HasFocus
toHasFocusReader
- Introduce a
FocusReader
monad transformer - Replace
HasVtyInput
withHasInput
- Introduce an
Input
monad transformer - Introduce
HasTheme
reader class to allow setting Vty attributes of all built-in widgets - Introduce
ThemeReader
monad transformer
- Replace
- Remove
DynRegion
andcurrentRegion
. UseDynamic t Region
andcurrent
instead. This also changes the type ofpane
's argument. CheckboxConfig
now has a field taking anEvent
to set the value of the checkbox.checkbox
now accepts keyboard input (spacebar to check and uncheck) and is displayed in bold when focused.HasInput
(formerlyHasVtyInput
) now has a methodlocalInput
for filtering the input a child widget may receiveHasImageWriter
now has a methodmapImages
for transforming the images emitted by a child widgetboxTitle
now takes aBehavior t Text
as its title, instead of a plainText
fill
now takes aBehavior t Char
instead of aChar
- The following functions are no longer specialized to
VtyWidget
:pane
: Now requiresHasInput t m, HasImageWriter t m, HasDisplayRegion t m, HasFocusReader t m
drag
: Now requiresHasInput
mouseDown
: Now requiresHasInput
mouseUp
: Now requiresHasInput
mouseScroll
: Now requiresHasInput
key
: Now requiresHasInput
keys
: Now requiresHasInput
keyCombo
: Now requiresHasInput
keyCombos
: Now requiresHasInput
splitV
: Now requiresHasDisplayRegion t m, HasInput t m, HasImageWriter t m, HasFocusReader t m
splitH
: Now requiresHasDisplayRegion t m, HasInput t m, HasImageWriter t m, HasFocusReader t m
splitVDrag
: Now requiresHasDisplayRegion t m, HasInput t m, HasImageWriter t m, HasFocusReader t m
fill
: Now requiresHasImageWriter
andHasDisplayRegion
boxTitle
: Now requiresHasDisplayRegion t m, HasImageWriter t m, HasInput t m, HasFocusReader t m, HasTheme t m
box
: Now requiresHasDisplayRegion t m, HasImageWriter t m, HasInput t m, HasFocusReader t m, HasTheme t m
boxStatic
: Now requiresHasDisplayRegion t m, HasImageWriter t m, HasInput t m, HasFocusReader t m, HasTheme t m
richText
: Now requiresHasImageWriter
, andHasDisplayRegion
scrollableText
: Now requiresHasInput
,HasImageWriter
,HasTheme
, andHasDisplayRegion
blank
: Now requiresMonad
button
: Now requiresHasFocusReader
,HasInput
,HasImageWriter
,HasTheme
, andHasDisplayRegion
textButton
: Now requiresHasFocusReader
,HasInput
,HasImageWriter
,HasTheme
, andHasDisplayRegion
textButtonStatic
: Now requiresHasFocusReader
,HasInput
,HasImageWriter
,HasTheme
, andHasDisplayRegion
link
: Now requiresHasInput
,HasImageWriter
,HasTheme
, andHasDisplayRegion
checkbox
: Now requiresHasFocusReader
,HasInput
,HasImageWriter
, andHasDisplayRegion
- TextZipper interface changes
_displayLines_offsetMap
type changed toOffsetMapWithAlignment
_displayLines_cursorY
replaced with_displayLines_cursorPos
which include X position- some exposed methods intended for internal use only have been removed
textInput
: Now requiresHasFocusReader
,HasInput
,HasImageWriter
,HasTheme
, andHasDisplayRegion
multilineTextInput
: Now requiresHasFocusReader
,HasInput
,HasImageWriter
,HasTheme
, andHasDisplayRegion
textInputTile
: Now requiresHasFocusReader
,HasInput
,HasLayout
,HasTheme
, andHasFocus
- Layout and focus have been substantially refactored to fix #37 and support a wider variety of layouts and focus switching requirements.
- Misc:
- (#40 Add alignment support to TextZipper)[#40]
- Add alignment (left/center/right) support to TextZipper
- Add basic unit tests for newly created alignment methods in TextZipper
- Add default instances for
HasInput
,HasFocus
, andHasImageWriter
- Export
withinImage
and addimagesInRegion
to crop images to a region - Add
anyChildFocused
, which provides information about whether subwidgets are focused - Add
filterKeys
, which is the same aslocalInput
but only cares about keyboard events - Add
hoistRunLayout
to apply a transformation to the context of aLayout
action and run that action - Add various
MFunctor
instances - Add a CPU usage indicator to the example executable
- (#40 Add alignment support to TextZipper)[#40]
- Wider bounds for GHC 8.10 support
- Migrate to new dependent-sum / dependent-map (after the "some" package split)
- (#15) Add
PostBuild
instance forLayout
. - (#17) Add
splitH
to implement horizontal functionality ofsplitV
. - (#19) Add
boxTitle
: a box with a title. - (#19) Update the text editing example to use
boxTitle
. - (#21) Fix bug in
drag
that caused dragging with different mouse button to trigger the click event. - (#22) Add support for GHC 8.8.
- Add
mouseScroll
to capture scroll wheel events. - Add
scrollableText
: a text display widget that can be scrolled using the mouse or keyboard. - Add widget to the example executable that displays scrollable text.
- Add
keyCombo
function (single-key-combination version ofkeyCombos
). - Use upstream
NotReady
instances instead of orphans defined in this package if reflex-0.6.3 is available.
- Allow
TextZipper
contents to be transformed before being displayed. - Fix bug in
row
orientation. - Handle wrapping of lines containing full-width unicode characters in
textInput
.
- Bump minimum version of reflex.
- Set version bounds in cabal file.
- Add travis CI config.
- Initial release