r`m      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                   ! " # $ % & ' ( ) * + , - . / 0 1 23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl!NoneDmnopqrstuvwxyz{|}~@mnopqrstuvwxyz{|}~'mnopqrstuvwxy~}|{zNonecapability evaluator state   Safe-Inferred]Converts an array of ISO-10646 characters (Char type) to an array of Word8 bytes that is the " corresponding UTF8 byte sequence NoneaReturns 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 width  Safe-Inferred(The type of exceptions specific to vty. ZThese have fully qualified names by default since, IMO, exception handling requires this. 'Uncategorized failure specific to vty.  Safe-InferredEvents.  if read from  eventChannel: this is the size at the time of the signal. If read from   nextEventR this is the size at the time the event was processed by Vty. Typically these are S the same, but if somebody is resizing the terminal quickly they can be different. t#odo mouse events are not supported Mouse buttons. todo not supported. MModifier keys. Key codes are interpreted such that users are more likely to ; have Meta than Alt; for instance on the PC Linux console,  will / generally correspond to the physical Alt key. &Representations of non-modifier keys. Y KFun is indexed from 0 to 63. Range of supported FKeys varies by terminal and keyboard. \ KUpLeft, KUpRight, KDownLeft, KDownRight, KCenter support varies by terminal and keyboard. [ Actually, support for most of these but KEsc, KChar, KBS, and KEnter vary by terminal and  keyboard. (  !"#$%&'()*+,-(  !"#$%&'()*+,-(-,+*)('&%$#"!       -,+*)('&%$#"!  Safe-Inferred Safe-InferredEncoding for navigation keys. JTODO: This is not the same as the input bytes pulled from teh caps table. -encoding for shift, meta and ctrl plus arrowshomeend 3encoding for ins, del, pageup, pagedown, home, end :encoding for ctrl + ins, del, pageup, pagedown, home, end &encoding for shift plus function keys According to  http: aperiodic.netphilarchivesGeekeryterm-function-keys.html 'This encoding depends on the terminal. encoding for meta plus char TODO: resolve -  removed ESC* from second list due to duplication with special_support_keys.  2. removed '['Q from second list due to conflict with 7-bit encoding for ESC. Whether meta+[ is 9 the same as ESC should examine km and current encoding.  3. stopped enumeration at '~' instead of '\DEL'!. The latter is mapped to KBS by  special_support_keys.  Safe-Inferred .`queries the terminal for all capability based input sequences then adds on a terminal dependent  input sequence mapping. For reference see:  http:vimdoc.sourceforge.nethtmldoc term.html  vim74srcterm.c  http:invisible-island.netvttest  http: aperiodic.netphilarchivesGeekeryterm-function-keys.html aThis 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. ; add tables for visible chars, esc, del plus ctrl and meta 7 add internally defined table for given terminal type. (Precedence is currently implicit in the compile algorithm. Which is a bit odd. t$odo terminfo meta is not supported.  t odo no 8bit /'key table applicable to all terminals. +TODO: some probably only applicable to ANSI/VT100 terminals. 1Jtables specific to a given terminal that are not derivable from terminfo. TODO: Adds the ANSIVT100+VT50 tables regardless of term identifier. 2;Visible characters in the ISO-8859-1 and UTF-8 common set.  we limit to <S 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 ctrlChar 3YNon visible characters in the ISO-8859-1 and UTF-8 common set translated to ctrl + char. t&odo resolve CTRL-i is the same as tab 4Ctrl+Meta+Char 56esc, meta esc, delete, meta delete, enter, meta enter 6<classify table directly generated from terminfo cap strings  these are:  ka1 - keypad up-left  ka3 - keypad up-right  kb2 - keypad center  kbs - keypad backspace  kbeg - begin  kcbt - back tab  kc1 - keypad left-down  kc3 - keypad right-down  kdch1 - delete  kcud1 - down  kend - end  kent - enter  kf0 - kf63 - function keys  khome - KHome  kich1 - insert  kcub1 - left  knp - next page (page down)  kpp - previous page (page up)  kcuf1 - right  kDC - shift delete  kEND - shift end  kHOM - shift home  kIC - shift insert  kLFT - shift left  kRIT - shift right  kcuu1 - up 7cap names for function keys ./01234567 ./01234567 ./01234567 ./01234567 Safe-Inferred8)Abstract data type representing a color. SCurrently 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 2 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:   black  red  green  yellow  blue  magenta  cyan  white `The 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 colorsL property. If this property is not being accurately reported then the color ! reproduction will be incorrect. If the terminal reports <G= 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. aAll of this assumes the terminals are behaving similarly to xterm and rxvt when handling colors. a 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. 89:89:8:9 Safe-Inferred; RGB color to 240 color palette. Dgenerated from 256colres.pl which is forked from xterm 256colres.pl $ todo: all values get clamped high. ;;; Safe-Inferred<ZStyles 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 3 previously applied style. Or be a specific value. A]Specifies the display attributes such that the final style and color values do not depend on Z the previously applied display attribute. The display attributes can still depend on the  terminal'"s default colors (unfortunately). FYA 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. K,Standard 8-color ANSI terminal color codes. L,Standard 8-color ANSI terminal color codes. M,Standard 8-color ANSI terminal color codes. N,Standard 8-color ANSI terminal color codes. O,Standard 8-color ANSI terminal color codes. P,Standard 8-color ANSI terminal color codes. Q,Standard 8-color ANSI terminal color codes. R,Standard 8-color ANSI terminal color codes. SBright/-Vivid variants of the standard 8-color ANSI TBright/-Vivid variants of the standard 8-color ANSI UBright/-Vivid variants of the standard 8-color ANSI VBright/-Vivid variants of the standard 8-color ANSI [!The 6 possible style attributes:  standout  underline  reverseVideo  blink  dim  bold/bright [( The invisible, protect, and altcharset display attributes some terminals support are not  supported via VTY.) \!The 6 possible style attributes:  standout  underline  reverseVideo  blink  dim  bold/bright [( The invisible, protect, and altcharset display attributes some terminals support are not  supported via VTY.) ]!The 6 possible style attributes:  standout  underline  reverseVideo  blink  dim  bold/bright [( The invisible, protect, and altcharset display attributes some terminals support are not  supported via VTY.) ^!The 6 possible style attributes:  standout  underline  reverseVideo  blink  dim  bold/bright [( The invisible, protect, and altcharset display attributes some terminals support are not  supported via VTY.) _!The 6 possible style attributes:  standout  underline  reverseVideo  blink  dim  bold/bright [( The invisible, protect, and altcharset display attributes some terminals support are not  supported via VTY.) `!The 6 possible style attributes:  standout  underline  reverseVideo  blink  dim  bold/bright [( The invisible, protect, and altcharset display attributes some terminals support are not  supported via VTY.) c;true if the given Style value has the specified Style set. dSet the foreground color of an F. eSet the background color of an F. fAdd the given style attribute g^Sets the style, background color and foreground color to the default values for the terminal. Z There is no easy way to determine what the default background and foreground colors are. hXKeeps the style, background color and foreground color that was previously set. Used to + override some part of the previous style. EG: current_style d brightMagenta `Would be the currently applied style (be it underline, bold, etc) but with the foreground color  set to brightMagenta. 0<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh189:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh1FGHIJABCDE=@?>KRQPONMLSVUTWZYX<[`_^]\abcdefgh8:9;%<=@?>ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghNoneiGThis 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 images  a two dimensional fill of the Pictures background character  a cropped image ' an empty image of no size or content. The empty image ,The combining operators identity constant.  EmptyImage  | a = a  EmptyImage  - a = a /Any image of zero size equals the empty image. ECrop an image vertically to a size by reducing the size from the top Always  imageHeight croppedImage 0 HCrop an image vertically to a size by reducing the size from the bottom ICrop an image horizontally to a size by reducing the size from the left. Always  imageWidth croppedImage 0 JCrop an image horizontally to a size by reducing the size from the right. RA background fill will be filled with the background char. The background char is B defined as a property of the Picture this Image is used to form. [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 X fills to the provides images that assure this is true for the VertJoin value produced. ]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 Y fills to the provided images that assure this is true for the HorizJoin value produced. Always  imageHeight croppedImage 0 #height image is cropped to. Always  imageHeight croppedImage 0 imageHeight croppedImage  always > 0 :imageHeight partTop == imageHeight partBottom. always > 1 :imageHeight partLeft == imageHeight partRight. Always > 0 HA horizontal text span is always >= 1 column and has a row height of 1. JThe text to display. The display width of the text is always outputWidth. imageWidth croppedImage imageWidth croppedImage Always  imageWidth croppedImage 0 Always  imageWidth croppedImage 0  always > 0 8imageWidth partTop == imageWidth partBottom. always > 0 8imageWidth partLeft == imageWidth partRight. Always > 1 8The number of display columns for the text. Always > 0. 2the number of characters in the text. Always > 0. j#A display text is a Data.Text.Lazy ]TODO(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? b TODO: Try using a builder instead of a TL.Text instance directly. That might improve performance Y for the usual case of appending a bunch of characters with the same attribute together. -pretty print just the structure of an image. kQThe width of an Image. This is the number display columns the image will occupy. lRThe height of an Image. This is the number of display rows the image will occupy. m!combines two images side by side ]Combines text chunks where possible. Assures outputWidth and outputHeight properties are not  violated. bThe 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 7 missmatch will be filled with the background pattern. ?TODO: the bg fill is biased towards top to bottom languages(?) ncombines two images vertically TThe 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  -. ijklmnijklmn i%jklmnNoneoAn area of the picture'6s bacground (See Background) of w columns and h rows. p6Combines two images horizontally. Alias for horizJoin  infixr 5 q3Combines two images vertically. Alias for vertJoin  infixr 4 r+Compose any number of images horizontally. s)Compose any number of images vertically. tA Data.Text.Lazy value uA Data.Text value v]an image of a single character. This is a standard Haskell 31-bit character assumed to be in  the ISO-10646 encoding. w`A string of characters layed out on a single row with the same display attribute. The string is 4 assumed to be a sequence of ISO-10646 characters. ]Note: depending on how the Haskell compiler represents string literals a string literal in a T UTF-8 encoded source file, for example, may be represented as a ISO-10646 string. Q 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. xMAlias for iso10646String. Since the usual case is that a literal string like foo is D 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 Z UTF-8 encoded in the source, will be transcoded to a ISO 10646 31 bit characters runtime  representation. y[A string of characters layed out on a single row. The input is assumed to be the bytes for  UTF-8 encoded text. z*Renders a UTF-8 encoded lazy bytestring. {,Renders a UTF-8 encoded strict bytestring. |_creates a fill of the specified character. The dimensions are in number of characters wide and  number of rows high. }[The 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 top and left. aThis can have an unexpected effect: Translating an image to less than (0,0) then to greater than  (0,0) will crop the image. 4translates an image by padding or cropping the left 3translates an image by padding or cropping the top `Ensure an image is no larger than the provided size. If the image is larger then crop the right  or bottom. \This 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. ]ensure the image is no wider than the given width. If the image is wider then crop the right  side. \ensure 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 9 no effect. Otherwise the image is cropped from the top. YGeneric resize. Pads and crops as required to assure the given display width and height.  This is biased to pad/crop the right and bottom. PResize the width. Pads and crops as required to assure the given display width.  This is biased to pad/crop the right. RResize the height. Pads and crops as required to assure the given display height.  This is biased to pad/crop the bottom. opqrstuvwxyz{|}~V89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~%jiklmpnqrsotuvxwyz{|}~opqrstuvwxyz{|}~None   Safe-Inferred@Style attribute changes are transformed into a sequence of apply/removes of the individual  attributes. 8Difference 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. aPreviously, 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. WGiven the previously applied display attributes as a FixedAttr and the current display a attributes as an Attr produces a FixedAttr that represents the current display attributes. This J is done by using the previously applied display attributes to remove the  KeepCurrent  abstraction. ;Used in the computation of a final style attribute change. :TODO(corey): not really a simplify but a monoid instance. YConsider two display color attributes diffs. What display color attribute diff are these  equivalent to? :TODO(corey): not really a simplify but a monoid instance. 'Determines the diff between two display&6color attributes. This diff determines the operations + that actually get output to the terminal.    Safe-InferredNamed alias for a Int pair H      !"#$%&'()*+,-./0123 None Pvector of span operation vectors for display. One per row of the output region. ^vector of span operations. executed in succession. This represents the operations required to U render a row of the terminal. The operations in one row may effect subsequent rows. b EG: Setting the foreground color in one row will effect all subsequent rows until the foreground  color is changed. \This represents an operation on the terminal. Either an attribute change or the output of a  text string. \Marks 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. "Skips the given number of columns P A skip is transparent.... maybe? I am not sure how attribute changes interact.  todo: separate from this type. Va span of UTF-8 text occupies a specific number of screen space columns. A single UTF R character does not necessarially represent 1 colunm. See Codec.Binary.UTF8.Width  TextSpan [Attr] [output width in columns] [number of characters] [data] 1Number of columns the DisplayOps are defined for LAll spans are verified to define same number of columns. See: VerifySpanOps .Number of rows the DisplayOps are defined for )The number of columns a SpanOps effects. (The width of a single SpanOp in columns Treturns the number of columns to the character at the given position in the span op 4 4None  None A U 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 b display attribute. If the display attribute used previously should be used for a background fill  then use h for the background attribute. t_odo The current attribute is always set to the default attributes at the start of updating the  screen to a picture. A ClearBackground is: 9 the space character if there are remaining non-skip ops 5 End of line if there are no remaining non-skip ops. ^A 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. )The type of images to be displayed using update. %Can be constructed directly or using *. Which provides an initial instance with 6 reasonable defaults for picCursor and picBackground. 5a picture with no cursor, background or image layers  The given i" is added as the top layer of the   The given i% 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. KCreate a picture for display with the given layers. Ordered top to bottom. `The picture will not have a displayed cursor and no background apttern (ClearBackgroun) will be  used.  The first i is the top layer. JCompatibility with applications that do not use more than a single layer. 5678i89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ 5678 None_Produces the span ops that will render the given picture, possibly cropped or padded, into the  specified region. PReturns the DisplayOps for an image rendered to a window the size of the image. "largerly used only for debugging. 9Produces the span ops for each layer then combines them. [TODO: a fold over a builder function. start with span ops that are a bg fill of the entire  region. VBuilds a vector of row operations that will output the given picture to the terminal. #Crops to the given display region. todo I'Lm pretty sure there is an algorithm that does not require a mutable buffer. XAdd the operations required to build a given image to the current set of row operations C returns the number of columns and rows contributed to the output. FThis adds an image that might be partially clipped to the output ops. XThis is a very touchy algorithm. Too touchy. For instance, the CropRight and CropBottom c implementations are odd. They pass the current tests but something seems terribly wrong about all  this. t:odo prove this cannot be called in an out of bounds case.  9snocs the operation to the operations for the given row. ' ' '  None [The cursor position is given in X,Y character offsets. Due to multi-column characters this 2 needs to be translated to column, row positions. ,Provide the bounds of the display context. ?Reset the display attributes to the default display attributes See   <Text identifier for the output device. Used for debugging.  NClear the display and initialize the terminal to some initial display state. PThe expectation of a program is that the display starts in some initial state. 2 The initial state would consist of fixed values:  cursor at top left  - UTF-8 character encoding , - drawing characteristics are the default [The abstract operation I think all these behaviors are instances of is reserving exclusive  access to a display such that: ) The previous state cannot be determined ^ - When 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. $3Maximum number of colors supported by the context. %if the cursor can be shown / hidden ';Acquire display access to the given region of the display. Z Currently all regions have the upper left corner of (0,0) and the lower right corner at D (max displayWidth providedWidth, max displayHeight providedHeight) *ZAll 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. 9 The cursor is then shown and positioned or kept hidden. &todo: specify possible IO exceptions. / abstract from IO monad to a MonadIO instance. 1_Not all terminals support all display attributes. This filters a display attribute to what the  given terminal can display. (     !"#$%&'()*+,-./01(     !"#$%&'()*+,-./01( !"#$%&'() *+,-.   /01      !"#$%&'()*+,-./01None9^The 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 6 - 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 V - display attributes are reset to defaults then the display attribute state is set.  - b - 3. If a mode is supposed to be applied but there is not an enter capability defined then then S - display attribute state is set if possible. Otherwise the mode is not applied.  - b - 4. If the display attribute state is being set then just update the arguments to that for any  - apply/remove.  - 2\Uses terminfo for all control codes. While this should provide the most compatible terminal e - terminfo does not support some features that would increase efficiency and improve compatibility:  - e - * determine the character encoding supported by the terminal. Should this be taken from the LANG  - environment variable?  - J - * Provide independent string capabilities for all display attributes.  - c - todo: Some display attributes like underline and bold have independent string capabilities that ) - should be used instead of the generic sgr string capability. :DPortably 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. D1, If a foreground color is to be set then set the foreground color  $ likewise with the background color 3If 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 modes  set the fore color if required  set the back color if required ^Entering the required style modes could require a reset of the display attributes. If this is N the case then the back and fore colors always need to be set if not default. *This equation implements the above logic. t\odo This assumes the removal of color changes in the display attributes is done as expected  with noColors == True. See 1 t[odo This assumes that fewer state changes, followed by fewer bytes, is what to optimize. I  haven'Ct 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. XThis takes a Color which clearly identifies which pallete to use and computes the index " into the full 256 color pallete. <For terminals without setaf/setab  See table in ` man terminfo`  Will error if not in table. 5=>?@ABCD9EFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab2cdefgh:;<ijkl22=>?@ABCD9FEG HIJKLMNOPQRSTUVWXYZ[\]^_`ab2cdefgh:;<ijklNone3)for Terminal.app the terminal identifier xterm0 is used. For iTerm.app the terminal identifier  xterm-256color is used. "This effects the terminfo lookup. mXTerminal.app requires the xterm-color smcup and rmcup caps. Not the generic xterm ones. 1 Otherwise, Terminal.app expects the xterm caps. nXTerminal.app requires the xterm-color smcup and rmcup caps. Not the generic xterm ones. 1 Otherwise, Terminal.app expects the xterm caps. o3always smcup then clear the screen on terminal.app t odo really? p0iTerm needs a clear screen after smcup as well. t'odo but we apply to all mac terminals? 3mnoqp333mnoqpNone4"Initialize the display to UTF-8. r;These sequences set xterm based terminals to UTF-8 output. t odo I don'5t know of a terminfo cap that is equivalent to this. s;These sequences set xterm based terminals to UTF-8 output. t odo I don'5t know of a terminfo cap that is equivalent to this. tZI 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. 4rst444rstNone6_The mock display terminal produces a string representation of the requested picture. There is U *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. aThe 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 X parsing the text representation and determining how the picture was mapped to terminal  operations. _The string representation is a sequence of identifiers where each identifier is the name of an  operation in the algebra. 56565656 Safe-Inferred :The default is 1 character. ;.The default is 100 milliseconds, 0.1 seconds. <;Debug information is appended to this file if not Nothing. =ZThe (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. >1The input file descriptor to use. The default is u ?2The output file descriptor to use. The default is v @9The terminal name used to look up terminfo capabilities. < The default is the value of the TERM environment variable. A^Mappings from input bytes to event in the order specified. Later entries take precedence over A earlier in the case multiple entries have the same byte string. B Config from w/config and $VTY_CONFIG_FILE 789:;<=>?@ABCDEFGHIJKLMNOxy789:;<=>?@ABCDEFGHIJKLMNOA89:;<=>?@7BCDEFGHIJKLMNO789:;<=>?@ABCDEFGHIJKLMNOxyNoneP Returns a  for the terminal specified in 8 bThe specific Output implementation used is hidden from the API user. All terminal implementations d are assumed to perform more, or less, the same. Currently, all implementations use terminfo for at + least some terminal specific information. WSpecifics 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:  If TERM == xterm ` then the terminal might be one of the Mac OS X .app terminals. Check if that might be ) the case and use MacOSX if so. $ otherwise use XTermColor. 1 for any other TERM value TerminfoBased is used. ]To differentiate between Mac OS X terminals this uses the TERM_PROGRAM environment variable. Z However, an xterm started by Terminal or iTerm *also* has TERM_PROGRAM defined since the " environment variable is not reset/>cleared by xterm. However a Terminal.app or iTerm.app started a from an xterm under X11 on mac os x will likely be done via open. Since this does not propogate _ environment variables (I think?) this assumes that XTERM_VERSION will never be set for a true $ Terminal.app or iTerm.app session. t^odo add an implementation for windows that does not depend on terminfo. Should be installable G with only what is provided in the haskell platform. Use ansi-terminal Q>Sets the cursor position to the given output column and row. XThis is not necessarially the same as the character position with the same coordinates. : Characters can be a variable number of columns in width. aCurrently, the only way to set the cursor position to a given character coordinate is to specify N the coordinate in the Picture instance provided to outputPicture or refresh. RHides the cursor SShows the cursor PQRS!  !"#$%&'(+PQRS!PQRS !"#$%&' +(PQRS!NoneV7Channel of events direct from input processing. Unlike  nextEvent this will not refresh % the display if the next event is an . WWShuts down the input processing. This should return the terminal input state to before  the input initialized. X:Changes to this value are reflected after the next event. Yinput debug log *TUVWXYz{|}~*TUVWXYz{|}~TUVWXYz{|}~NoneZ)Set up the terminal with file descriptor > for input. Returns a T.  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  =. 7The terminal device is configured with the attributes:  IXON disabled [ - disables 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 d days. I hope this means that output will be buffered if the terminal cannot keep up. In the 3 old days the output might of been dropped? raw mode is used for input.  ISIG disabled a - enables keyboard combinations that result in signals. TODO: should probably be a dynamic  option.  ECHO disabled L - input is not echod to the output. TODO: should be a dynamic option.  ICANON disabled X - canonical mode (line mode) input is not used. TODO: should be a dynamic option.  IEXTEN disabled 4 - extended functions are disabled. TODO: I don't know what those are. Z.  !"#$%&'()*+,-TUVWXYZ.-,+*)('&%$#"!    TUVWXYZZNone[1The main object. At most one should be created. /The use of Vty typically follows this process:   initialize vty 5 use the update equation of Vty to display a picture  repeat  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 b requirement. ])Outputs the given Picture. Equivalent to + applied to a display context L implicitly managed by Vty. The managed display context is reset on resize. ^YGet one Event object, blocking if necessary. This will refresh the terminal if the event  is a . _The input interface. See T `The output interface. See  aRefresh 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. O The above methods will throw an exception if executed after this is executed. cKSet up the state object for using vty. At most one state object should be 0 created at a time for a given terminal device. %The specified config is added to the B . With the B taking precedence.  See Graphics.Vty.Config For most applications  mkVty def is sufficient. [\]^_`abc  !"#$%&'()*+,-89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'(+789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc [\]^_`abc[\]^_`abc"Noned&This will create a Vty instance using c2 and execute an IO action provided that instance. 7 The created Vty instance will be stored to the unsafe  . CThis instance will use duplicates of the stdin and stdout Handles. dddNonef)Set the background color to the provided 8 g)Set the foreground color to the provided 8 hAttempt to change the < of the following text. _If the terminal does not support the style change no error is produced. The style can still be  removed. i Attempt to remove the specified <) from the display of the following text. RThis will fail if applyStyle for the given style has not been previously called. jReset the display attributes kRApply the provided display attribute changes to the given terminal output device. "This does not flush the terminal. l`Apply the provided display attributes changes to the terminal output device that was current at S the time this was first used. Which, for most use cases, is the current terminal. %This will flush the terminal output. efghijkl defghijkl efghijkldefghijkl#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcddefghhijklmnopqrstuvwxyz{|}~                                                     ! " " # $ $ % & ' ( ) * + , - - . / 0 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C DEEEFGHIIJKLMNOPQRSTUVWXYZ[\]^_`abc!d!d!e!f!g!hijjklmnopq"rstuvwxyz{{|}~      !"#$%&'()*+,-./01234567889:;<=>?@AB C D E F GHIJKLLMNOPQRSTUUVWXYZ[\]^^_`abcdefghijklmnopqrstuvwxyz{|}~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"""" vty-5.2.4Graphics.Text.WidthGraphics.Vty.ErrorGraphics.Vty.Input.EventsGraphics.Vty.Input.TerminfoGraphics.Vty.AttributesGraphics.Vty.ImageGraphics.Vty.DebugGraphics.Vty.DisplayAttributesGraphics.Vty.PreludeGraphics.Vty.SpanGraphics.Vty.PictureGraphics.Vty.PictureToSpansGraphics.Vty.Output.Interface!Graphics.Vty.Output.TerminfoBasedGraphics.Vty.Output.MacOSXGraphics.Vty.Output.XTermColorGraphics.Vty.Output.MockGraphics.Vty.ConfigGraphics.Vty.OutputGraphics.Vty.Input Graphics.VtyGraphics.Vty.InlineData.Terminfo.ParseData.Terminfo.EvalCodec.Binary.UTF8.DebugGraphics.Vty.Input.Classify"Graphics.Vty.Input.Terminfo.ANSIVTGraphics.Vty.Attributes.Color Graphics.Vty.Attributes.Color240Graphics.Vty.Image.InternalGraphics.Vty.Debug.Image inlineHackGraphics.Vty.Input.LoopGraphics.Vty.Inline.Unsafewcwidthwcswidth safeWcwidth safeWcswidth VtyException VtyFailure ClassifyMapEventEvResizeEvMouseEvKeyButtonBRightBMiddleBLeftModifierMAltMMetaMCtrlMShiftKeyKMenuKBegin KPageDownKEndKDelKPageUpKHomeKInsKPauseKPrtScrKBackTabKFunKCenter KDownRight KDownLeftKUpRightKUpLeftKDownKUpKRightKLeftKEnterKBSKCharKEscclassifyMapForTermuniversalTablecapsClassifyMaptermSpecificTables visibleChars ctrlChars ctrlMetaCharsspecialSupportKeyskeysFromCapsTablefunctionKeyCapsTableColorColor240ISOColorrgbColorStyle MaybeDefaultSetTo KeepCurrentDefault FixedAttr fixedStylefixedForeColorfixedBackColorAttr attrStyle attrForeColor attrBackColorblackredgreenyellowbluemagentacyanwhite brightBlack brightRed brightGreen brightYellow brightBlue brightMagenta brightCyan brightWhitestandout underline reverseVideoblinkdimbolddefaultStyleMask styleMaskhasStyle withForeColor withBackColor withStyledefAttr currentAttrImage DisplayText imageWidth imageHeight horizJoinvertJoinbackgroundFill<|><->horizCatvertCattexttext'chariso10646Stringstring utf8Stringutf8Bytestringutf8Bytestring'charFill emptyImagepad translate translateX translateYcrop cropBottom cropRightcropLeftcropTopresize resizeWidth resizeHeight ImageEndoImageOpImageConstructEventImageConstructLogforwardImageOpsforwardTransformreverseTransform debugImageOps idImageOpStyleStateChange RemoveBold ApplyBold RemoveDimApplyDim RemoveBlink ApplyBlinkRemoveReverseVideoApplyReverseVideoRemoveUnderlineApplyUnderlineRemoveStandout ApplyStandoutDisplayColorDiffSetColor NoColorChangeColorToDefaultDisplayAttrDiff styleDiffs foreColorDiff backColorDifffixDisplayAttrsimplifyStyleDiffssimplifyColorDiffsdisplayAttrDiffs diffColor diffStyles DisplayRegion regionWidth regionHeight DisplayOpsSpanOpsSpanOpRowEndSkipTextSpan textSpanAttrtextSpanOutputWidthtextSpanCharWidth textSpanTextdropOps splitOpsAtdisplayOpsColumnsdisplayOpsRowseffectedRegionspanOpsEffectedColumnsspanOpHasWidthcolumnsToCharOffset MockWindowSpanConstructEvent SpanSetAttrSpanConstructLogrowOpsEffectedColumnsallSpansHaveWidthspanOpsEffectedRows isSetAttrregionForWindow BackgroundClearBackgroundbackgroundCharbackgroundAttrCursorNoCursorPicture picCursor picLayers picBackground emptyPictureaddToTop addToBottom picForImage picForLayerspicImage BlitState _columnOffset _rowOffset _skipColumns _skipRows_remainingColumns_remainingRowsMSpanOpsMRowOpsBlitEnv_region_mrowOps columnOffsetremainingColumns remainingRows rowOffset skipColumnsskipRowsBlitMmrowOpsregiondisplayOpsForPicdisplayOpsForImagecombinedOpsForLayerssubstituteSkips mergeUnder mergeRowUnder swapSkipsForSingleColumnCharSpanswapSkipsForCharSpan buildSpansstartImageBuild isOutOfBoundsaddMaybeClippedaddMaybeClippedJoinaddUnclippedTextaddRowCompletionsnocOpCursorOutputMapcharToOutputPosDisplayContext contextDevice contextRegionwriteMoveCursorwriteShowCursorwriteHideCursor writeSetAttrwriteDefaultAttr writeRowEnd AssumedState prevFattr prevOutputOpsOutput terminalIDreleaseTerminalreserveDisplayreleaseDisplay displayBoundsoutputByteBuffercontextColorCountsupportsCursorVisibilityassumedStateRefmkDisplayContextdisplayContextinitialAssumedState writeUtf8Text outputPicturewriteOutputOps writeSpanOps writeSpanOpcursorOutputMapcursorColumnOffsetlimitAttrForDisplayreserveTerminalMockData mockTerminal ConfigParserConfigvminvtimedebugLoginputMapinputFdoutputFdtermNameInputMap userConfigoverrideEnvConfigstandardIOConfigparseConfigFilerunParseConfigconfigLanguage configLexermapDeclparseKeyparseModifiers parseModifier debugLogDecl ignoreLine parseConfigoutputForConfig setCursorPos hideCursor showCursorInput _eventChannel shutdownInput _configRef _inputDebuginputForConfigVtyupdate nextEvent inputIface outputIfacerefreshshutdownmkVtywithVtyInlineM backColor foreColor applyStyle removeStyle defaultAll putAttrChangeputAttrChange_ BuildResults outParamCount outCapOps outParamOps BuildState nextOffset CapParserParamOp IncFirstTwoParamOpsCapOp CompareGt CompareLt CompareEq ArithMinus ArithPlus BitwiseAnd BitwiseXOr BitwiseOr ConditionalconditionalExprconditionalParts PushValue PushParamCharOutDecOutBytesCapOpsCapParam CapExpressioncapOpscapBytes sourceString paramCountparamOpsparseCapExpressionconstructCapExpressioncapExpressionParserparamEscapeParserliteralPercentParser paramOpParserincrementOpParser pushOpParser decOutParser charOutParserconditionalOpParserconditionalTrueParserconditionalFalseParserconditionalEndParserbitwiseOpParserbitwiseOrParserbitwiseAndParserbitwiseXorParser arithOpParserliteralIntOpParsercompareOpParser bytesOpParsercharConstParser incOffsetinitialBuildState$fMonoidBuildResults$fNFDataParamOp $fNFDataCapOp$fNFDataCapExpression$fShowCapExpression parsec-3.1.7Text.Parsec.Error ParseError EvalStateEval evalStackevalExpression evalParamspop readParampush applyParamOps applyParamOp writeCapExpr writeCapOps writeCapOp utf8FromIsoppUtf8KClassPrefixInvalidValidcompileclassify classifyUtf8 utf8LengthnavKeys0navKeys1navKeys2navKeys3 functionKeys1 functionKeys2 classifyTable $fDefaultAttr$fMonoidMaybeDefault $fMonoidAttr EmptyImageCropToptopSkip CropBottomCropLeftleftSkip CropRightBGFillVertJoin HorizJoin outputHeight HorizText displayText outputWidth charWidthppImageStructure $fMonoidImage croppedImagepartTop partBottompartLeft partRightattrclipText $fNFDataImage $fShowImage$fMonoidDisplayAttrDiffbaseGHC.Basefail>>=>>fmapreturn Control.MonadguardliftMMonadFunctor MonadPlusControl.Applicative Applicative<**> WrapMonad unwrapMonadConstgetConst<*>pure Data.Functor<$><$ AlternativejoinemptymapM<=<>=>apfilterMfoldMfoldM_forMforM_foreverliftM2liftM3liftM4liftM5 mapAndUnzipMmfiltermsum replicateM replicateM_unlessvoidwhenzipWithM zipWithM_mplusmzero=<<mapM_sequence sequence_ WrappedMonad getZipListZipList unwrapArrow WrapArrow WrappedArrowsomemanyoptionalliftA3liftA2liftA<**> $fShowSpanOp$fNFDataBackground$fNFDataCursor$fNFDataPicture $fShowPictureDisplayAttrSeqterminfoWriteSetAttransiColorIndex altColorIndexDisplayAttrState applyStandoutapplyUnderlineapplyReverseVideo applyBlinkapplyDim applyBoldSetState EnterExitSeqDisplayAttrCaps setAttrStates enterStandout exitStandoutenterUnderline exitUnderlineenterReverseVideo enterDimMode enterBoldMode TerminfoCapssmcuprmcupcupcnormcivissupportsNoColorsuseAltColorMap setForeColor setBackColorsetDefaultAttr clearScreenclearEoldisplayAttrCapsc_getWindowSize fdWriteAllsendCapToTerminal requireCapprobeCapparseCapcurrentDisplayAttrCaps getWindowSizeterminfoDisplayContextsgrArgsForStatereqDisplayCapSeqFor stateForStylestyleToApplySeqsmcupStrrmcupStrterminalAppReserveDisplayclearScreenStrterminalAppReleaseDisplaysetUtf8CharSetsetDefaultCharSetxtermInlineHack unix-2.6.0.1System.Posix.IO.CommonstdInput stdOutputdirectory-1.2.0.1System.DirectorygetAppUserDataDirectory$fMonoidConfig$fDefaultConfig InputBuffer_ptr_size configRef eventChannel inputDebug InputState_unprocessedBytes_appliedConfig _inputBuffer_stopRequestRef _classifierptrsizeInputM setTermTiming appliedConfig classifier inputBufferstopRequestRefunprocessedByteslogMsgloopInputProcessoraddBytesToProcessemitreadFromDevice applyConfig parseEvent dropInvalidstopIfRequestedrunInputProcessorLoopattributeControllogInitialInputState initInputintMkVty GHC.IORefIORef globalVty globalOutput mkDupeConfig withOutput