Commit Graph

32 Commits

Author SHA1 Message Date
Jonathan Daugherty
c07e9c0503 Edit: move content draw function to render time, not construction
This change makes the renderEditor function take the content drawing
function that "editor" previously took. This does a better job of
separating presentation and representation concerns, and the content
drawing function never should have been part of the state to begin with.

This change removed the corresponding lens and Editor accessor for the
drawing function, removed the smart constructor parameter, and moved it
to be a parameter of the renderEditor function.
2017-06-26 11:52:46 -07:00
Jonathan Daugherty
fc8cfe3b4a Remove appLiftVtyEvent in favor of library event type BrickEvent
This change makes it possible for brick to extent the event space using
its own event notions in addition those provided by Vty and the
application itself. This means we no longer need the user to provide the
type and appLiftVtyEvent went away. This makes pattern-matching in event
handlers a little noisier with the benefit that we can now add events
like mouse clicks or drags to the event type.
2016-10-25 20:19:31 -07:00
Getty Ritter
4c528987c7 Strawman implementation of parametric Editor widget
This isn't a fully backwards-compatible change, but the only thing
that needs to be modified for programs involves adding a type parameter,
which will be either `String` or `Text`.
2016-09-07 21:18:24 -07:00
Jonathan Daugherty
29ac664adc Use conditional imports to silence redundancy warnings on GHCs with base >= 4.8.0.0 2016-05-27 11:47:16 -07:00
Jonathan Daugherty
3b604fd5af EditDemo: remove list widget 2016-05-27 11:20:34 -07:00
Jonathan Daugherty
bd95299148 Resolve master merge conflicts 2016-05-19 20:29:12 -07:00
Jonathan Daugherty
f3950cf96d API: migrate "lens" usage to "microlens" packages 2016-05-08 18:05:30 -07:00
Jonathan Daugherty
d3d453737c Make editors focus-aware 2016-03-07 08:25:02 -08:00
Jonathan Daugherty
00eebed6f6 Add Named class, make List focus-aware, add experimental withFocusRing combinator 2016-03-04 15:50:10 -08:00
Jonathan Daugherty
01487b398e edit-demo: use a focus ring 2016-03-04 14:54:43 -08:00
Jonathan Daugherty
3081e7367d Replace "Name" type with custom name type variable everywhere
This experimental change makes it possible to:
* Avoid runtime errors due to name typos
* Achieve compile-time guarantees about name matching and usage
* Force widget functions to be name-agnostic by being polymorphic
  in their name type
* Clean up focus handling by making it possible to pattern-match
  on cursor location names

The change also made many types more heavyweight and in some cases
this is unpleasant when we don't want to have to care about names.
But in those cases we can just use 'n' or '()' depending on how
concrete we need to be.  I'm not yet sure how this is going to play
out in practice.
2016-03-04 14:42:49 -08:00
Jonathan Daugherty
d0cabf95fe edit-demo: support shift-tab to switch editors 2016-02-16 09:18:43 -08:00
Jonathan Daugherty
1950bc01de Core: remove multiline string and text functions in favor of catch-all versions 2015-08-20 08:36:39 -07:00
Jonathan Daugherty
fb8dc330bc Types: implement handleEventLensed 2015-08-19 22:26:25 -07:00
Jonathan Daugherty
0f84d19cdf API: handleEvent now runs in EventM 2015-08-19 19:52:34 -07:00
Jonathan Daugherty
736a81de97 API: move EventM and Next to Brick.Types 2015-08-19 19:48:55 -07:00
Jonathan Daugherty
35aa2ad8a4 Monster patch: move most data types to Brick.Types, remove IsString
instance for Widget

- This makes the module layout more predictable since Brick.Widgets.Core
  now (mostly) only contains widgets and widget transformations
- Utility functions closely related to types are now in Brick.Types
- Brick.Types.Internal contains types used internal by the renderer,
  some are re-exported by Brick.Types
2015-08-19 19:40:06 -07:00
Jonathan Daugherty
32b2740409 Edit: use multilineStr to render editors (fixes #8) 2015-08-19 09:21:35 -07:00
Jonathan Daugherty
2d48b9bbac Minor editor demo cleanup 2015-07-20 18:39:10 -07:00
Jonathan Daugherty
60a67fd7fe Add Brick.Main.showCursorNamed for making name-based cursor-matching easier 2015-07-20 18:36:24 -07:00
Jonathan Daugherty
935f05973a Update editor demo to show both limited and unlimited editors 2015-07-20 18:31:33 -07:00
Jonathan Daugherty
c35e20196b Add support for multi-line editors
- Changes the editor constructor to take a line limit
- Changes the editor drawing function to take [String] instead of String
- Changes the editor to use a viewport that scrolls both horizontally
  and vertically
- Uses the latest text-zipper release (so cabal update)
2015-07-20 18:10:50 -07:00
Jonathan Daugherty
962e7c83df Rename appMakeVtyEvent to appLiftVtyEvent 2015-07-10 13:53:21 -07:00
Jonathan Daugherty
0be4379b6c EditDemo: use explicit imports 2015-07-10 13:12:12 -07:00
Jonathan Daugherty
b718a68986 Edit: use text-zipper to generalize editing functionality and simplify API 2015-07-09 14:32:20 -07:00
Jonathan Daugherty
201dfdc4a3 Rename Brick.Core to Brick.Types 2015-07-07 17:00:42 -07:00
Jonathan Daugherty
afc0c95be8 Flip the arguments to application event handlers to make event pattern-matching more natural 2015-07-01 13:05:28 -07:00
Jonathan Daugherty
f9ae799f9b Merge branch 'master' of github.com:jtdaugherty/brick 2015-06-30 19:18:54 -07:00
Jonathan Daugherty
9601098d46 Add appStartEvent to support getting scroll requests on the first rendering of the app state before other events have arrived 2015-06-30 19:15:29 -07:00
Jonathan Daugherty
0bb91a73bf EditDemo: syntax nit 2015-06-30 10:07:53 -07:00
Jonathan Daugherty
6c762fb95b Simplify edit demo application state 2015-06-28 13:24:36 -07:00
Jonathan Daugherty
7461901679 Add editor demo 2015-06-28 12:45:26 -07:00