1{-# LANGUAGE ScopedTypeVariables #-}
6import qualified Data.ByteString as B
14 DisplayRegion w h <- display_bounds $ terminal vt
15 putStrLn $ show $ DisplayRegion w h
18pieceA = def_attr `with_fore_color` red
19dumpA = def_attr `with_style` reverse_video
21play :: Vty -> Word -> Word -> Word -> Word -> String -> IO ()
22play vt x y sx sy btl = do update vt (current_pic x y sx sy btl)
24 case k of EvKey (KASCII 'r') [MCtrl] -> refresh vt >> play vt x y sx sy btl
25 EvKey KLeft [] | x /= 0 -> play vt (x-1) y sx sy btl
26 EvKey KRight [] | x /= (sx-1) -> play vt (x+1) y sx sy btl
27 EvKey KUp [] | y /= 1 -> play vt x (y-1) sx sy btl
28 EvKey KDown [] | y /= (sy-2) -> play vt x (y+1) sx sy btl
29 EvKey KEsc [] -> shutdown vt >> return ()
30 EvResize nx ny -> play vt (min x (toEnum nx - 1))
31 (min y (toEnum ny - 2))
35 _ -> play vt x y sx sy (take (fromEnum sx) (show k ++ btl))
38current_pic :: Word -> Word -> Word -> Word -> String -> Picture
39current_pic x y sx sy btl = pic_for_image i
40 where i = string def_attr "Move the @ character around with the arrow keys. Escape exits."
41 <-> char_fill pieceA ' ' sx (y - 1)
42 <-> char_fill pieceA ' ' x 1 <|> char pieceA '@' <|> char_fill pieceA ' ' (sx - x - 1) 1
43 <-> char_fill pieceA ' ' sx (sy - y - 2)
44 <-> iso_10646_string dumpA btl
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list