mirror of
https://github.com/ilyakooo0/vty.git
synced 2024-11-30 02:13:36 +03:00
latter entries in the table have precedence. the mock input tests was not reflecting this.
This commit is contained in:
parent
aa67f22b38
commit
7d434d3104
@ -7,8 +7,6 @@ module Main where
|
|||||||
|
|
||||||
import Verify.Graphics.Vty.Output
|
import Verify.Graphics.Vty.Output
|
||||||
|
|
||||||
import Data.List (intersperse)
|
|
||||||
|
|
||||||
import Graphics.Vty hiding (resize)
|
import Graphics.Vty hiding (resize)
|
||||||
import Graphics.Vty.Input.Events
|
import Graphics.Vty.Input.Events
|
||||||
import Graphics.Vty.Input.Loop
|
import Graphics.Vty.Input.Loop
|
||||||
@ -22,6 +20,7 @@ import Control.Monad
|
|||||||
|
|
||||||
import Data.Default
|
import Data.Default
|
||||||
import Data.IORef
|
import Data.IORef
|
||||||
|
import Data.List (intersperse, reverse, nubBy)
|
||||||
|
|
||||||
import System.Console.Terminfo
|
import System.Console.Terminfo
|
||||||
import System.Posix.IO
|
import System.Posix.IO
|
||||||
@ -140,7 +139,9 @@ instance Show (InputBlocksUsingTable event) where
|
|||||||
instance Monad m => Serial m (InputBlocksUsingTable event) where
|
instance Monad m => Serial m (InputBlocksUsingTable event) where
|
||||||
series = do
|
series = do
|
||||||
n :: Int <- localDepth (const maxTableSize) series
|
n :: Int <- localDepth (const maxTableSize) series
|
||||||
return $ InputBlocksUsingTable $ \table -> concat (take n (selections table))
|
return $ InputBlocksUsingTable $ \raw_table ->
|
||||||
|
let table = reverse $ nubBy (\(s0,_) (s1,_) -> s0 == s1) $ reverse raw_table
|
||||||
|
in concat (take n (selections table))
|
||||||
where
|
where
|
||||||
selections [] = []
|
selections [] = []
|
||||||
selections (x:xs) = let z = selections xs in [x] : (z ++ map ((:) x) z)
|
selections (x:xs) = let z = selections xs in [x] : (z ++ map ((:) x) z)
|
||||||
|
Loading…
Reference in New Issue
Block a user