mirror of
https://github.com/ilyakooo0/vty.git
synced 2024-11-29 08:49:40 +03:00
commit
82a1411b94
@ -31,7 +31,7 @@ introText = vertCat $ map (string defAttr)
|
||||
[ "this line is hidden by the top layer"
|
||||
, "The vty demo program will echo the events generated by the pressed keys."
|
||||
, "Below there is a 240 color box."
|
||||
, "Followed by a description of the 16 color pallete."
|
||||
, "Followed by a description of the 16 color palette."
|
||||
, "Followed by tones of red using a 24-bit palette."
|
||||
, "If the 240 color box is not visible then the terminal"
|
||||
, "claims 240 colors are not supported."
|
||||
|
@ -95,7 +95,7 @@ import Graphics.Vty.Attributes.Color240
|
||||
-- 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
|
||||
-- points are only mapped to the 8 color palette. I'm not sure of
|
||||
-- the RGB points for the "bright" colors which is why they are not
|
||||
-- addressable via the 240 color palette.
|
||||
--
|
||||
|
@ -137,7 +137,7 @@ char a c =
|
||||
let displayWidth = safeWcwidth c
|
||||
in HorizText a (TL.singleton c) displayWidth 1
|
||||
|
||||
-- | Make an image from a string of characters layed out on a single
|
||||
-- | Make an image from a string of characters laid out on a single
|
||||
-- row with the same display attribute. The string is assumed to be a
|
||||
-- sequence of ISO-10646 characters. The input string should be
|
||||
-- sanitized of escape sequences (ASCII 27) and carriage returns;
|
||||
|
@ -228,7 +228,7 @@ instance Monoid Image where
|
||||
--
|
||||
-- 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
|
||||
-- images. The area not defined in one image due to a height mismatch
|
||||
-- will be filled with the background pattern.
|
||||
horizJoin :: Image -> Image -> Image
|
||||
horizJoin EmptyImage i = i
|
||||
@ -259,7 +259,7 @@ horizJoin _ _ = error "horizJoin applied to undefined values."
|
||||
--
|
||||
-- The 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
|
||||
-- images. The area not defined in one image due to a width mismatch
|
||||
-- will be filled with the background pattern.
|
||||
vertJoin :: Image -> Image -> Image
|
||||
vertJoin EmptyImage i = i
|
||||
|
@ -77,7 +77,7 @@
|
||||
-- The input encoding determines how UTF-8 encoded characters are
|
||||
-- recognized.
|
||||
--
|
||||
-- * 7-bit mode: UTF-8 can be input unambiguiously. UTF-8 input is
|
||||
-- * 7-bit mode: UTF-8 can be input unambiguously. UTF-8 input is
|
||||
-- a superset of ASCII. UTF-8 does not overlap escaped control key
|
||||
-- sequences. However, the escape key must be differentiated from
|
||||
-- escaped control key sequences by the timing of the input bytes.
|
||||
@ -95,7 +95,7 @@
|
||||
--
|
||||
-- == Terminal Input is Broken
|
||||
--
|
||||
-- Clearly terminal input has fundemental issues. There is no easy way
|
||||
-- Clearly terminal input has fundamental issues. There is no easy way
|
||||
-- to reliably resolve these issues.
|
||||
--
|
||||
-- One resolution would be to ditch standard terminal interfaces
|
||||
|
@ -89,7 +89,7 @@ scrollDown = 65
|
||||
hasBitSet :: Int -> Int -> Bool
|
||||
hasBitSet val bit = val .&. bit > 0
|
||||
|
||||
-- | Attempt to lassify an input string as a mouse event.
|
||||
-- | Attempt to classify an input string as a mouse event.
|
||||
classifyMouseEvent :: ByteString -> KClass
|
||||
classifyMouseEvent s = runParser s $ do
|
||||
when (not $ isMouseEvent s) failParse
|
||||
@ -102,7 +102,7 @@ classifyMouseEvent s = runParser s $ do
|
||||
'M' -> classifyNormalMouseEvent
|
||||
_ -> failParse
|
||||
|
||||
-- Given a modifer/button value, determine which button was indicated
|
||||
-- Given a modifier/button value, determine which button was indicated
|
||||
getSGRButton :: Int -> Parser Button
|
||||
getSGRButton mods =
|
||||
let buttonMap = [ (leftButton, BLeft)
|
||||
|
@ -78,7 +78,7 @@ outputForConfig config = (<> config) <$> standardIOConfig >>= outputForConfig
|
||||
|
||||
-- | Sets the cursor position to the given output column and row.
|
||||
--
|
||||
-- This is not necessarially the same as the character position with the
|
||||
-- This is not necessarily the same as the character position with the
|
||||
-- same coordinates. Characters can be a variable number of columns in
|
||||
-- width.
|
||||
--
|
||||
|
@ -453,8 +453,8 @@ hardcodeColor side (r, g, b) =
|
||||
-- | 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.
|
||||
--
|
||||
-- This takes a Color which clearly identifies which pallete to use and
|
||||
-- computes the index into the full 256 color pallete.
|
||||
-- This takes a Color which clearly identifies which palette to use and
|
||||
-- computes the index into the full 256 color palette.
|
||||
ansiColorIndex :: Color -> Int
|
||||
ansiColorIndex (ISOColor v) = fromEnum v
|
||||
ansiColorIndex (Color240 v) = 16 + fromEnum v
|
||||
|
@ -72,7 +72,7 @@ displayOpsForPic pic r = Vector.create (combinedOpsForLayers pic r)
|
||||
-- | Returns the DisplayOps for an image rendered to a window the size
|
||||
-- of the image.
|
||||
--
|
||||
-- largerly used only for debugging.
|
||||
-- largely used only for debugging.
|
||||
displayOpsForImage :: Image -> DisplayOps
|
||||
displayOpsForImage i = displayOpsForPic (picForImage i) (imageWidth i, imageHeight i)
|
||||
|
||||
|
@ -137,7 +137,7 @@ cropBottomLimitsHeight :: Image -> Int -> Property
|
||||
cropBottomLimitsHeight i v = v >= 0 ==>
|
||||
v >= imageHeight (cropBottom v i)
|
||||
|
||||
-- rediculous tests just to satisfy my desire for nice code coverage :-P
|
||||
-- ridiculous tests just to satisfy my desire for nice code coverage :-P
|
||||
canShowImage :: Image -> Bool
|
||||
canShowImage i = length (show i) > 0
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- We setup the environment to envoke certain terminals of interest.
|
||||
-- We setup the environment to invoke certain terminals of interest.
|
||||
-- This assumes appropriate definitions exist in the current environment
|
||||
-- for the terminals of interest.
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
@ -364,7 +364,7 @@ Did the test output match the description?
|
||||
|]
|
||||
defaultSuccessConfirmResults
|
||||
|
||||
-- Explicitely definethe bytes that encode each example text.
|
||||
-- Explicitly define the bytes that encode each example text.
|
||||
-- This avoids any issues with how the compiler represents string literals.
|
||||
--
|
||||
-- This document is UTF-8 encoded so the UTF-8 string is still included for
|
||||
|
Loading…
Reference in New Issue
Block a user