C7      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~         !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~$SafeT(Abstract data type representing a color.RCurrently the foreground and background color are specified as points in either a:16 color palette. Where the first 8 colors are equal to the 8 colors of the ISO 6429 (ANSI) 8 color palette and the second 8 colors are bright/vivid versions of the first 8 colors.240 color palette. This palette is a regular sampling of the full RGB colorspace for the first 224 colors. The remaining 16 colors is a greyscale palette.,The 8 ISO 6429 (ANSI) colors are as follows: blackredgreenyellowbluemagentacyanwhiteBThe mapping from points in the 240 color palette to colors actually displayable by the terminal depends on the number of colors the terminal claims to support. Which is usually determined by the terminfo "colors" property. If this property is not being accurately reported then the color reproduction will be incorrect.If the terminal reports <= 16 colors then the 240 color palette points are only mapped to the 8 color pallete. I'm not sure of the RGB points for the "bright" colors which is why they are not addressable via the 240 color palette. If the terminal reports > 16 colors then the 240 color palette points are mapped to the nearest points in a ("color count" - 16) subsampling of the 240 color palette.All of this assumes the terminals are behaving similarly to xterm and rxvt when handling colors. And that the individual colors have not been remapped by the user. There may be a way to verify this through terminfo but I don't know it.,Seriously, terminal color support is INSANE.SafeTRGB color to 240 color palette.ggenerated from 256colres.pl which is forked from xterm 256colres.pl todo: all values get clamped high.None#TD     @'     NoneTcapability evaluator state SafeT~Converts an array of ISO-10646 characters (Char type) to an array of Word8 bytes that is the corresponding UTF8 byte sequenceNoneT`Returns the display width of a character. Assumes all characters with unknown widths are 0 width]Returns the display width of a string. Assumes all characters with unknown widths are 0 widthSafeTNamed alias for a Int pair I !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcd   Safe5T Events. 8A keyboard key was pressed with the specified modifiers.tA mouse button was pressed at the specified column and row. Any modifiers available in the event are also provided.A mouse button was released at the specified column and row. Some terminals report only that a button was released without specifying which one; in that case, Nothing is provided. Otherwise Just the button released is included in the event. If read from  eventChannel; this is the size at the time of the signal. If read from  nextEvent this is the size at the time the event was processed by Vty. Typically these are the same, but if somebody is resizing the terminal quickly they can be different.A paste event occurs when a bracketed paste input sequence is received. For terminals that support bracketed paste mode, these events will be triggered on a paste event. Terminals that do not support bracketed pastes will send the paste contents as ordinary input (which is probably bad, so beware!) Note that the data is provided in raw form and you'll have to decode (e.g. as UTF-8) if that's what your application expects.Mouse buttons.Modifier keys. Key codes are interpreted such that users are more likely to have Meta than Alt; for instance on the PC Linux console, 4 will generally correspond to the physical Alt key.%Representations of non-modifier keys.WKFun is indexed from 0 to 63. Range of supported FKeys varies by terminal and keyboard.ZKUpLeft, KUpRight, KDownLeft, KDownRight, KCenter support varies by terminal and keyboard.dActually, support for most of these but KEsc, KChar, KBS, and KEnter vary by terminal and keyboard.*  !"#$%&'()*+,-./01234*  !"#$%&'()*+,-./01234* !"#$%&'()*+,-./01234     !"#$%&'()*+,-./01234SafeTJYA valid event was parsed. Any unused characters from the input stream are also provided.K5The input characters did not represent a valid event.LJThe input characters form the prefix of a valid event character sequence.IJKLILJKIJKLIJKLSafeTPCRun a parser on a given input string. If the parser fails, return K$. Otherwise return the valid event (J)) and the remaining unparsed characters.QFail a parsing operation.RRead an integer from the input stream. If an integer cannot be read, fail parsing. E.g. calling readInt on an input of "123abc" will return '123' and consume those characters.SmRead a character from the input stream. If one cannot be read (e.g. we are out of characters), fail parsing.T^Read a character from the input stream and fail parsing if it is not the specified character.OPQRSTOPQRSTOPQRSTOPQRSTSafeTUIThese sequences set xterm-based terminals to send mouse event sequences.V%These sequences disable mouse events.W3Does the specified string begin with a mouse event?X4Attempt to lassify an input string as a mouse event.UVWefghijklmnopXqrstUVWXUVWXUVWefghijklmnopXqrstSafeTY'Does the input start a bracketed paste?Z2Does the input contain a complete bracketed paste?[IParse a bracketed paste. This should only be called on a string if both Y and Z return u.vwYZ[xYZ[[YZvwYZ[xSafeTyz{|ILJKzyz{| SafeT}Encoding for navigation keys.ITODO: This is not the same as the input bytes pulled from teh caps table.~-encoding for shift, meta and ctrl plus arrowshomeend2encoding for ins, del, pageup, pagedown, home, end9encoding for ctrl + ins, del, pageup, pagedown, home, end%encoding for shift plus function keys According to  Bhttp://aperiodic.net/phil/archives/Geekery/term-function-keys.html&This encoding depends on the terminal.encoding for meta plus charTODO: resolve - removed ESCA from second list due to duplication with "special_support_keys".removed '[' from second list due to conflict with 7-bit encoding for ESC. Whether meta+[ is the same as ESC should examine km and current encoding.stopped enumeration at '~' instead of '\DEL'7. The latter is mapped to KBS by special_support_keys.}~}~}~ SafeT \xqueries the terminal for all capability based input sequences then adds on a terminal dependent input sequence mapping.For reference see: /http://vimdoc.sourceforge.net/htmldoc/term.htmlvim74srcterm.c #http://invisible-island.net/vttest/ Bhttp://aperiodic.net/phil/archives/Geekery/term-function-keys.htmlThis is painful. Terminfo is incomplete. The vim source implies that terminfo is also incorrect. Vty assumes that the an internal terminfo table added to the system provided terminfo table is correct. >build terminfo table for all caps. Missing caps are not added.9add tables for visible chars, esc, del plus ctrl and meta5add internally defined table for given terminal type.(Precedence is currently implicit in the compile algorithm. Which is a bit odd.2todo terminfo meta is not supported. todo no 8bit]&key table applicable to all terminals.<TODO: some probably only applicable to ANSI/VT100 terminals._Itables specific to a given terminal that are not derivable from terminfo.TODO: Adds the ANSIVT100*VT50 tables regardless of term identifier.`:Visible characters in the ISO-8859-1 and UTF-8 common set.{we limit to < 0xC1. The UTF8 sequence detector will catch all values 0xC2 and above before this classify table is reached.?TODO: resolve 1. start at ' '. The earlier characters are all ctrlCharaXNon visible characters in the ISO-8859-1 and UTF-8 common set translated to ctrl + char.&todo resolve CTRL-i is the same as tabbCtrl+Meta+Charc5esc, meta esc, delete, meta delete, enter, meta enterd;classify table directly generated from terminfo cap strings these are:ka1 - keypad up-leftka3 - keypad up-rightkb2 - keypad centerkbs - keypad backspace kbeg - beginkcbt - back tabkc1 - keypad left-downkc3 - keypad right-downkdch1 - delete kcud1 - down kend - end kent - enterkf0 - kf63 - function keys khome - KHomekich1 - insert kcub1 - leftknp - next page (page down)kpp - previous page (page up) kcuf1 - rightkDC - shift deletekEND - shift endkHOM - shift homekIC - shift insertkLFT - shift leftkRIT - shift right kcuu1 - upecap names for function keys \]^_`abcde \]^_`abcde \]^_`abcde \]^_`abcde SafeTf'The type of exceptions specific to vty.YThese have fully qualified names by default since, IMO, exception handling requires this.g&Uncategorized failure specific to vty.fgfgfgfg None 09:;QRTjThe default is 1 character.k-The default is 100 milliseconds, 0.1 seconds.lThe default is False.mThe default is False.n:Debug information is appended to this file if not Nothing.oiThe (input byte, output event) pairs extend the internal input table of VTY and the table from terminfo.See Graphics.Vty.Config/ module documentation for documentation of the map directive.p1The input file descriptor to use. The default is q2The output file descriptor to use. The default is rtThe terminal name used to look up terminfo capabilities. The default is the value of the TERM environment variable.sMappings from input bytes to event in the order specified. Later entries take precedence over earlier in the case multiple entries have the same byte string.t6Type of errors that can be thrown when configuring VTYu!TERM environment variable not setv Config from /config and $VTY_CONFIG_FILExMConfigures VTY using defaults suitable for terminals. This action can raise t.1hijklmnopqrstuvwxyz{|}~hirjklmnopqstuvwxyzshijklmnopqrtuvwxzy#h ijklmnopqrstuvwxyz{|}~!None!"T7Channel of events direct from input processing. Unlike  nextEvent< this will not refresh the display if the next event is an .nShuts down the input processing. This should return the terminal input state to before the input initialized.9Changes to this value are reflected after the next event.input debug log** None!"T)Set up the terminal with file descriptor p for input. Returns a . The table used to determine the Events, to produce for the input bytes comes from \?. Which is then overridden by the the applicable entries from o.6The terminal device is configured with the attributes: IXON disabledIdisables software flow control on outgoing data. This stops the process from being suspended if the output terminal cannot keep up. I presume this has little effect these days. I hope this means that output will be buffered if the terminal cannot keep up. In the old days the output might of been dropped?"raw" mode is used for input. ISIG disabledfenables keyboard combinations that result in signals. TODO: should probably be a dynamic option. ECHO disabledCinput is not echod to the output. TODO: should be a dynamic option.ICANON disabledOcanonical mode (line mode) input is not used. TODO: should be a dynamic option.IEXTEN disabledCextended functions are disabled. TODO: I don't know what those are.0  !"#$%&'()*+,-./012340 !"#$%&'()*+,-./01234 None%&/OTStyles are represented as an 8 bit word. Each bit in the word is 1 if the style attribute assigned to that bit should be applied and 0 if the style attribute should not be applied.The style and color attributes can either be the terminal defaults. Or be equivalent to the previously applied style. Or be a specific value.Specifies the display attributes such that the final style and color values do not depend on the previously applied display attribute. The display attributes can still depend on the terminal's default colors (unfortunately).oA display attribute defines the Color and Style of all the characters rendered after the attribute is applied.At most 256 colors, picked from a 240 and 16 color palette, are possible for the background and foreground. The 240 colors and 16 colors are points in different palettes. See Color for more information.+Standard 8-color ANSI terminal color codes.+Standard 8-color ANSI terminal color codes.+Standard 8-color ANSI terminal color codes.+Standard 8-color ANSI terminal color codes.+Standard 8-color ANSI terminal color codes.+Standard 8-color ANSI terminal color codes.+Standard 8-color ANSI terminal color codes.+Standard 8-color ANSI terminal color codes.3Bright/Vivid variants of the standard 8-color ANSI 3Bright/Vivid variants of the standard 8-color ANSI 3Bright/Vivid variants of the standard 8-color ANSI 3Bright/Vivid variants of the standard 8-color ANSI  The 6 possible style attributes:standout underline reverseVideoblinkdim bold/brightp( The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.) The 6 possible style attributes:standout underline reverseVideoblinkdim bold/brightp( The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.) The 6 possible style attributes:standout underline reverseVideoblinkdim bold/brightp( The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.) The 6 possible style attributes:standout underline reverseVideoblinkdim bold/brightp( The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.) The 6 possible style attributes:standout underline reverseVideoblinkdim bold/brightp( The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.) The 6 possible style attributes:standout underline reverseVideoblinkdim bold/brightp( The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.):true if the given Style value has the specified Style set.Set the foreground color of an .Set the background color of an .Add the given style attributeSets the style, background color and foreground color to the default values for the terminal. There is no easy way to determine what the default background and foreground colors are.Keeps the style, background color and foreground color that was previously set. Used to override some part of the previous style.EG: current_style  brightMagentavWould be the currently applied style (be it underline, bold, etc) but with the foreground color set to brightMagenta.014% NoneTgStyle attribute changes are transformed into a sequence of apply/removes of the individual attributes.7Difference between two display color attribute changes.difference between two display attributes. Used in the calculation of the operations required to go from one display attribute to the next.Previously, vty would reset display attributes to default then apply the new display attributes. This turned out to be very expensive: A *lot* more data would be sent to the terminal than required.Given the previously applied display attributes as a FixedAttr and the current display attributes as an Attr produces a FixedAttr that represents the current display attributes. This is done by using the previously applied display attributes to remove the  KeepCurrent abstraction.:Used in the computation of a final style attribute change.9TODO(corey): not really a simplify but a monoid instance.hConsider two display color attributes diffs. What display color attribute diff are these equivalent to?9TODO(corey): not really a simplify but a monoid instance.Determines the diff between two display&color attributes. This diff determines the operations that actually get output to the terminal. "None#5TGThis is the internal representation of Images. Use the constructors in Graphics.Vty.Image to create instances. Images are:a horizontal span of text+a horizontal or vertical join of two imagesa two dimensional fill of the Pictures background charactera cropped image%an empty image of no size or content.-A horizontal text span has a row height of 1.A horizontal join can be constructed between any two images. However a HorizJoin instance is required to be between two images of equal height. The horizJoin constructor adds background fills to the provided images that assure this is true for the HorizJoin value produced.A veritical join can be constructed between any two images. However a VertJoin instance is required to be between two images of equal width. The vertJoin constructor adds background fills to the provides images that assure this is true for the VertJoin value produced.A background fill will be filled with the background char. The background char is defined as a property of the Picture this Image is used to form.ICrop an image horizontally to a size by reducing the size from the right.HCrop an image horizontally to a size by reducing the size from the left.GCrop an image vertically to a size by reducing the size from the bottomDCrop an image vertically to a size by reducing the size from the topThe empty image8The combining operators identity constant. EmptyImage  | a = a EmptyImage  - a = a.Any image of zero size equals the empty image.IThe text to display. The display width of the text is always outputWidth.+The number of display columns for the text.%the number of characters in the text.9imageHeight partLeft == imageHeight partRight. Always > 0Always  imageWidth croppedImage 0Always  imageHeight croppedImage 0"A display text is a Data.Text.LazyTODO(corey): hm. there is an explicit equation for each type which goes to a lazy text. Each application probably uses a single type. Perhaps parameterize the entire vty interface by the input text type? TODO: Try using a builder instead of a TL.Text instance directly. That might improve performance for the usual case of appending a bunch of characters with the same attribute together.,pretty print just the structure of an image.PThe width of an Image. This is the number display columns the image will occupy.QThe height of an Image. This is the number of display rows the image will occupy. combines two images side by sidegCombines text chunks where possible. Assures outputWidth and outputHeight properties are not violated.The result image will have a width equal to the sum of the two images width. And the height will equal the largest height of the two images. The area not defined in one image due to a height missmatch will be filled with the background pattern.>TODO: the bg fill is biased towards top to bottom languages(?)combines two images verticallyThe result image will have a height equal to the sum of the heights of both images. The width will equal the largest width of the two images. The area not defined in one image due to a width missmatch will be filled with the background pattern.>TODO: the bg fill is biased towards right to left languages(?)/Append in the Monoid instance is equivalent to  -.  %None!#TLAn area of the picture's bacground (See Background) of w columns and h rows.5Combines two images horizontally. Alias for horizJoininfixr 52Combines two images vertically. Alias for vertJoininfixr 4*Compose any number of images horizontally.(Compose any number of images vertically.A Data.Text.Lazy valueA Data.Text valueuan image of a single character. This is a standard Haskell 31-bit character assumed to be in the ISO-10646 encoding.A string of characters layed out on a single row with the same display attribute. The string is assumed to be a sequence of ISO-10646 characters. Note: depending on how the Haskell compiler represents string literals a string literal in a UTF-8 encoded source file, for example, may be represented as a ISO-10646 string. That is, I think, the case with GHC 6.10. This means, for the most part, you don't need to worry about the encoding format when outputting string literals. Just provide the string literal directly to iso10646String or string.Alias for iso10646String. Since the usual case is that a literal string like "foo" is represented internally as a list of ISO 10646 31 bit characters. Note: Keep in mind that GHC will compile source encoded as UTF-8 but the literal strings, while UTF-8 encoded in the source, will be transcoded to a ISO 10646 31 bit characters runtime representation.oA string of characters layed out on a single row. The input is assumed to be the bytes for UTF-8 encoded text.)Renders a UTF-8 encoded lazy bytestring. +Renders a UTF-8 encoded strict bytestring. tcreates a fill of the specified character. The dimensions are in number of characters wide and number of rows high.gThe empty image. Useful for fold combinators. These occupy no space nor define any display attributes.pad the given image. This adds background character fills to the left, top, right, bottom. The pad values are how many display columns or rows to add.translates an image by padding or cropping the left and top. First param is amount to translate left. Second param is amount to translate top.|This can have an unexpected effect: Translating an image to less than (0,0) then to greater than (0,0) will crop the image.3translates an image by padding or cropping the left2translates an image by padding or cropping the top kEnsure an image is no larger than the provided size. If the image is larger then crop the right or bottom.cThis is transformed to a vertical crop from the bottom followed by horizontal crop from the right. crop the display height. If the image is less than or equal in height then this operation has no effect. Otherwise the image is cropped from the bottom. censure the image is no wider than the given width. If the image is wider then crop the right side. bensure the image is no wider than the given width. If the image is wider then crop the left side. crop the display height. If the image is less than or equal in height then this operation has no effect. Otherwise the image is cropped from the top.Generic resize. Pads and crops as required to assure the given display width and height. This is biased to pad/crop the right and bottom.vResize the width. Pads and crops as required to assure the given display width. This is biased to pad/crop the right.yResize the height. Pads and crops as required to assure the given display height. This is biased to pad/crop the bottom.     V     %          54NoneT A  has a background pattern. The background is either ClearBackground. Which shows the layer below or is blank if the bottom layer. Or the background pattern is a character and a display attribute. If the display attribute used previously should be used for a background fill then use  for the background attribute.utodo The current attribute is always set to the default attributes at the start of updating the screen to a picture.A ClearBackground is:7the space character if there are remaining non-skip ops3End of line if there are no remaining non-skip ops.sA picture can be configured either to not show the cursor or show the cursor at the specified character position. There is not a 1 to 1 map from character positions to a row and column on the screen due to characters that take more than 1 column.todo: The Cursor can be given a (character,row) offset outside of the visible bounds of the output region. In this case the cursor will not be shown.Hide the cursorMShow the cursor at the given logical column accounting for char width and row=Show the cursor at the given absolute terminal column and row)The type of images to be displayed using update. %Can be constructed directly or using "_. Which provides an initial instance with reasonable defaults for picCursor and picBackground.4a picture with no cursor, background or image layers  The given " is added as the top layer of the ! The given % is added as the bottom layer of the "Create a picture for display for the given image. The picture will not have a displayed cursor and no background pattern (ClearBackground) will be used.#JCreate a picture for display with the given layers. Ordered top to bottom.fThe picture will not have a displayed cursor and no background apttern (ClearBackgroun) will be used. The first  is the top layer.$ICompatibility with applications that do not use more than a single layer. !"#$%&'(j      !"#$(' !"#&%$  !"#$%&'(#NoneT )*+,-./0123 )*+,-./0123 )*+,-./0123None#%&T 4Ovector of span operation vectors for display. One per row of the output region.5'vector of span operations. executed in succession. This represents the operations required to render a row of the terminal. The operations in one row may effect subsequent rows. EG: Setting the foreground color in one row will effect all subsequent rows until the foreground color is changed.6iThis represents an operation on the terminal. Either an attribute change or the output of a text string.7a span of UTF-8 text occupies a specific number of screen space columns. A single UTF character does not necessarially represent 1 colunm. See Codec.Binary.UTF8.Width TextSpan [Attr] [output width in columns] [number of characters] [data]8Skips the given number of columns A skip is transparent.... maybe? I am not sure how attribute changes interact. todo: separate from this type.9Marks the end of a row. specifies how many columns are remaining. These columns will not be explicitly overwritten with the span ops. The terminal is require to assure the remaining columns are clear. todo: separate from this type.@0Number of columns the DisplayOps are defined forKAll spans are verified to define same number of columns. See: VerifySpanOpsA-Number of rows the DisplayOps are defined forC(The number of columns a SpanOps effects.D'The width of a single SpanOp in columnsESreturns the number of columns to the character at the given position in the span op456789:;<=>?@ABCDEF456879:;<=>?@ABCDE6789:;<=5>?4F@ABCDE 456789:;<=>?@ABCDEFNoneT HIJKLMNOPQ)*+,-./0123HIJKLMNOPQMNOLJKPHIQ.,-/01*+)23HIJKLMNOPQNone #AOTkqProduces the span ops that will render the given picture, possibly cropped or padded, into the specified region.lOReturns the DisplayOps for an image rendered to a window the size of the image.!largerly used only for debugging.m8Produces the span ops for each layer then combines them.cTODO: a fold over a builder function. start with span ops that are a bg fill of the entire region.sUBuilds a vector of row operations that will output the given picture to the terminal."Crops to the given display region.Rtodo I'm pretty sure there is an algorithm that does not require a mutable buffer.tXAdd the operations required to build a given image to the current set of row operations.vEThis adds an image that might be partially clipped to the output ops.This is a very touchy algorithm. Too touchy. For instance, the CropRight and CropBottom implementations are odd. They pass the current tests but something seems terribly wrong about all this.:todo prove this cannot be called in an out of bounds case.z8snocs the operation to the operations for the given row.)TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|)TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|)]\TUVWXYZ[gfedcb^_`ajihklmnopqrstuvwxyz{|TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|None %&:AOT}The cursor position is given in X,Y character offsets. Due to multi-column characters this needs to be translated to column, row positions.+Provide the bounds of the display context. >Reset the display attributes to the default display attributesSee $;Text identifier for the output device. Used for debugging. MClear the display and initialize the terminal to some initial display state. The expectation of a program is that the display starts in some initial state. The initial state would consist of fixed values:cursor at top leftUTF-8 character encoding'drawing characteristics are the defaultzThe abstract operation I think all these behaviors are instances of is reserving exclusive access to a display such that:'The previous state cannot be determinedYWhen exclusive access to a display is released the display returns to the previous state.'Return the display to the state before G If no previous state then set the display state to the initial state.#Returns the current display bounds..Output the byte string to the terminal device.2Maximum number of colors supported by the context.#if the cursor can be shown / hidden;Indicates support for terminal modes for this output deviceDEnables or disables a mode (does nothing if the mode is unsupported)!Returns whether a mode is enabledAcquire display access to the given region of the display. Currently all regions have the upper left corner of (0,0) and the lower right corner at (max displayWidth providedWidth, max displayHeight providedHeight)$Ring the terminal bell if supported.7Returns whether the terminal has an audio bell feature.9Modal terminal features that can be enabled and disabled.YAll terminals serialize UTF8 text to the terminal device exactly as serialized in memory.Displays the given . *The image is cropped to the display size. >Converted into a sequence of attribute changes and text spans.The cursor is hidden.Serialized to the display.7The cursor is then shown and positioned or kept hidden.Ttodo: specify possible IO exceptions. abstract from IO monad to a MonadIO instance.{Not all terminals support all display attributes. This filters a display attribute to what the given terminal can display.0}~0}~0}~}~ None9;DRT:The mock display terminal produces a string representation of the requested picture. There is *not* an isomorphism between the string representation and the picture. The string representation is a simplification of the picture that is only useful in debugging VTY without considering terminal specific issues.$The mock implementation is useful in manually determining if the sequence of terminal operations matches the expected sequence. So requirement of the produced representation is simplicity in parsing the text representation and determining how the picture was mapped to terminal operations.yThe string representation is a sequence of identifiers where each identifier is the name of an operation in the algebra.None!"9;TThe sequence of terminfo caps to apply a given style are determined according to these rules. - - 1. The assumption is that it's preferable to use the simpler enter/exit mode capabilities than - the full set display attribute state capability. - - 2. If a mode is supposed to be removed but there is not an exit capability defined then the - display attributes are reset to defaults then the display attribute state is set. - - 3. If a mode is supposed to be applied but there is not an enter capability defined then then - display attribute state is set if possible. Otherwise the mode is not applied. - - 4. If the display attribute state is being set then just update the arguments to that for any - apply/remove. -9Uses terminfo for all control codes. While this should provide the most compatible terminal - terminfo does not support some features that would increase efficiency and improve compatibility: - - * determine the character encoding supported by the terminal. Should this be taken from the LANG - environment variable? - - * Provide independent string capabilities for all display attributes. - - todo: Some display attributes like underline and bold have independent string capabilities that - should be used instead of the generic "sgr" string capability.CPortably setting the display attributes is a giant pain in the ass.If the terminal supports the sgr capability (which sets the on/off state of each style directly ; and, for no good reason, resets the colors to the default) this procedure is used:  >set the style attributes. This resets the fore and back color.C1, If a foreground color is to be set then set the foreground color "likewise with the background colorIf the terminal does not support the sgr cap then: if there is a change from an applied color to the default (in either the fore or back color) then: #reset all display attributes (sgr0)enter required style modesset the fore color if requiredset the back color if requiredEntering the required style modes could require a reset of the display attributes. If this is the case then the back and fore colors always need to be set if not default.)This equation implements the above logic.ytodo This assumes the removal of color changes in the display attributes is done as expected with noColors == True. See todo This assumes that fewer state changes, followed by fewer bytes, is what to optimize. I haven't measured this or even examined terminal implementations. *shrug*~The color table used by a terminal is a 16 color set followed by a 240 color set that might not be supported by the terminal.yThis takes a Color which clearly identifies which pallete to use and computes the index into the full 256 color pallete.!For terminals without setaf/setab8See table in `man terminfo` Will error if not in table.6 NoneT!Initialize the display to UTF-8. Enable bracketed paste mode: #http://cirw.in/blog/bracketed-paste Disable bracketed paste mode: :These sequences set xterm based terminals to UTF-8 output.?todo I don't know of a terminfo cap that is equivalent to this. :These sequences set xterm based terminals to UTF-8 output.?todo I don't know of a terminfo cap that is equivalent to this. I think xterm is broken: Reseting the background color as the first bytes serialized on a new line does not effect the background color xterm uses to clear the line. Which is used *after* the next newline.          None!"#T Returns a  for the terminal specified in hThe specific Output implementation used is hidden from the API user. All terminal implementations are assumed to perform more, or less, the same. Currently, all implementations use terminfo for at least some terminal specific information.Specifics about it being based on terminfo are hidden from the API user. If a terminal implementation is developed for a terminal without terminfo support then Vty should work as expected on that terminal.+Selection of a terminal is done as follows:5If TERM contains "xterm" or "screen", use XTermColor.'otherwise use the TerminfoBased driver.todo add an implementation for windows that does not depend on terminfo. Should be installable with only what is provided in the haskell platform. Use ansi-terminal<Sets the cursor position to the given output column and row.This is not necessarially the same as the character position with the same coordinates. Characters can be a variable number of columns in width.Currently, the only way to set the cursor position to a given character coordinate is to specify the coordinate in the Picture instance provided to outputPicture or refresh.Hides the cursorShows the cursor&&NoneT0The main object. At most one should be created..The use of Vty typically follows this process: initialize vty3use the update equation of Vty to display a picturerepeat shutdown vty.6An alternative to tracking the Vty instance is to use withVty in Graphics.Vty.Inline.Unsafe.This does not assure any thread safety. In theory, as long as an update action is not executed when another update action is already then it's safe to call this on multiple threads.todo Remove explicit  requirement.)Outputs the given Picture. Equivalent to i applied to a display context implicitly managed by Vty. The managed display context is reset on resize._Get one Event object, blocking if necessary. This will refresh the terminal if the event is a .The input interface. See The output interface. See Refresh the display.  will refresh the display if a resize occurs. If other programs output to the terminal and mess up the display then the application might want to force a refresh.bClean up after vty. The above methods will throw an exception if executed after this is executed.zSet up the state object for using vty. At most one state object should be created at a time for a given terminal device.%The specified config is added to the v . With the v taking precedence. See Graphics.Vty.ConfigFor most applications  mkVty def is sufficient.   !"#$%&'()*+,-./01234hirjklmnopqstuvwxyz      !"#$ %NoneT&This will create a Vty instance using i and execute an IO action provided that instance. The created Vty instance will be stored to the unsafe  .BThis instance will use duplicates of the stdin and stdout Handles.NoneT)Set the background color to the provided )Set the foreground color to the provided Attempt to change the  of the following text.hIf the terminal does not support the style change no error is produced. The style can still be removed. Attempt to remove the specified ( from the display of the following text.QThis will fail if applyStyle for the given style has not been previously called. Reset the display attributesQApply the provided display attribute changes to the given terminal output device.!This does not flush the terminal.Apply the provided display attributes changes to the terminal output device that was current at the time this was first used. Which, for most use cases, is the current terminal.$This will flush the terminal output.  &'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~        !!!!!!                                   """""" !"#$%&'()*+,-./0122345676899:;<=>?@ABCDEF#G#H#H#I#I#J#K#L#M#N#OPQRSTUVWXYZ[\]^_`abcddefghijklmnoopqrstuvwxxyz{|}~$%      ! "#$%&'()*+,-./01/23/24/25/26/27/28/29/2:/2;/2</2=/2>/2?/2@/AB/AC/0D/0E/0F/0G/0H/0I/0J/0K/0L/0M/0N/0O/0P/0Q/AR/ST/SU/SV/SW/SX/SY/SZ/S[/S[/S\/]^/]^/]_/`a/`b/`c/`d/ef/eg/2h/2i/2j/2k/2l/2m/2n/2o/2p/2q/2r/2s/2t/2u/2v/2w/2x/2y/2z{|}~              u       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!""""""""""""""""""""""""""      !"#$/%&%'%(%)%*+vty-5.14-N3vtx7wTZZ8zDVf1Rfz4nGraphics.Vty.AttributesGraphics.Text.WidthGraphics.Vty.PreludeGraphics.Vty.Input.Events!Graphics.Vty.Input.Classify.Types!Graphics.Vty.Input.Classify.ParseGraphics.Vty.Input.MouseGraphics.Vty.Input.PasteGraphics.Vty.Input.TerminfoGraphics.Vty.ErrorGraphics.Vty.ConfigGraphics.Vty.InputGraphics.Vty.DisplayAttributesGraphics.Vty.ImageGraphics.Vty.PictureGraphics.Vty.DebugGraphics.Vty.SpanGraphics.Vty.PictureToSpansGraphics.Vty.Output.InterfaceGraphics.Vty.Output.Mock!Graphics.Vty.Output.TerminfoBasedGraphics.Vty.Output.XTermColorGraphics.Vty.Output Graphics.VtyGraphics.Vty.InlineGraphics.Vty.Attributes.Color Graphics.Vty.Attributes.Color240Data.Terminfo.ParseData.Terminfo.EvalCodec.Binary.UTF8.DebugGraphics.Vty.Input.Classify"Graphics.Vty.Input.Terminfo.ANSIVTGraphics.Vty.Input.LoopGraphics.Vty.Image.InternalGraphics.Vty.Debug.Image inlineHackGraphics.Vty.Inline.UnsafeColorISOColorColor240rgbColorwcwidthwcswidth safeWcwidth safeWcswidth DisplayRegion regionWidth regionHeight ClassifyMapEventEvKey EvMouseDown EvMouseUpEvResizeEvPasteButtonBLeftBMiddleBRightModifierMShiftMCtrlMMetaMAltKeyKEscKCharKBSKEnterKLeftKRightKUpKDownKUpLeftKUpRight KDownLeft KDownRightKCenterKFunKBackTabKPrtScrKPauseKInsKHomeKPageUpKDelKEnd KPageDownKBeginKMenu$fEqKey $fShowKey $fReadKey$fOrdKey $fGenericKey $fEqModifier$fShowModifier$fReadModifier $fOrdModifier$fGenericModifier $fEqButton $fShowButton $fReadButton $fOrdButton$fGenericButton $fEqEvent $fShowEvent $fReadEvent $fOrdEvent$fGenericEventKClassValidInvalidPrefix $fShowKClass $fEqKClassParser runParser failParsereadIntreadChar expectCharrequestMouseEventsdisableMouseEvents isMouseEventclassifyMouseEventbracketedPasteStartedbracketedPasteFinishedparseBracketedPasteclassifyMapForTermuniversalTablecapsClassifyMaptermSpecificTables visibleChars ctrlChars ctrlMetaCharsspecialSupportKeyskeysFromCapsTablefunctionKeyCapsTable VtyException VtyFailureConfigvminvtime mouseModebracketedPasteModedebugLoginputMapinputFdoutputFdtermNameInputMapVtyConfigurationErrorVtyMissingTermEnvVar userConfigoverrideEnvConfigstandardIOConfigparseConfigFilerunParseConfig$fGParseAltsV1$fGParseAlts:+:$fGParseAltsM1 $fGParseM1 $fGParse:*: $fGParseK1 $fGParseU1 $fGParseM10 $fParse[]$fParseModifier $fParseKey $fParseInt $fParseChar$fMonoidConfig$fDefaultConfig $fExceptionVtyConfigurationError$fShowVtyConfigurationError$fEqVtyConfigurationError $fShowConfig $fEqConfigInput _eventChannel shutdownInput _configRef _inputDebuginputForConfigStyle MaybeDefaultDefault KeepCurrentSetTo FixedAttr fixedStylefixedForeColorfixedBackColorAttr attrStyle attrForeColor attrBackColorblackredgreenyellowbluemagentacyanwhite brightBlack brightRed brightGreen brightYellow brightBlue brightMagenta brightCyan brightWhitestandout underline reverseVideoblinkdimbolddefaultStyleMask styleMaskhasStyle withForeColor withBackColor withStyledefAttr currentAttr $fDefaultAttr$fMonoidMaybeDefault $fMonoidAttr $fEqFixedAttr$fShowFixedAttr$fEqAttr $fShowAttr $fReadAttr$fReadMaybeDefault$fShowMaybeDefault$fEqMaybeDefaultStyleStateChange ApplyStandoutRemoveStandoutApplyUnderlineRemoveUnderlineApplyReverseVideoRemoveReverseVideo ApplyBlink RemoveBlinkApplyDim RemoveDim ApplyBold RemoveBoldDisplayColorDiffColorToDefault NoColorChangeSetColorDisplayAttrDiff styleDiffs foreColorDiff backColorDifffixDisplayAttrsimplifyStyleDiffssimplifyColorDiffsdisplayAttrDiffs diffColor diffStyles$fMonoidDisplayAttrDiff$fShowDisplayColorDiff$fEqDisplayColorDiff$fShowStyleStateChange$fEqStyleStateChange$fShowDisplayAttrDiffImage DisplayText imageWidth imageHeight horizJoinvertJoinbackgroundFill<|><->horizCatvertCattexttext'chariso10646Stringstring utf8Stringutf8Bytestringutf8Bytestring'charFill emptyImagepad translate translateX translateYcrop cropBottom cropRightcropLeftcropTopresize resizeWidth resizeHeight BackgroundClearBackgroundbackgroundCharbackgroundAttrCursorNoCursorAbsoluteCursorPicture picCursor picLayers picBackground emptyPictureaddToTop addToBottom picForImage picForLayerspicImage$fNFDataBackground$fNFDataCursor$fNFDataPicture $fShowPicture ImageEndoImageOpImageConstructEventImageConstructLogforwardImageOpsforwardTransformreverseTransform debugImageOps idImageOp DisplayOpsSpanOpsSpanOpTextSpanSkipRowEnd textSpanAttrtextSpanOutputWidthtextSpanCharWidth textSpanTextdropOps splitOpsAtdisplayOpsColumnsdisplayOpsRowseffectedRegionspanOpsEffectedColumnsspanOpHasWidthcolumnsToCharOffset $fShowSpanOp $fEqSpanOp MockWindowSpanConstructEvent SpanSetAttrSpanConstructLogrowOpsEffectedColumnsallSpansHaveWidthspanOpsEffectedRows isSetAttrregionForWindow$fShowMockWindow$fEqMockWindow BlitState _columnOffset _rowOffset _skipColumns _skipRows_remainingColumns_remainingRowsMSpanOpsMRowOpsBlitEnv_region_mrowOps columnOffsetremainingColumns remainingRows rowOffset skipColumnsskipRowsBlitMmrowOpsregiondisplayOpsForPicdisplayOpsForImagecombinedOpsForLayerssubstituteSkips mergeUnder mergeRowUnder swapSkipsForSingleColumnCharSpanswapSkipsForCharSpan buildSpansstartImageBuild isOutOfBoundsaddMaybeClippedaddMaybeClippedJoinaddUnclippedTextaddRowCompletionsnocOp-~+~CursorOutputMapcharToOutputPosDisplayContext contextDevice contextRegionwriteMoveCursorwriteShowCursorwriteHideCursor writeSetAttrwriteDefaultAttr writeRowEnd AssumedState prevFattr prevOutputOpsOutput terminalIDreleaseTerminalreserveDisplayreleaseDisplay displayBoundsoutputByteBuffercontextColorCountsupportsCursorVisibility supportsModesetMode getModeStatusassumedStateRefmkDisplayContextringTerminalBell supportsBellModeMouseBracketedPastedisplayContextinitialAssumedState writeUtf8Text outputPicturewriteOutputOps writeSpanOps writeSpanOpcursorOutputMapcursorColumnOffsetlimitAttrForDisplay$fEqMode $fReadMode $fShowModeMockData mockTerminalreserveTerminaloutputForConfig setCursorPos hideCursor showCursorVtyupdate nextEvent inputIface outputIfacerefreshshutdownmkVtywithVtyInlineM backColor foreColor applyStyle removeStyle defaultAll putAttrChangeputAttrChange_ BuildResults outParamCount outCapOps outParamOps BuildState nextOffset CapParserParamOp IncFirstTwoParamOpsCapOpBytesDecOutCharOut PushParam PushValue Conditional BitwiseOr BitwiseXOr BitwiseAnd ArithPlus ArithMinus CompareEq CompareLt CompareGtconditionalExprconditionalPartsCapOpsCapParam CapExpressioncapOpscapBytes sourceString paramCountparamOpsparseCapExpressionconstructCapExpressioncapExpressionParserparamEscapeParserliteralPercentParser paramOpParserincrementOpParser pushOpParser decOutParser charOutParserconditionalOpParserconditionalTrueParserconditionalFalseParserconditionalEndParserbitwiseOpParserbitwiseOrParserbitwiseAndParserbitwiseXorParser arithOpParserliteralIntOpParsercompareOpParser bytesOpParsercharConstParser incOffsetinitialBuildState$fMonoidBuildResults$fNFDataParamOp $fNFDataCapOp$fNFDataCapExpression$fShowCapExpression$parsec-3.1.11-37j7M1YEHqtEooY7BpJdriText.Parsec.Error ParseError EvalStateEval evalStackevalExpression evalParamspop readParampush applyParamOps applyParamOp writeCapExpr writeCapOps writeCapOp utf8FromIsoppUtf8base Control.MonadguardGHC.BasejoinMonad>>=>>returnfailFunctorfmap<$ Applicativepure<*>*><*Data.TraversablemapMsequencemfilter<$!>unless replicateM_ replicateMfoldM_foldM zipWithM_zipWithM mapAndUnzipMforever<=<>=>filterMforMControl.Applicativeoptional WrappedMonad WrapMonad unwrapMonad WrappedArrow WrapArrow unwrapArrowZipList getZipListData.Functor.ConstConstgetConst Data.Foldablemsum sequence_forM_mapM_ Data.Functorvoid<$>apliftM5liftM4liftM3liftM2liftMwhen=<<liftA3liftA2liftA<**> Alternativeemptysomemany MonadPlusmzeromplus isSGREvent sgrPrefix isNormalEvent normalPrefixshiftBitmetaBitctrlBit buttonMask leftButton middleButton rightButton hasBitSet getSGRButton getModifiersclassifyNormalMouseEventclassifySGRMouseEventghc-prim GHC.TypesTruebracketedPasteStartbracketedPasteEnd takeUntilcompileclassify classifyUtf8 utf8LengthnavKeys0navKeys1navKeys2navKeys3 functionKeys1 functionKeys2 classifyTable unix-2.7.2.0System.Posix.IO.CommonstdInput stdOutputdirectory-1.2.6.2System.DirectorygetAppUserDataDirectory GParseAlts gparseAltsGParsegparseParse parseValueconfigLanguage configLexermapDecl debugLogDecl ignoreLine parseConfig genericParse InputBuffer_ptr_size configRef eventChannel inputDebug InputState_unprocessedBytes_appliedConfig _inputBuffer _classifierptrsizeInputM setTermTiming appliedConfig classifier inputBufferunprocessedByteslogMsgloopInputProcessoraddBytesToProcessemitreadFromDevice applyConfig parseEvent dropInvalidrunInputProcessorLoopattributeControllogInitialInputState initInput forkOSFinally<>=<>~ HorizText HorizJoinVertJoinBGFill CropRightCropLeft CropBottomCropTop EmptyImage displayText outputWidth charWidth outputHeightleftSkiptopSkipppImageStructure $fMonoidImageattrpartLeft partRightpartTop partBottom croppedImageclipText $fNFDataImage $fShowImageDisplayAttrSeqterminfoWriteSetAttransiColorIndex altColorIndexDisplayAttrState applyStandoutapplyUnderlineapplyReverseVideo applyBlinkapplyDim applyBold EnterExitSeqSetStateDisplayAttrCaps setAttrStates enterStandout exitStandoutenterUnderline exitUnderlineenterReverseVideo enterDimMode enterBoldMode TerminfoCapssmcuprmcupcupcnormcivissupportsNoColorsuseAltColorMap setForeColor setBackColorsetDefaultAttr clearScreenclearEoldisplayAttrCaps ringBellAudioc_getWindowSize fdWriteAllsendCapToTerminal requireCapprobeCapparseCapcurrentDisplayAttrCaps getWindowSizeterminfoDisplayContextsgrArgsForStatereqDisplayCapSeqFor stateForStylestyleToApplySeqenableBracketedPastesdisableBracketedPastessetUtf8CharSetsetDefaultCharSetxtermInlineHack utf8ActiveintMkVty GHC.IORefIORef globalVty globalOutput mkDupeConfig withOutput