mirror of
https://github.com/ilyakooo0/vty.git
synced 2024-11-29 08:49:40 +03:00
commit
572c59881b
@ -14,5 +14,4 @@ utf8FromIso :: [Int] -> [Word8]
|
||||
utf8FromIso = encode . map toEnum
|
||||
|
||||
ppUtf8 :: [Int] -> IO ()
|
||||
ppUtf8 = print . map (\f -> f "") . map showHex . utf8FromIso
|
||||
|
||||
ppUtf8 = print . map (`showHex` "") . utf8FromIso
|
||||
|
@ -42,7 +42,7 @@ pop = do
|
||||
|
||||
readParam :: Word -> Eval CapParam
|
||||
readParam pn = do
|
||||
!params <- get >>= return . evalParams
|
||||
!params <- evalParams <$> get
|
||||
return $! genericIndex params pn
|
||||
|
||||
push :: CapParam -> Eval ()
|
||||
@ -68,7 +68,7 @@ writeCapOps ops = mapM_ writeCapOp ops
|
||||
|
||||
writeCapOp :: CapOp -> Eval ()
|
||||
writeCapOp (Bytes !offset !count) = do
|
||||
!cap <- get >>= return . evalExpression
|
||||
!cap <- evalExpression <$> get
|
||||
let bytes = Vector.take count $ Vector.drop offset (capBytes cap)
|
||||
Vector.forM_ bytes $ tell.writeWord8
|
||||
writeCapOp DecOut = do
|
||||
|
@ -128,7 +128,7 @@ paramEscapeParser = do
|
||||
literalPercentParser :: CapParser BuildResults
|
||||
literalPercentParser = do
|
||||
_ <- char '%'
|
||||
startOffset <- getState >>= return . nextOffset
|
||||
startOffset <- nextOffset <$> getState
|
||||
incOffset 1
|
||||
return $ BuildResults 0 [Bytes startOffset 1] []
|
||||
|
||||
@ -154,7 +154,7 @@ incrementOpParser = do
|
||||
pushOpParser :: CapParser BuildResults
|
||||
pushOpParser = do
|
||||
_ <- char 'p'
|
||||
paramN <- digit >>= return . (\d -> read [d])
|
||||
paramN <- read . pure <$> digit
|
||||
incOffset 2
|
||||
return $ BuildResults (fromEnum paramN) [PushParam $ paramN - 1] []
|
||||
|
||||
@ -299,7 +299,7 @@ compareOpParser
|
||||
bytesOpParser :: CapParser BuildResults
|
||||
bytesOpParser = do
|
||||
bytes <- many1 $ satisfy (/= '%')
|
||||
startOffset <- getState >>= return . nextOffset
|
||||
startOffset <- nextOffset <$> getState
|
||||
let !c = length bytes
|
||||
!s <- getState
|
||||
let s' = s { nextOffset = startOffset + c }
|
||||
|
@ -137,7 +137,7 @@ readFromDevice = do
|
||||
threadWaitRead fd
|
||||
bytesRead <- fdReadBuf fd bufferPtr (fromIntegral maxBytes)
|
||||
if bytesRead > 0
|
||||
then fmap (map $ chr . fromIntegral) $ peekArray (fromIntegral bytesRead) bufferPtr
|
||||
then map (chr . fromIntegral) <$> peekArray (fromIntegral bytesRead) bufferPtr
|
||||
else return []
|
||||
when (not $ null stringRep) $ logMsg $ "input bytes: " ++ show stringRep
|
||||
return stringRep
|
||||
|
Loading…
Reference in New Issue
Block a user