packages feed

WEditorBrick 0.2.0.0 → 0.2.0.1

raw patch · 3 files changed

+23/−19 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- WEditorBrick.WrappingEditor: type WrappingEditorDoer c b = forall a. (FixedFontViewer a c, FixedFontEditor a c) => a -> b
+ WEditorBrick.WrappingEditor: type WrappingEditorDoer c b = forall e. (FixedFontViewer e c, FixedFontEditor e c) => e -> b
- WEditorBrick.WrappingEditor: genericEditor :: (FixedFontViewer a c, FixedFontEditor a c) => n -> a -> WrappingEditor c n
+ WEditorBrick.WrappingEditor: genericEditor :: (FixedFontViewer e c, FixedFontEditor e c) => n -> e -> WrappingEditor c n
- WEditorBrick.WrappingEditor: newEditor :: FixedFontParser a c => a -> n -> [[c]] -> WrappingEditor c n
+ WEditorBrick.WrappingEditor: newEditor :: FixedFontParser p c => p -> n -> [[c]] -> WrappingEditor c n

Files

WEditorBrick.cabal view
@@ -1,13 +1,16 @@ name:                WEditorBrick-version:             0.2.0.0+version:             0.2.0.1 synopsis:            Text-editor widget with dynamic line-wrapping for use with Brick.  description:   This package provides a text-editor widget for-  <https://github.com/jtdaugherty/brick Brick> that supports line wrapping with-  dynamic resizing. The editor functionality is extensible (e.g., custom-  wrapping and hyphenation) via the-  <https://github.com/ta0kira/wrapping-editor WEditor> package.+  @<http://hackage.haskell.org/package/brick brick>@  that supports line+  wrapping with dynamic resizing. The editor functionality is extensible (e.g.,+  custom wrapping and hyphenation) via the+  @<http://hackage.haskell.org/package/WEditor WEditor>@ package.+  .+  Also see @<http://hackage.haskell.org/package/WEditorHyphen WEditorHyphen>@+  for  language-specific hyphenation rules.  homepage:            https://github.com/ta0kira/wrapping-editor license:             Apache-2.0
WEditorBrick/WrappingEditor.hs view
@@ -50,22 +50,22 @@   -- | Create a new 'WrappingEditor' using the default editor component.-newEditor :: FixedFontParser a c => a -> n -> [[c]] -> WrappingEditor c n+newEditor :: FixedFontParser p c => p -> n -> [[c]] -> WrappingEditor c n newEditor b n cs = genericEditor n $ editDocument b $ map UnparsedPara cs  -- | Create a new 'WrappingEditor' using a custom editor component.-genericEditor :: (FixedFontViewer a c, FixedFontEditor a c) => n -> a -> WrappingEditor c n+genericEditor :: (FixedFontViewer e c, FixedFontEditor e c) => n -> e -> WrappingEditor c n genericEditor = WrappingEditor  -- | Any action that updates the editor state.-type WrappingEditorAction c = forall a. (FixedFontViewer a c, FixedFontEditor a c) => a -> a+type WrappingEditorAction c = forall e. (FixedFontViewer e c, FixedFontEditor e c) => e -> e  -- | Update the editor state. mapEditor :: WrappingEditorAction c -> WrappingEditor c n -> WrappingEditor c n mapEditor f (WrappingEditor name editor) = WrappingEditor name (f editor)  -- | Any action that reads the editor state.-type WrappingEditorDoer c b = forall a. (FixedFontViewer a c, FixedFontEditor a c) => a -> b+type WrappingEditorDoer c b = forall e. (FixedFontViewer e c, FixedFontEditor e c) => e -> b  -- | Read from the editor state. doEditor :: WrappingEditorDoer c b -> WrappingEditor c n -> b@@ -94,7 +94,7 @@       strFill w cs = str $ take w $ cs ++ repeat ' '       lineFill w h ls = take h $ ls ++ repeat (strFill w "") --- | Updates the viewport size based on the most-recent rendering of the editor.+-- | Update the viewport size based on the most-recent rendering of the editor. -- --   Call this before any custom event-handling logic so that the viewport is --   the correct size. This will ensure that vertical cursor movements match@@ -108,15 +108,15 @@  -- | Update the editor based on Brick events. -----   In addition to the canonical typing events, this editor also supports:+--   In addition to the canonical typing events, this handler also supports: -----     * `PageUp`, `PageDown`, `Home`, and `End` keys.---     * `Alt`+`Up` shifts the view upward one line.---     * `Alt`+`Down` shifts the view downward one line.---     * `Alt`+`Home` shifts the view to hide empty space at the bottom.+--     * @PageUp@, @PageDown@, @Home@, and @End@ keys.+--     * @Alt@+@Up@ shifts the view upward one line.+--     * @Alt@+@Down@ shifts the view downward one line.+--     * @Alt@+@Home@ shifts the view to hide empty space at the bottom. -- --   To disable or override any of these keys, intercept them in the main---   handler for the `App`.+--   handler for the 'App'. handleEditor :: Eq n => WrappingEditor Char n -> Event -> EventM n (WrappingEditor Char n) handleEditor editor event = do   extent <- lookupExtent (getName editor)@@ -143,9 +143,9 @@  -- | Editor widget for use with Brick. data WrappingEditor c n =-  forall a. (FixedFontViewer a c, FixedFontEditor a c) => WrappingEditor {+  forall e. (FixedFontViewer e c, FixedFontEditor e c) => WrappingEditor {     weName :: n,-    weEditor :: a+    weEditor :: e   }  instance Show n => Show (WrappingEditor c n) where
example/brick-example.hs view
@@ -34,7 +34,8 @@ import WEditorBrick.WrappingEditor  -- For the wrapping editor Brick widget.  --- Delegate most events to a single handler.+-- Delegate most events to a single handler. If you get annoyed by scrolling+-- past the last line, you can apply mapEditor viewerFillAction before continue. handleEventsWith _ x (VtyEvent (EvKey KEsc [])) = halt x handleEventsWith handler x (VtyEvent e) = continue =<< handler x e