/usr/share/doc/libghc-brick-doc/html/Brick-Widgets-Edit.html is in libghc-brick-doc 0.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Brick.Widgets.Edit</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Brick-Widgets-Edit.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Brick-Widgets-Edit.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">brick-0.11: A declarative terminal user interface library</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Brick.Widgets.Edit</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Constructing an editor</a></li><li><a href="#g:2">Reading editor contents</a></li><li><a href="#g:3">Handling events</a></li><li><a href="#g:4">Editing text</a></li><li><a href="#g:5">Lenses for working with editors</a></li><li><a href="#g:6">Rendering editors</a></li><li><a href="#g:7">Attributes</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This module provides a basic text editor widget. You'll need to
embed an <code><a href="Brick-Widgets-Edit.html#t:Editor">Editor</a></code> in your application state and transform it with
<code>handleEvent</code> when relevant events arrive. To get the contents
of the editor, just use <code><a href="Brick-Widgets-Edit.html#v:getEditContents">getEditContents</a></code>. To modify it, use the
<code><a href="file:///usr/share/doc/libghc-text-zipper-doc/html/Data-Text-Zipper.html#t:TextZipper">TextZipper</a></code> interface with <code><a href="Brick-Widgets-Edit.html#v:applyEdit">applyEdit</a></code>.</p><p>The editor's <code>HandleEvent</code> instance handles a set of basic input
events that should suffice for most purposes; see the source for a
complete list.</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Editor">Editor</a> t n</li><li class="src short"><a href="#v:editor">editor</a> :: <a href="file:///usr/share/doc/libghc-text-zipper-doc/html/Data-Text-Zipper-Generic.html#t:GenericTextZipper">GenericTextZipper</a> a => n -> ([a] -> <a href="Brick-Types.html#t:Widget">Widget</a> n) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> -> a -> <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> a n</li><li class="src short"><a href="#v:editorText">editorText</a> :: n -> ([<a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a>] -> <a href="Brick-Types.html#t:Widget">Widget</a> n) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> -> <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> n</li><li class="src short"><a href="#v:getEditContents">getEditContents</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Monoid.html#t:Monoid">Monoid</a> t => <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n -> [t]</li><li class="src short"><a href="#v:handleEditorEvent">handleEditorEvent</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Eq.html#t:Eq">Eq</a> t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Monoid.html#t:Monoid">Monoid</a> t) => <a href="file:///usr/share/doc/libghc-vty-doc/html/Graphics-Vty-Input-Events.html#t:Event">Event</a> -> <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n -> <a href="Brick-Types.html#t:EventM">EventM</a> n (<a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n)</li><li class="src short"><a href="#v:applyEdit">applyEdit</a> :: (<a href="file:///usr/share/doc/libghc-text-zipper-doc/html/Data-Text-Zipper.html#t:TextZipper">TextZipper</a> t -> <a href="file:///usr/share/doc/libghc-text-zipper-doc/html/Data-Text-Zipper.html#t:TextZipper">TextZipper</a> t) -> <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n -> <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n</li><li class="src short"><a href="#v:editContentsL">editContentsL</a> :: <span class="keyword">forall</span> t n. <a href="file:///usr/share/doc/libghc-microlens-doc/html/Lens-Micro-Type.html#t:Lens-39-">Lens'</a> (<a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n) (<a href="file:///usr/share/doc/libghc-text-zipper-doc/html/Data-Text-Zipper.html#t:TextZipper">TextZipper</a> t)</li><li class="src short"><a href="#v:editDrawContentsL">editDrawContentsL</a> :: <span class="keyword">forall</span> t n. <a href="file:///usr/share/doc/libghc-microlens-doc/html/Lens-Micro-Type.html#t:Lens-39-">Lens'</a> (<a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n) ([t] -> <a href="Brick-Types.html#t:Widget">Widget</a> n)</li><li class="src short"><a href="#v:renderEditor">renderEditor</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Ord.html#t:Ord">Ord</a> n, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:Show">Show</a> n, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Monoid.html#t:Monoid">Monoid</a> t) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> -> <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n -> <a href="Brick-Types.html#t:Widget">Widget</a> n</li><li class="src short"><a href="#v:editAttr">editAttr</a> :: <a href="Brick-AttrMap.html#t:AttrName">AttrName</a></li><li class="src short"><a href="#v:editFocusedAttr">editFocusedAttr</a> :: <a href="Brick-AttrMap.html#t:AttrName">AttrName</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Editor" class="def">Editor</a> t n <a href="src/Brick-Widgets-Edit.html#Editor" class="link">Source</a> <a href="#t:Editor" class="selflink">#</a></p><div class="doc"><p>Editor state. Editors support the following events by default:</p><ul><li>Ctrl-a: go to beginning of line</li><li>Ctrl-e: go to end of line</li><li>Ctrl-d, Del: delete character at cursor position</li><li>Backspace: delete character prior to cursor position</li><li>Ctrl-k: delete all from cursor to end of line</li><li>Ctrl-u: delete all from cursor to beginning of line</li><li>Arrow keys: move cursor</li><li>Enter: break the current line at the cursor position</li></ul></div><div class="subs instances"><p id="control.i:Editor" class="caption collapser" onclick="toggleSection('i:Editor')">Instances</p><div id="section.i:Editor" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Editor:Named:1" class="instance expander" onclick="toggleSection('i:id:Editor:Named:1')"></span> <a href="Brick-Widgets-Core.html#t:Named">Named</a> (<a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n) n</span> <a href="src/Brick-Widgets-Edit.html#line-70" class="link">Source</a> <a href="#t:Editor" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Editor:Named:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:getName">getName</a> :: <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n -> n <a href="src/Brick-Widgets-Core.html#getName" class="link">Source</a> <a href="#v:getName" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><h1 id="g:1">Constructing an editor</h1><div class="top"><p class="src"><a id="v:editor" class="def">editor</a> <a href="src/Brick-Widgets-Edit.html#editor" class="link">Source</a> <a href="#v:editor" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/share/doc/libghc-text-zipper-doc/html/Data-Text-Zipper-Generic.html#t:GenericTextZipper">GenericTextZipper</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">=> n</td><td class="doc"><p>The editor's name (must be unique)</p></td></tr><tr><td class="src">-> ([a] -> <a href="Brick-Types.html#t:Widget">Widget</a> n)</td><td class="doc"><p>The content rendering function</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p>The limit on the number of lines in the editor (<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code>
means no limit)</p></td></tr><tr><td class="src">-> a</td><td class="doc"><p>The initial content</p></td></tr><tr><td class="src">-> <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> a n</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Construct an editor over <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a></code> values</p></div></div><div class="top"><p class="src"><a id="v:editorText" class="def">editorText</a> <a href="src/Brick-Widgets-Edit.html#editorText" class="link">Source</a> <a href="#v:editorText" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: n</td><td class="doc"><p>The editor's name (must be unique)</p></td></tr><tr><td class="src">-> ([<a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a>] -> <a href="Brick-Types.html#t:Widget">Widget</a> n)</td><td class="doc"><p>The content rendering function</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p>The limit on the number of lines in the editor (<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code>
means no limit)</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a></td><td class="doc"><p>The initial content</p></td></tr><tr><td class="src">-> <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> n</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Construct an editor over <code>Text</code> values</p></div></div><h1 id="g:2">Reading editor contents</h1><div class="top"><p class="src"><a id="v:getEditContents" class="def">getEditContents</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Monoid.html#t:Monoid">Monoid</a> t => <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n -> [t] <a href="src/Brick-Widgets-Edit.html#getEditContents" class="link">Source</a> <a href="#v:getEditContents" class="selflink">#</a></p><div class="doc"><p>Get the contents of the editor.</p></div></div><h1 id="g:3">Handling events</h1><div class="top"><p class="src"><a id="v:handleEditorEvent" class="def">handleEditorEvent</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Eq.html#t:Eq">Eq</a> t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Monoid.html#t:Monoid">Monoid</a> t) => <a href="file:///usr/share/doc/libghc-vty-doc/html/Graphics-Vty-Input-Events.html#t:Event">Event</a> -> <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n -> <a href="Brick-Types.html#t:EventM">EventM</a> n (<a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n) <a href="src/Brick-Widgets-Edit.html#handleEditorEvent" class="link">Source</a> <a href="#v:handleEditorEvent" class="selflink">#</a></p></div><h1 id="g:4">Editing text</h1><div class="top"><p class="src"><a id="v:applyEdit" class="def">applyEdit</a> <a href="src/Brick-Widgets-Edit.html#applyEdit" class="link">Source</a> <a href="#v:applyEdit" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/share/doc/libghc-text-zipper-doc/html/Data-Text-Zipper.html#t:TextZipper">TextZipper</a> t -> <a href="file:///usr/share/doc/libghc-text-zipper-doc/html/Data-Text-Zipper.html#t:TextZipper">TextZipper</a> t)</td><td class="doc"><p>The <code><a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#v:Zipper">Zipper</a></code> editing transformation to apply</p></td></tr><tr><td class="src">-> <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n</td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Apply an editing operation to the editor's contents. Bear in mind
that you should only apply zipper operations that operate on the
current line; the editor will only ever render the first line of
text.</p></div></div><h1 id="g:5">Lenses for working with editors</h1><div class="top"><p class="src"><a id="v:editContentsL" class="def">editContentsL</a> :: <span class="keyword">forall</span> t n. <a href="file:///usr/share/doc/libghc-microlens-doc/html/Lens-Micro-Type.html#t:Lens-39-">Lens'</a> (<a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n) (<a href="file:///usr/share/doc/libghc-text-zipper-doc/html/Data-Text-Zipper.html#t:TextZipper">TextZipper</a> t) <a href="src/Brick-Widgets-Edit.html#editContentsL" class="link">Source</a> <a href="#v:editContentsL" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:editDrawContentsL" class="def">editDrawContentsL</a> :: <span class="keyword">forall</span> t n. <a href="file:///usr/share/doc/libghc-microlens-doc/html/Lens-Micro-Type.html#t:Lens-39-">Lens'</a> (<a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n) ([t] -> <a href="Brick-Types.html#t:Widget">Widget</a> n) <a href="src/Brick-Widgets-Edit.html#editDrawContentsL" class="link">Source</a> <a href="#v:editDrawContentsL" class="selflink">#</a></p></div><h1 id="g:6">Rendering editors</h1><div class="top"><p class="src"><a id="v:renderEditor" class="def">renderEditor</a> <a href="src/Brick-Widgets-Edit.html#renderEditor" class="link">Source</a> <a href="#v:renderEditor" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Ord.html#t:Ord">Ord</a> n, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:Show">Show</a> n, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Monoid.html#t:Monoid">Monoid</a> t)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a></td><td class="doc"><p>Whether the editor has focus. It will report a cursor
position if and only if it has focus.</p></td></tr><tr><td class="src">-> <a href="Brick-Widgets-Edit.html#t:Editor">Editor</a> t n</td><td class="doc"><p>The editor.</p></td></tr><tr><td class="src">-> <a href="Brick-Types.html#t:Widget">Widget</a> n</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Turn an editor state value into a widget</p></div></div><h1 id="g:7">Attributes</h1><div class="top"><p class="src"><a id="v:editAttr" class="def">editAttr</a> :: <a href="Brick-AttrMap.html#t:AttrName">AttrName</a> <a href="src/Brick-Widgets-Edit.html#editAttr" class="link">Source</a> <a href="#v:editAttr" class="selflink">#</a></p><div class="doc"><p>The attribute assigned to the editor when it does not have focus.</p></div></div><div class="top"><p class="src"><a id="v:editFocusedAttr" class="def">editFocusedAttr</a> :: <a href="Brick-AttrMap.html#t:AttrName">AttrName</a> <a href="src/Brick-Widgets-Edit.html#editFocusedAttr" class="link">Source</a> <a href="#v:editFocusedAttr" class="selflink">#</a></p><div class="doc"><p>The attribute assigned to the editor when it has focus. Extends
<code><a href="Brick-Widgets-Edit.html#v:editAttr">editAttr</a></code>.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>
|