jtdaugherty / vty Goto Github PK
View Code? Open in Web Editor NEWA high-level ncurses alternative written in Haskell
License: BSD 3-Clause "New" or "Revised" License
A high-level ncurses alternative written in Haskell
License: BSD 3-Clause "New" or "Revised" License
~/src/vty % cabal --version
cabal-install version 1.22.0.0
using version 1.22.0.0 of the Cabal library
~/src/vty % ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.0.20141222
~/src/vty % cabal build
Building vty-5.2.6...
Preprocessing library vty-5.2.6...
[21 of 33] Compiling Graphics.Vty.PictureToSpans ( src/Graphics/Vty/PictureToSpans.hs, dist/build/Graphics/Vty/PictureToSpans.o )
<command line>: can't load .so/.DLL for: libtinfo.so (libtinfo.so: cannot open shared object file: No such file or directory)
I am using the great VTY library for a small robot simulator in teaching beginners programming.
After making all the necessary adjustments to make the robot run again with the current version of the library, it started to produce segmentation faults at random. GDB tells me its from mk_wcswidth, which I identified to be custom C code of this library.
A web search found me a related discussion, most importantly this posting:
http://www.haskell.org/pipermail/glasgow-haskell-bugs/2011-August/032006.html
I then unpacked VTY with cabal and made the suggested change in the C code, i.e. line 211 in mk_wcswidth:
for (;*pwcs && n-- > 0; pwcs++)
to
for (;n-- > 0 && *pwcs; pwcs++)
It makes an awful lot of sense to me, as the length argument is given precedence over reading over the string bounds...
The segfault does no longer occur, at least as far as testing can show that... :-D
I would appreciate an update in the library, so our service center can just deploy it using cabal.
Thanks!
If I build vty in a cabal sandbox (thus ensuring that nothing in my user database accidentally causes the build to pass), I see a build failure when building the tests since ioProperty
used in Verify.hs
is not in QuickCheck 2.4. Judging by the Hackage documentation, ioProperty
was introduced in QuickCheck 2.7.
(I'm working on a patch for this now.)
Hi,
the mtl version constraint is too tight for the latest version, which will be in the upcoming platform. Please consider a minor release fixing this.
Thanks,
Joachim
It would be nice to have a function equivalent to wcwidth and wcswidth to help with calculations on size.
I'm not sure what could be going on here, but I'm running into a situation where once vty has shut down, I see a strange behavior in the terminal input. Here is a minimal test program that exhibits the behavior for me on 5.2.9:
module Main where
import Data.Default
import Graphics.Vty
main :: IO ()
main = do
vty <- mkVty def
shutdown vty
putStrLn "Enter a line of text:"
s <- getLine
print s
The expected behavior: once I see the prompt, I enter some text, press Enter, and see that text printed.
The actual behavior: once I see the prompt, I enter some text, press Enter, nothing happens, I enter more text, press Enter, and the second line of text I entered is printed (so the first is ignored).
One option is to extend the background character support to include None. Which could then be interpreted as transparent. Then layering could be achieved by just rendering Pictures one after another.
In attempting to figure out what would be necessary to make vty-ui
build on GHC 7.6, I encountered this. This was with GHC 7.6.1 and cabal-dev
without a haskell-platform
installation present.
Configuring vty-4.7.0.18...
Building vty-4.7.0.18...
Preprocessing library vty-4.7.0.18...
[ 1 of 18] Compiling Data.Terminfo.Parse ( src/Data/Terminfo/Parse.hs, dist/build/Data/Terminfo/Parse.o )
[ 2 of 18] Compiling Data.Marshalling ( src/Data/Marshalling.hs, dist/build/Data/Marshalling.o )
[ 3 of 18] Compiling Data.Terminfo.Eval ( src/Data/Terminfo/Eval.hs, dist/build/Data/Terminfo/Eval.o )
src/Data/Terminfo/Eval.hs:169:38:
Couldn't match expected type `Int'
with actual type `Foreign.C.Types.CSize'
In the third argument of `memcpy', namely `byte_count'
In the second argument of `($!)', namely
`memcpy out_ptr src_ptr byte_count'
In a stmt of a 'do' block:
liftIO $! memcpy out_ptr src_ptr byte_count
Failed to install vty-4.7.0.18
More verbose output:
Configuring vty-4.7.0.18...
Dependency base ==4.6.0.0: using base-4.6.0.0
Dependency bytestring ==0.10.0.0: using bytestring-0.10.0.0
Dependency containers ==0.5.0.0: using containers-0.5.0.0
Dependency deepseq ==1.3.0.1: using deepseq-1.3.0.1
Dependency ghc-prim ==0.3.0.0: using ghc-prim-0.3.0.0
Dependency mtl ==2.1.2: using mtl-2.1.2
Dependency parallel ==3.2.0.3: using parallel-3.2.0.3
Dependency parsec ==3.1.3: using parsec-3.1.3
Dependency terminfo ==0.3.2.5: using terminfo-0.3.2.5
Dependency unix ==2.6.0.0: using unix-2.6.0.0
Dependency utf8-string ==0.3.7: using utf8-string-0.3.7
Dependency vector ==0.10.0.1: using vector-0.10.0.1
Using Cabal-1.16.0.1 compiled by ghc-7.0
Using compiler: ghc-7.6.1
Using install prefix: /Users/cygnus/src/vty-ui/cabal-dev/
Binaries installed in: /Users/cygnus/src/vty-ui/cabal-dev//bin
Libraries installed in:
/Users/cygnus/src/vty-ui/cabal-dev//lib/vty-4.7.0.18/ghc-7.6.1
Private binaries installed in: /Users/cygnus/src/vty-ui/cabal-dev//libexec
Data files installed in:
/Users/cygnus/src/vty-ui/cabal-dev//share/vty-4.7.0.18
Documentation installed in:
/Users/cygnus/src/vty-ui/cabal-dev//share/doc/vty-4.7.0.18
Using alex version 2.3.5 found on system at: /usr/bin/alex
Using ar found on system at: /usr/bin/ar
No c2hs found
No cpphs found
No ffihugs found
Using gcc version 4.2.1 found on system at: /usr/bin/gcc
Using ghc version 7.6.1 found on system at: /Users/cygnus/ghc761/bin/ghc
Using ghc-pkg version 7.6.1 found on system at:
/Users/cygnus/ghc761/bin/ghc-pkg
No greencard found
Using haddock version 2.12.0 found on system at:
/Users/cygnus/ghc761/bin/haddock
Using happy version 1.18.6 found on system at: /usr/bin/happy
No hmake found
Using hpc version 0.6 found on system at: /Users/cygnus/ghc761/bin/hpc
Using hsc2hs version 0.67 found on system at: /Users/cygnus/ghc761/bin/hsc2hs
Using hscolour version 1.17 found on system at:
/Users/cygnus/.cabal/bin/HsColour
No hugs found
No jhc found
Using ld found on system at: /usr/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
Using pkg-config version 0.27.1 found on system at: /usr/local/bin/pkg-config
Using ranlib found on system at: /usr/bin/ranlib
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /usr/bin/tar
No uhc found
creating dist/build
creating dist/build/autogen
Building vty-4.7.0.18...
Preprocessing library vty-4.7.0.18...
Building library...
creating dist/build
/Users/cygnus/ghc761/bin/ghc --make -fbuilding-cabal-package -O -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -isrc -idist/build/autogen -Idist/build/autogen -Idist/build -Icbits -I/usr/include -optP-include -optPdist/build/autogen/cabal_macros.h -package-name vty-4.7.0.18 -hide-all-packages -no-user-package-db -package-db /Users/cygnus/src/vty-ui/cabal-dev/packages-7.6.1.conf -package-db dist/package.conf.inplace -package-id base-4.6.0.0-6898b0af758ec9881050c7cd4b3d7df3 -package-id bytestring-0.10.0.0-7c0bf25c9e5c7399e0e17903c1e56ccc -package-id containers-0.5.0.0-e49be7a240765a4edc5c09f677ec6a81 -package-id deepseq-1.3.0.1-1ccff719c6664ff57ada7fc9b3033da2 -package-id ghc-prim-0.3.0.0-4fae45041dab03fbd317982185b6da0d -package-id mtl-2.1.2-25dca0019d088a7438da0485cd8b4e7a -package-id parallel-3.2.0.3-2cf17a62a3c11309dabfebe234fc6e34 -package-id parsec-3.1.3-884fe9c210fb90ff540aa38f04f05a24 -package-id terminfo-0.3.2.5-4b6ec10cc2a5d19f0a358216058863e1 -package-id unix-2.6.0.0-b3b746ab69a6b2cbf9cf4eb635a35ddd -package-id utf8-string-0.3.7-66cf23aa4c5ecc8c45f319ad7780d0df -package-id vector-0.10.0.1-078976aec295d8e20232cfec8b93ac43 -XHaskell2010 Graphics.Vty Graphics.Vty.Terminal Graphics.Vty.LLInput Graphics.Vty.Attributes Graphics.Vty.Image Graphics.Vty.Inline Graphics.Vty.Picture Graphics.Vty.DisplayRegion Codec.Binary.UTF8.Width Data.Marshalling Data.Terminfo.Parse Data.Terminfo.Eval Graphics.Vty.DisplayAttributes Graphics.Vty.Span Graphics.Vty.Terminal.Generic Graphics.Vty.Terminal.MacOSX Graphics.Vty.Terminal.XTermColor Graphics.Vty.Terminal.TerminfoBased -O2 -funbox-strict-fields -Wall -fno-full-laziness -fspec-constr -fspec-constr-count=10
[ 1 of 18] Compiling Data.Terminfo.Parse ( src/Data/Terminfo/Parse.hs, dist/build/Data/Terminfo/Parse.o )
[ 2 of 18] Compiling Data.Marshalling ( src/Data/Marshalling.hs, dist/build/Data/Marshalling.o )
[ 3 of 18] Compiling Data.Terminfo.Eval ( src/Data/Terminfo/Eval.hs, dist/build/Data/Terminfo/Eval.o )
src/Data/Terminfo/Eval.hs:169:38:
Couldn't match expected type `Int'
with actual type `Foreign.C.Types.CSize'
In the third argument of `memcpy', namely `byte_count'
In the second argument of `($!)', namely
`memcpy out_ptr src_ptr byte_count'
In a stmt of a 'do' block:
liftIO $! memcpy out_ptr src_ptr byte_count
Failed to install vty-4.7.0.18
I see that mkVty
calls inputForCurrentTerminal
and outputForCurrentTerminal
which open stdin and stdout. For my own use I made two new functions inputForNewTerminal
and outputForNewTerminal
which both open /dev/tty
instead of stdin and stdout. I then copied intMkVty
and made a slightly modified mkVty that calls the 'NewTerminal' functions instead of the 'CurrentTerminal' ones. This allows for redirecting stdin and stdout while still maintaining interactivity. It doesn't seem to have any other effects on vty.
My questions are: am I mistaken in my method to achieve this behavior; does vty support programs that may redirect stdin and stdout without a stub and I was just going about it incorrectly? If not, is supporting this type of behavior desirable?
There are new versions of lens (4.2.) and mtl (2.2.), both of which work with vty (the test suite passes). Could you increase the version requirements in vty.cabal?
Due to a GHC issue this results in 32-bit builds failing to link.
See also: https://ghc.haskell.org/trac/ghc/ticket/9657
Commit 9748c1d introduced an instant stackoverflow in XTermColor.reserve_terminal.
Reproducible by the following minimal example:
main = do
vt <- mkVty
update vt $ pic_for_image empty_image
shutdown vt
Fixable by replacing the first t_actual
parameter to mk_display_context
with t
, but I don't know if that's the proper and/or complete fix.
For a few versions of OS X I've needed to unset the TERM_PROGRAM environment variable to enable 256 color mode on OS X. Detecting this variable might have made sense in the past but it's not relevant today.
Support mouse events where possible.
Graphics.Vty.Input.Loop uses Chan
so when the library user wants to check if the channel is empty, they get
src/library/Yi/UI/Vty.hs:80:41: Warning:
In the use of ‘isEmptyChan’
(imported from Control.Concurrent, but defined in Control.Concurrent.Chan):
Deprecated: "if you need this operation, use Control.Concurrent.STM.TChan instead. See <http://ghc.haskell.org/trac/ghc/ticket/4154> for details"
The build configures as follows on Linux/x86_64:
$ cabal configure
Configuring vty-4.7.2...
Dependency base ==4.*: using base-4.5.1.0
Dependency bytestring -any: using bytestring-0.9.2.1
Dependency containers -any: using containers-0.4.2.1
Dependency deepseq >=1.1 && <1.4: using deepseq-1.3.0.0
Dependency ghc-prim -any: using ghc-prim-0.2.0.0
Dependency mtl >=1.1.1.0 && <2.2: using mtl-2.1.2
Dependency parallel >=2.2 && <3.3: using parallel-3.2.0.3
Dependency parsec >=2 && <4: using parsec-3.1.3
Dependency string-qq -any: using string-qq-0.0.2
Dependency terminfo ==0.3.*: using terminfo-0.3.2.5
Dependency unix -any: using unix-2.5.1.1
Dependency utf8-string ==0.3.*: using utf8-string-0.3.7
Dependency vector >=0.7: using vector-0.10.0.1
Using Cabal-1.14.0 compiled by ghc-7.4
Using compiler: ghc-7.4.2
Using install prefix:
/nix/store/gjmks5xm2in7mrrzbqva8czdx4205p59-haskell-vty-ghc7.4.2-4.7.2
Binaries installed in:
/nix/store/gjmks5xm2in7mrrzbqva8czdx4205p59-haskell-vty-ghc7.4.2-4.7.2/bin
Libraries installed in:
/nix/store/gjmks5xm2in7mrrzbqva8czdx4205p59-haskell-vty-ghc7.4.2-4.7.2/lib/vty-4.7.2/ghc-7.4.2
Private binaries installed in:
/nix/store/gjmks5xm2in7mrrzbqva8czdx4205p59-haskell-vty-ghc7.4.2-4.7.2/libexec
Data files installed in:
/nix/store/gjmks5xm2in7mrrzbqva8czdx4205p59-haskell-vty-ghc7.4.2-4.7.2/share/vty-4.7.2
Documentation installed in:
/nix/store/gjmks5xm2in7mrrzbqva8czdx4205p59-haskell-vty-ghc7.4.2-4.7.2/share/doc/vty-4.7.2
No alex found
Using ar found on system at:
/nix/store/1iigiim5855m8j7pmwf5xrnpf705s4dh-binutils-2.21.1a/bin/ar
No c2hs found
No cpphs found
No ffihugs found
Using gcc version 4.6.3 found on system at:
/nix/store/xl3kqxs68gzs4h309wjyd32im9n6cnyr-gcc-wrapper-4.6.3/bin/gcc
Using ghc version 7.4.2 found on system at:
/nix/store/gzb4pca6nnb16lw2mbmr68kx2vwx8q56-ghc-7.4.2-wrapper/bin/ghc
Using ghc-pkg version 7.4.2 found on system at:
/nix/store/gzb4pca6nnb16lw2mbmr68kx2vwx8q56-ghc-7.4.2-wrapper/bin/ghc-pkg
No greencard found
Using haddock version 2.11.0 found on system at:
/nix/store/858ww5lrjxca5asa79vwq5rm6m1h3q6k-ghc-7.4.2/bin/haddock
No happy found
No hmake found
Using hpc version 0.6 found on system at:
/nix/store/gzb4pca6nnb16lw2mbmr68kx2vwx8q56-ghc-7.4.2-wrapper/bin/hpc
Using hsc2hs version 0.67 found on system at:
/nix/store/gzb4pca6nnb16lw2mbmr68kx2vwx8q56-ghc-7.4.2-wrapper/bin/hsc2hs
No hscolour found
No hugs found
No jhc found
Using ld found on system at:
/nix/store/xl3kqxs68gzs4h309wjyd32im9n6cnyr-gcc-wrapper-4.6.3/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
No pkg-config found
Using ranlib found on system at:
/nix/store/1iigiim5855m8j7pmwf5xrnpf705s4dh-binutils-2.21.1a/bin/ranlib
Using strip found on system at:
/nix/store/1iigiim5855m8j7pmwf5xrnpf705s4dh-binutils-2.21.1a/bin/strip
Using tar found on system at:
/nix/store/8aw6jz9v449mdlxdz2jn4v2ys7d35bf2-gnutar-1.26/bin/tar
No uhc found
And here is the error message:
$ cabal build
Building vty-4.7.2...
Preprocessing executable 'vty-interactive-terminal-test' for vty-4.7.2...
[ 1 of 19] Compiling Graphics.Vty.LLInput ( src/Graphics/Vty/LLInput.hs, dist/build/vty-interactive-terminal-test/vty-interactive-terminal-test-tmp/Graphics/Vty/LLInput.o )
[...]
Loading object (static) dist/build/vty-interactive-terminal-test/vty-interactive-terminal-test-tmp/cbits/gwinsz.o ... done
Loading object (static) dist/build/vty-interactive-terminal-test/vty-interactive-terminal-test-tmp/cbits/set_term_timing.o ... done
Loading object (static) dist/build/vty-interactive-terminal-test/vty-interactive-terminal-test-tmp/cbits/mk_wcwidth.o ... done
final link ... done
test/interactive_terminal_test.hs:77:43:
Ambiguous occurrence `catch'
It could refer to either `Prelude.catch',
imported from `Prelude' at test/interactive_terminal_test.hs:3:8-11
(and originally defined in `System.IO.Error')
or `Control.Exception.catch',
imported from `Control.Exception' at test/interactive_terminal_test.hs:12:1-24
(and originally defined in `Control.Exception.Base')
The following program misbehaves for me with 5.2.9
, iTerm2 on OS X.
The actual behavior: the 10 columns to the left of the green region has a blue background.
The expected behavior: the 10 columns to the left of the green region has the default background.
It looks like the background from the line above is overrunning into the space created by the translation operation.
module Main where
import Control.Monad (void)
import Graphics.Vty
main :: IO ()
main = do
cfg <- standardIOConfig
vty <- mkVty cfg
let line1 = charFill (defAttr `withBackColor` blue) ' ' 10 1
line2 = charFill (defAttr `withBackColor` green) ' ' 10 1
img = translate 10 5 (line1 `vertJoin` line2)
pic = picForImage img
update vty pic
void $ nextEvent vty
shutdown vty
main = do
vt <- mkVty
update vt $ pic_for_image $ vert_cat $ map (\x -> crop (x,1) $ string def_attr "ユニコードとは何か") [1..18]
on gnome-terminal (Ubuntu 10.04) shows:
…
ユ
ユ……
ユニ
ユニ………
ユニコ
ユニコ…………
ユニコー
ユニコー……………
ユニコード
ユニコード…………
ユニコードと
ユニコードと………
ユニコードとは
ユニコードとは……
ユニコードとは何
ユニコードとは何…
ユニコードとは何か
I was expecting at most one ellipsis per line.
Maybe I'm missing the point, but are there custom implementations in cbits/mk_wcwidth.c
? Could it be possible to use the native wcwidth()/wcswidth()
and keep the code base a little bit cleaner?
Just asking, close this issue if it doesn't make any sense :-)
As of 5.2.9
, the text
and text'
functions return EmptyImage
when their text inputs are zero-length, but string
does not seem to behave this way. The result is that string ""
has height 1
and width 0
and the text functions return an Image
of height 0
.
One or both of "reserve_display" and "shutdown" do not properly restore the state of the terminal when a Vty application exits. The behavior I see is that when the application exits, whatever was on the screen at the time the application exited persists, and the shell prompt is left floating amongst the remains. This occurs when I use iTerm2 1.0.0 on OS X 10.6.8. This could very well be an issue with iTerm2, but I thought it might be worth reporting here since vty probably wants to be compatible with as many terminal emulators as possible.
For concrete examples of this problem, you can try any of the demo programs from my "vty-ui" package (build with "-fdemos").
While playing with my toy text editor, based on vty, I found that it is significantly slower compared to vim when scrolling forward/backward. Looks like vim uses special escape characters to scroll screen. AFAIK vty doesn't support it yet.
I added new function into "Vty", it does scrolling via "Terminfo.runTermOutput" and "Terminfo.scrollForward" and updates "display_ops", so that the next "update" will compare it with the new picture and output only the last line.
The speedup was up to 10x.
(That solution is ad-hoc, that is why I didn't open pull request)
Here is a test case:
import Control.Monad
import Graphics.Vty as Vty
main :: IO ()
main = do
vty <- Vty.mkVty
forM_ [0..20] $ \i -> do
Vty.scroll vty -- that is the function I added to Vty
Vty.update vty $ Vty.pic_for_image (Vty.vert_cat $ map (\j -> Vty.string Vty.def_attr $ show j) [i..i+30])
Vty.shutdown vty
I have such xterm config[1]. When i press Home/End in yi-vty i get 'F' and 'H' letters. When i press Backspace twice - i get 'Unrecognized input: M-h M-h' in status line.
Tried to run test/Test from darcs vty. Home/End keys close program and backspace shows: EvKey? (KASCII 'h') [MCtrl]
[1]
[sf] ~:cat .Xresources | grep XTerm !! looks like only following 2 lines matter XTerm*eightBitInput: true XTerm*metaSendsEscape: true XTerm*visualBell: false XTerm*background: black XTerm*foreground: white !XTerm*font: 9x15 !XTerm*font: -xos4-terminus-medium-r-normal--14-*-24-*-*-*-*-koi8-r XTerm*font: -xos4-terminus-medium-*-*-*-*-200-*-*-*-*-iso10646-1 XTerm*saveLines: 10000 XTerm*geometry: 120x45 XTerm*font1: -xos4-terminus-medium-*-*-*-*-120-*-*-*-*-iso10646-1 XTerm*font2: -xos4-terminus-medium-*-*-*-*-140-*-*-*-*-iso10646-1 XTerm*font3: -xos4-terminus-medium-*-*-*-*-160-*-*-*-*-iso10646-1 XTerm*font4: -xos4-terminus-medium-*-*-*-*-200-*-*-*-*-iso10646-1 XTerm*font5: -xos4-terminus-medium-*-*-*-*-240-*-*-*-*-iso10646-1 XTerm*font6: -xos4-terminus-medium-*-*-*-*-260-*-*-*-*-iso10646-1 XTerm*VT100*colorMode: on XTerm*VT100*boldColors: on XTerm*VT100*dynamicColors: on XTerm*VT100*color0: black XTerm*VT100*color1: red3 XTerm*VT100*color2: green3 XTerm*VT100*color3: yellow3 XTerm*VT100*color4: rgb:00/00/40 XTerm*VT100*color5: magenta3 XTerm*VT100*color6: cyan3 XTerm*VT100*color7: gray90 XTerm*VT100*color8: gray50 XTerm*VT100*color9: red XTerm*VT100*color10: green XTerm*VT100*color11: yellow XTerm*VT100*color12: rgb:5c/5c/ff XTerm*VT100*color13: magenta XTerm*VT100*color14: cyan XTerm*VT100*color15: white XTerm*VT100*colorUL: yellow XTerm*VT100*colorBD: white
[shana@lenalee:~]$ for i in haskellPackages.vty; do nix-build ~/programming/nixpkgs -o /tmp/$i -A $i --arg config '{ allowUnfree = true; }' --show-trace ; done
these derivations will be built:
/nix/store/d5n2q11ysprck7aqfwl1j5xa649gl47r-haskell-vty-ghc7.8.3-5.2.2-shared.drv
these paths will be fetched (0.00 MiB download, 5.64 MiB unpacked):
/nix/store/4v23dkvklyx68qyk57plhv99pxmqdfb4-haskell-test-framework-smallcheck-ghc7.8.3-0.2-shared
/nix/store/6xnnl5gs1ijfypgfysbqdpsafy1r13zc-haskell-quickcheck-assertions-ghc7.8.3-0.1.1-shared
/nix/store/8ms9xjbak278w9kvy7c5wgffvbr24p8y-haskell-string-qq-ghc7.8.3-0.0.2-shared
/nix/store/lmdygyw33gp8kda0p216rc50kz64rn6v-haskell-logict-ghc7.8.3-0.6.0.2-shared
/nix/store/mn9ymvw3mw600v4zbnms4dgcwkk56hvz-haskell-ieee754-ghc7.8.3-0.7.3-shared
/nix/store/w5rg2v9ipbi78yq6g5j68y8pjap1mw3s-haskell-smallcheck-ghc7.8.3-1.1.1-shared
fetching path `/nix/store/8ms9xjbak278w9kvy7c5wgffvbr24p8y-haskell-string-qq-ghc7.8.3-0.0.2-shared'...
fetching path `/nix/store/lmdygyw33gp8kda0p216rc50kz64rn6v-haskell-logict-ghc7.8.3-0.6.0.2-shared'...
*** Trying to download/patch `/nix/store/8ms9xjbak278w9kvy7c5wgffvbr24p8y-haskell-string-qq-ghc7.8.3-0.0.2-shared'
*** Step 1/1: downloading `http://hydra.cryp.to/nar/8ms9xjbak278w9kvy7c5wgffvbr24p8y-haskell-string-qq-ghc7.8.3-0.0.2-shared' to `/nix/store/8ms9xjbak278w9kvy7c5wgffvbr24p8y-haskell-string-qq-ghc7.8.3-0.0.2-shared'
*** Trying to download/patch `/nix/store/lmdygyw33gp8kda0p216rc50kz64rn6v-haskell-logict-ghc7.8.3-0.6.0.2-shared'
*** Step 1/1: downloading `http://hydra.cryp.to/nar/lmdygyw33gp8kda0p216rc50kz64rn6v-haskell-logict-ghc7.8.3-0.6.0.2-shared' to `/nix/store/lmdygyw33gp8kda0p216rc50kz64rn6v-haskell-logict-ghc7.8.3-0.6.0.2-shared'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 120k 0 120k 0 0 70362 0 --:--:-- 0:00:01 --:--:-- 70361
fetching path `/nix/store/mn9ymvw3mw600v4zbnms4dgcwkk56hvz-haskell-ieee754-ghc7.8.3-0.7.3-shared'...
*** Trying to download/patch `/nix/store/mn9ymvw3mw600v4zbnms4dgcwkk56hvz-haskell-ieee754-ghc7.8.3-0.7.3-shared'
*** Step 1/1: downloading `http://hydra.cryp.to/nar/mn9ymvw3mw600v4zbnms4dgcwkk56hvz-haskell-ieee754-ghc7.8.3-0.7.3-shared' to `/nix/store/mn9ymvw3mw600v4zbnms4dgcwkk56hvz-haskell-ieee754-ghc7.8.3-0.7.3-shared'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 35144 0 35144 0 0 15385 0 --:--:-- 0:00:02 --:--:-- 15387
fetching path `/nix/store/w5rg2v9ipbi78yq6g5j68y8pjap1mw3s-haskell-smallcheck-ghc7.8.3-1.1.1-shared'...
*** Trying to download/patch `/nix/store/w5rg2v9ipbi78yq6g5j68y8pjap1mw3s-haskell-smallcheck-ghc7.8.3-1.1.1-shared'
*** Step 1/1: downloading `http://hydra.cryp.to/nar/w5rg2v9ipbi78yq6g5j68y8pjap1mw3s-haskell-smallcheck-ghc7.8.3-1.1.1-shared' to `/nix/store/w5rg2v9ipbi78yq6g5j68y8pjap1mw3s-haskell-smallcheck-ghc7.8.3-1.1.1-shared'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 114k 0 114k 0 0 57008 0 --:--:-- 0:00:02 --:--:-- 57024
fetching path `/nix/store/6xnnl5gs1ijfypgfysbqdpsafy1r13zc-haskell-quickcheck-assertions-ghc7.8.3-0.1.1-shared'...
*** Trying to download/patch `/nix/store/6xnnl5gs1ijfypgfysbqdpsafy1r13zc-haskell-quickcheck-assertions-ghc7.8.3-0.1.1-shared'
*** Step 1/1: downloading `http://hydra.cryp.to/nar/6xnnl5gs1ijfypgfysbqdpsafy1r13zc-haskell-quickcheck-assertions-ghc7.8.3-0.1.1-shared' to `/nix/store/6xnnl5gs1ijfypgfysbqdpsafy1r13zc-haskell-quickcheck-assertions-ghc7.8.3-0.1.1-shared'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 274k 0 274k 0 0 140k 0 --:--:-- 0:00:01 --:--:-- 140k
fetching path `/nix/store/4v23dkvklyx68qyk57plhv99pxmqdfb4-haskell-test-framework-smallcheck-ghc7.8.3-0.2-shared'...
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
*** Trying to download/patch `/nix/store/4v23dkvklyx68qyk57plhv99pxmqdfb4-haskell-test-framework-smallcheck-ghc7.8.3-0.2-shared'
*** Step 1/1: downloading `http://hydra.cryp.to/nar/4v23dkvklyx68qyk57plhv99pxmqdfb4-haskell-test-framework-smallcheck-ghc7.8.3-0.2-shared' to `/nix/store/4v23dkvklyx68qyk57plhv99pxmqdfb4-haskell-test-framework-smallcheck-ghc7.8.3-0.2-shared'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 47197 0 47197 0 0 44933 0 --:--:-- 0:00:01 --:--:-- 44949
100 47851 0 47851 0 0 37930 0 --:--:-- 0:00:01 --:--:-- 37946
building path(s) `/nix/store/fshhgisrs7jv9gy6z6milwp9c5yp3vms-haskell-vty-ghc7.8.3-5.2.2-shared'
building /nix/store/fshhgisrs7jv9gy6z6milwp9c5yp3vms-haskell-vty-ghc7.8.3-5.2.2-shared
unpacking sources
unpacking source archive /nix/store/rp26gal2j68ixf3naz3sf8pbfd4x5hc8-vty-5.2.2.tar.gz
source root is vty-5.2.2
patching sources
configuring
[1 of 1] Compiling Main ( Setup.lhs, /tmp/nix-build-haskell-vty-ghc7.8.3-5.2.2-shared.drv-0/Main.o )
Linking Setup ...
configure flags: --enable-split-objs --disable-library-profiling --enable-shared --enable-library-vanilla --enable-executable-dynamic --enable-tests --ghc-option=-optl=-Wl,-rpath=/nix/store/fshhgisrs7jv9gy6z6milwp9c5yp3vms-haskell-vty-ghc7.8.3-5.2.2-shared/lib/ghc-7.8.3/vty-5.2.2 --ghc-option=-j1
Configuring vty-5.2.2...
Dependency Cabal >=1.18: using Cabal-1.18.1.3
Dependency HUnit -any: using HUnit-1.2.5.2
Dependency QuickCheck >=2.4: using QuickCheck-2.7.6
Dependency base ==4.*: using base-4.7.0.1
Dependency blaze-builder >=0.3.3.2 && <0.4: using blaze-builder-0.3.3.4
Dependency bytestring -any: using bytestring-0.10.4.0
Dependency containers -any: using containers-0.5.5.1
Dependency data-default >=0.5.3: using data-default-0.5.3
Dependency deepseq >=1.1 && <1.4: using deepseq-1.3.0.2
Dependency directory -any: using directory-1.2.1.0
Dependency filepath >=1.0 && <2.0: using filepath-1.3.0.2
Dependency hashable >=1.2: using hashable-1.2.2.0
Dependency lens >=3.9.0.2 && <4.5: using lens-4.4.0.2
Dependency mtl >=1.1.1.0 && <2.3: using mtl-2.1.2
Dependency parallel >=2.2 && <3.3: using parallel-3.2.0.4
Dependency parsec >=2 && <4: using parsec-3.1.6
Dependency quickcheck-assertions >=0.1.1: using quickcheck-assertions-0.1.1
Dependency random ==1.0.*: using random-1.0.1.3
Dependency smallcheck ==1.*: using smallcheck-1.1.1
Dependency string-qq -any: using string-qq-0.0.2
Dependency terminfo >=0.3 && <0.5: using terminfo-0.4.0.0
Dependency test-framework ==0.8.*: using test-framework-0.8.0.3
Dependency test-framework-hunit -any: using test-framework-hunit-0.3.0.1
Dependency test-framework-smallcheck ==0.2.*: using
test-framework-smallcheck-0.2
Dependency text >=0.11.3: using text-1.1.1.3
Dependency transformers >=0.3.0.0: using transformers-0.3.0.0
Dependency unix -any: using unix-2.7.0.1
Dependency utf8-string ==0.3.*: using utf8-string-0.3.8
Dependency vector >=0.7: using vector-0.10.11.0
Dependency vty -any: using vty-5.2.2
/nix/store/112m08qrhdbxp6lhi1wl1siwi3vh4k41-ghc-7.8.3-wrapper/bin/ghc --info
Using Cabal-1.18.1.3 compiled by ghc-7.8
Using compiler: ghc-7.8.3
Using install prefix:
/nix/store/fshhgisrs7jv9gy6z6milwp9c5yp3vms-haskell-vty-ghc7.8.3-5.2.2-shared
Binaries installed in:
/nix/store/fshhgisrs7jv9gy6z6milwp9c5yp3vms-haskell-vty-ghc7.8.3-5.2.2-shared/bin
Libraries installed in:
/nix/store/fshhgisrs7jv9gy6z6milwp9c5yp3vms-haskell-vty-ghc7.8.3-5.2.2-shared/lib/ghc-7.8.3/vty-5.2.2
Private binaries installed in:
/nix/store/fshhgisrs7jv9gy6z6milwp9c5yp3vms-haskell-vty-ghc7.8.3-5.2.2-shared/libexec
Data files installed in:
/nix/store/fshhgisrs7jv9gy6z6milwp9c5yp3vms-haskell-vty-ghc7.8.3-5.2.2-shared/share/x86_64-linux-ghc-7.8.3/vty-5.2.2
Documentation installed in:
/nix/store/fshhgisrs7jv9gy6z6milwp9c5yp3vms-haskell-vty-ghc7.8.3-5.2.2-shared/share/doc/x86_64-linux-ghc-7.8.3/vty-5.2.2
Configuration files installed in:
/nix/store/fshhgisrs7jv9gy6z6milwp9c5yp3vms-haskell-vty-ghc7.8.3-5.2.2-shared/etc
No alex found
Using ar found on system at:
/nix/store/ycmsiznf2484vbjwmj57jdy2ncyrj7fj-binutils-2.23.1/bin/ar
No c2hs found
No cpphs found
No ffihugs found
Using gcc version 4.8.3 found on system at:
/nix/store/00jzpig69lknpmffa0sks73iwyxb8c3r-gcc-wrapper-4.8.3/bin/gcc
Using ghc version 7.8.3 found on system at:
/nix/store/112m08qrhdbxp6lhi1wl1siwi3vh4k41-ghc-7.8.3-wrapper/bin/ghc
Using ghc-pkg version 7.8.3 found on system at:
/nix/store/112m08qrhdbxp6lhi1wl1siwi3vh4k41-ghc-7.8.3-wrapper/bin/ghc-pkg
No greencard found
Using haddock version 2.14.3 found on system at:
/nix/store/d3mchqnyysryxdyzfcgm24dn5kki6bx8-ghc-7.8.3/bin/haddock
No happy found
No hmake found
Using hpc version 0.67 found on system at:
/nix/store/112m08qrhdbxp6lhi1wl1siwi3vh4k41-ghc-7.8.3-wrapper/bin
Using hsc2hs version 0.67 found on system at:
/nix/store/112m08qrhdbxp6lhi1wl1siwi3vh4k41-ghc-7.8.3-wrapper/bin/hsc2hs
Using hscolour version 1.20 found on system at:
/nix/store/abgndf8fi6apn3b076x3p11y9j7qf9wx-haskell-hscolour-ghc7.8.3-1.20.3-shared/bin/HsColour
No hugs found
No jhc found
Using ld found on system at:
/nix/store/00jzpig69lknpmffa0sks73iwyxb8c3r-gcc-wrapper-4.8.3/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
No pkg-config found
Using ranlib found on system at:
/nix/store/ycmsiznf2484vbjwmj57jdy2ncyrj7fj-binutils-2.23.1/bin/ranlib
Using strip found on system at:
/nix/store/ycmsiznf2484vbjwmj57jdy2ncyrj7fj-binutils-2.23.1/bin/strip
Using tar found on system at:
/nix/store/vjkl65bpzl39nfskl31x43x4bwipfqg3-gnutar-1.27.1/bin/tar
No uhc found
building
Building vty-5.2.2...
Preprocessing library vty-5.2.2...
[ 1 of 33] Compiling Data.Terminfo.Parse ( src/Data/Terminfo/Parse.hs, dist/build/Data/Terminfo/Parse.o )
[ 2 of 33] Compiling Data.Terminfo.Eval ( src/Data/Terminfo/Eval.hs, dist/build/Data/Terminfo/Eval.o )
[ 3 of 33] Compiling Codec.Binary.UTF8.Debug ( src/Codec/Binary/UTF8/Debug.hs, dist/build/Codec/Binary/UTF8/Debug.o )
[ 4 of 33] Compiling Graphics.Text.Width ( src/Graphics/Text/Width.hs, dist/build/Graphics/Text/Width.o )
[ 5 of 33] Compiling Graphics.Vty.Error ( src/Graphics/Vty/Error.hs, dist/build/Graphics/Vty/Error.o )
[ 6 of 33] Compiling Graphics.Vty.Input.Events ( src/Graphics/Vty/Input/Events.hs, dist/build/Graphics/Vty/Input/Events.o )
[ 7 of 33] Compiling Graphics.Vty.Input.Classify ( src/Graphics/Vty/Input/Classify.hs, dist/build/Graphics/Vty/Input/Classify.o )
[ 8 of 33] Compiling Graphics.Vty.Input.Terminfo.ANSIVT ( src/Graphics/Vty/Input/Terminfo/ANSIVT.hs, dist/build/Graphics/Vty/Input/Terminfo/ANSIVT.o )
[ 9 of 33] Compiling Graphics.Vty.Input.Terminfo ( src/Graphics/Vty/Input/Terminfo.hs, dist/build/Graphics/Vty/Input/Terminfo.o )
[10 of 33] Compiling Graphics.Vty.Attributes.Color ( src/Graphics/Vty/Attributes/Color.hs, dist/build/Graphics/Vty/Attributes/Color.o )
[11 of 33] Compiling Graphics.Vty.Attributes.Color240 ( src/Graphics/Vty/Attributes/Color240.hs, dist/build/Graphics/Vty/Attributes/Color240.o )
[12 of 33] Compiling Graphics.Vty.Attributes ( src/Graphics/Vty/Attributes.hs, dist/build/Graphics/Vty/Attributes.o )
[13 of 33] Compiling Graphics.Vty.Image.Internal ( src/Graphics/Vty/Image/Internal.hs, dist/build/Graphics/Vty/Image/Internal.o )
[14 of 33] Compiling Graphics.Vty.Image ( src/Graphics/Vty/Image.hs, dist/build/Graphics/Vty/Image.o )
[15 of 33] Compiling Graphics.Vty.Debug.Image ( src/Graphics/Vty/Debug/Image.hs, dist/build/Graphics/Vty/Debug/Image.o )
[16 of 33] Compiling Graphics.Vty.DisplayAttributes ( src/Graphics/Vty/DisplayAttributes.hs, dist/build/Graphics/Vty/DisplayAttributes.o )
[17 of 33] Compiling Graphics.Vty.Prelude ( src/Graphics/Vty/Prelude.hs, dist/build/Graphics/Vty/Prelude.o )
[18 of 33] Compiling Graphics.Vty.Span ( src/Graphics/Vty/Span.hs, dist/build/Graphics/Vty/Span.o )
[19 of 33] Compiling Graphics.Vty.Debug ( src/Graphics/Vty/Debug.hs, dist/build/Graphics/Vty/Debug.o )
[20 of 33] Compiling Graphics.Vty.Picture ( src/Graphics/Vty/Picture.hs, dist/build/Graphics/Vty/Picture.o )
[21 of 33] Compiling Graphics.Vty.PictureToSpans ( src/Graphics/Vty/PictureToSpans.hs, dist/build/Graphics/Vty/PictureToSpans.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package bytestring-0.10.4.0 ... linking ... done.
Loading package utf8-string-0.3.8 ... linking ... done.
Loading package terminfo-0.4.0.0 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package text-1.1.1.3 ... linking ... done.
Loading package parsec-3.1.6 ... linking ... done.
Loading package containers-0.5.5.1 ... linking ... done.
Loading package hashable-1.2.2.0 ... linking ... done.
Loading package nats-0.2 ... linking ... done.
Loading package unordered-containers-0.2.5.0 ... linking ... done.
Loading package semigroups-0.15.3 ... linking ... done.
Loading package transformers-compat-0.3.3 ... linking ... done.
Loading package void-0.6.1 ... linking ... done.
Loading package contravariant-1.2 ... linking ... done.
Loading package tagged-0.7.2 ... linking ... done.
Loading package distributive-0.4.4 ... linking ... done.
Loading package comonad-4.2.2 ... linking ... done.
Loading package semigroupoids-4.2 ... linking ... done.
Loading package bifunctors-4.1.1.1 ... linking ... done.
Loading package exceptions-0.6.1 ... linking ... done.
Loading package filepath-1.3.0.2 ... linking ... done.
Loading package prelude-extras-0.4 ... linking ... done.
Loading package profunctors-4.2.0.1 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package free-4.9 ... linking ... done.
Loading package parallel-3.2.0.4 ... linking ... done.
Loading package primitive-0.5.3.0 ... linking ... done.
Loading package reflection-1.5.1 ... linking ... done.
Loading package split-0.2.2 ... linking ... done.
Loading package vector-0.10.11.0 ... linking ... done.
Loading package zlib-0.5.4.1 ... linking ... done.
Loading package lens-4.4.0.2 ... linking ... done.
Loading package old-locale-1.0.0.6 ... linking ... done.
Loading package time-1.4.2 ... linking ... done.
Loading package unix-2.7.0.1 ... linking ... done.
Loading package directory-1.2.1.0 ... linking ... done.
Loading package data-default-class-0.0.1 ... linking ... done.
Loading package data-default-instances-base-0.0.1 ... linking ... done.
Loading package data-default-instances-containers-0.0.1 ... linking ... done.
Loading package dlist-0.7.1 ... linking ... done.
Loading package data-default-instances-dlist-0.0.1 ... linking ... done.
Loading package data-default-instances-old-locale-0.0.1 ... linking ... done.
Loading package data-default-0.5.3 ... linking ... done.
Loading package blaze-builder-0.3.3.4 ... linking ... done.
[22 of 33] Compiling Graphics.Vty.Output.Interface ( src/Graphics/Vty/Output/Interface.hs, dist/build/Graphics/Vty/Output/Interface.o )
[23 of 33] Compiling Graphics.Vty.Output.TerminfoBased ( src/Graphics/Vty/Output/TerminfoBased.hs, dist/build/Graphics/Vty/Output/TerminfoBased.o )
[24 of 33] Compiling Graphics.Vty.Output.MacOSX ( src/Graphics/Vty/Output/MacOSX.hs, dist/build/Graphics/Vty/Output/MacOSX.o )
[25 of 33] Compiling Graphics.Vty.Output.XTermColor ( src/Graphics/Vty/Output/XTermColor.hs, dist/build/Graphics/Vty/Output/XTermColor.o )
[26 of 33] Compiling Graphics.Vty.Output.Mock ( src/Graphics/Vty/Output/Mock.hs, dist/build/Graphics/Vty/Output/Mock.o )
[27 of 33] Compiling Graphics.Vty.Config ( src/Graphics/Vty/Config.hs, dist/build/Graphics/Vty/Config.o )
[28 of 33] Compiling Graphics.Vty.Output ( src/Graphics/Vty/Output.hs, dist/build/Graphics/Vty/Output.o )
[29 of 33] Compiling Graphics.Vty.Input.Loop ( src/Graphics/Vty/Input/Loop.hs, dist/build/Graphics/Vty/Input/Loop.o )
[30 of 33] Compiling Graphics.Vty.Input ( src/Graphics/Vty/Input.hs, dist/build/Graphics/Vty/Input.o )
[31 of 33] Compiling Graphics.Vty ( src/Graphics/Vty.hs, dist/build/Graphics/Vty.o )
[32 of 33] Compiling Graphics.Vty.Inline.Unsafe ( src/Graphics/Vty/Inline/Unsafe.hs, dist/build/Graphics/Vty/Inline/Unsafe.o )
[33 of 33] Compiling Graphics.Vty.Inline ( src/Graphics/Vty/Inline.hs, dist/build/Graphics/Vty/Inline.o )
In-place registering vty-5.2.2...
Preprocessing executable 'vty-demo' for vty-5.2.2...
[1 of 1] Compiling Main ( Demo.hs, dist/build/vty-demo/vty-demo-tmp/Main.dyn_o )
Linking dist/build/vty-demo/vty-demo ...
Preprocessing test suite 'verify-attribute-ops' for vty-5.2.2...
[1 of 3] Compiling Verify ( test/Verify.hs, dist/build/Verify.o )
[2 of 3] Compiling Verify.Graphics.Vty.Attributes ( test/Verify/Graphics/Vty/Attributes.hs, dist/build/Verify/Graphics/Vty/Attributes.o )
[3 of 3] Compiling VerifyAttributeOps ( test/VerifyAttributeOps.hs, dist/build/VerifyAttributeOps.o )
In-place registering verify-attribute-ops-5.2.2...
[1 of 1] Compiling Main ( dist/build/verify-attribute-opsStub/verify-attribute-opsStub-tmp/verify-attribute-opsStub.hs, dist/build/verify-attribute-opsStub/verify-attribute-opsStub-tmp/Main.dyn_o )
Linking dist/build/verify-attribute-opsStub/verify-attribute-opsStub ...
ghc: panic! (the 'impossible' happened)
(GHC version 7.8.3 for x86_64-unknown-linux):
Don't understand library name verify-attribute-ops
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
builder for `/nix/store/d5n2q11ysprck7aqfwl1j5xa649gl47r-haskell-vty-ghc7.8.3-5.2.2-shared.drv' failed with exit code 1
error: build of `/nix/store/d5n2q11ysprck7aqfwl1j5xa649gl47r-haskell-vty-ghc7.8.3-5.2.2-shared.drv' failed
Hello, maybe this is not a problem in vty
, but the error i get is not very helpful:
tmp $ cabal install vty
Resolving dependencies...
Notice: installing into a sandbox located at /tmp/.cabal-sandbox
Configuring base-orphans-0.3.2...
... omitted ...
Building lens-4.11...
Installed lens-4.11
Configuring vty-5.2.9...
Failed to install vty-5.2.9
Build log ( /tmp/.cabal-sandbox/logs/vty-5.2.9.log ):
cabal: Error: some packages failed to install:
vty-5.2.9 failed during the configure step. The exception was:
user error (The package 'vty' requires Cabal library version -any && >=1.18.0
but no suitable version is installed.)
tmp $ cabal --version
cabal-install version 1.20.0.3
using version 1.20.0.2 of the Cabal library
tmp $ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
I realise that i have quite an old version of the compiler, but maybe that has nothing to do with the problem
When using crop, it is possible that the variable remain_rows in Span.hs gets negative. If you call background_fill afterwards, it tries to use toEnum on this negative value which triggers an exception.
Here is an example that shows the described behavior:
module Test where
import Graphics.Vty
import Text.Printf
import System.IO
loop vt = next_event vt >>= \evt -> case evt of
(EvResize x y) -> loop vt
_ -> return ()
line = string def_attr
list = foldl (<->) empty_image $ map (line . show) [1..10]
img = crop (3, 3) (list <-> background_fill 10 10)
main = do
vt <- mkVty
update vt $ pic_for_image img
loop vt
shutdown vt
This will crash with
test: Enum.toEnum{Word}: tag (-7) is outside of bounds (0,4294967295)
Not sure if it's gnome terminal or vty problem, I didn't find a way to test anything similar with xterm. My gnome terminal is semi-transparent. My program runs with a solid black baground. When exit my program and them do 'less file', the background again goes solid black. When I type 'reset' and do 'less file' it's semi-transparent again. The same code with hscurses instead of vty restores the transparency OK.
Here's the line where I call shutdown:
and the analogous place for the hscurses frontend:
Perhaps related: with hscurses, when I run the program, only the part of the screen I'm writing to gets the black baground, with vty, the whole screen turns black.
Just tried packaging for nix:
Linking dist/build/verify-attribute-opsStub/verify-attribute-opsStub ...
ghc: panic! (the 'impossible' happened)
(GHC version 7.8.3 for x86_64-unknown-linux):
Don't understand library name verify-attribute-ops
Full log at 1.
The package terminfo is reliable but annoying to install and use. The platform specific terminfo library needs to also be installed in addition to the haskell build process being aware of the library (#65).
An alternative is using a pure-haskell terminfo library. One that does not require the platform specific terminfo library:
From Simon Michael: "I expected renderBS to convert a multiline string into an Image of height > 1."
Cursor-hiding appears to be unsupported under OS X using the OS X Terminal application. The following example program is enough to show the behavior:
vty <- mkVty
show_cursor $ terminal vty
set_cursor_pos (terminal vty) 5 5
next_event vty
hide_cursor $ terminal vty
next_event vty
reserve_display $ terminal vty
shutdown vty
See http://cirw.in/blog/bracketed-paste
Would be nice if vty provided an event like EvPaste Text
.
I've been trying to use HEAD from this repo and I just found that, at least in my environment, the recent changes involving fReadBuf have completely broken input. The behavior I see is that keypresses have no immediate effect, although after pressing enough, resizing the terminal, and waiting a little while, I might see some of them come through. They're being received, but something in the event handling loop is waiting for more data.
Would it be possible for vty
to provide a function with this type?
composite :: Picture -> (Int, Int) -> Image
This function would convert the layers in the Picture
to an Image
suitable for composing with other Images
or as a layer in another Picture
, subject to the width and height expectations provided as a parameter.
I am working on a new terminal UI library similar (in spirit) to vty-ui
, and one operation I thought would be cool would be to composite layers as an intermediate step in building interfaces. Specifically I was modifying the Vty Rogue
demo application and thought it would be nice to be able to build a minimap by compositing the player and geography images and then compose that with other images in the UI.
What do you think?
In the first run the test program will exit before reading in the ":" character. In the second run the test program will likely recognize the input as the event "EvKey? (KASCII ':') [MMeta]" Which is different than the sequence of events "EvKey? KEsc []" ; "EvKey? (KASCII ':') []" that was produced without the added delay.
Now I get the converse behaviour: Meta-x is sometimes interpreted as Esc x. This appeared when I installed ubuntu 8.10, so it's hard to track down exactly.
Arguably it's possible that M-x ends up as two separate reads.
I have a patch that fixes this by interpreting Esc x as Meta-x if the delay between the keypresses is less than 1 ms. Of course it's still possible to type as fast as that, so it's not ideal.
The best would be to configure the terminal to send meta codes with the high bit set instead of a separate esc. I'm not sure if this will mess with utf-8 though.
I wrote this https://github.com/angerman/vty-ui-demos/blob/master/input.hs (uses the latest vty-ui) to see which ([modifier], key) event's the application receives. I tested this on OS X with the Terminal application and iTerm2. I did find that tmux and screen do capture some key codes.
Specifically what I found that that pressing Ctrl + Shift together does not yield the information about the shift key.
C-S-[
and C-S-]
are indistinguishable from C-[
and C-]
.
Similarly C-p
and C-n
are indistinguishable from C-S-p
and C-S-n
.
That C-i
results in \t
is probably something Terminal.app specific. I also do not know if it is even possible to reliably tell C-p
and C-S-p
apart, but if this was possible, adding this to vty, or adding some documentation about key events would be a great help!
Thanks!
-- To learn the character sequence your terminal uses, run "cat" and hit the keys. You should see the escape sequence. -- For example, hitting Ctrl+Home under Konsole (a variant of XTerm) might look like: -- $ cat -- ^[[1;5H spec KEsc ?>> char '[' ?>> char 'F' ?>>! moveToEol, -- see /usr/local/etc/joe/joerc, eol, "^[ [ F". spec KEsc ?>> char '[' ?>> char 'H' ?>>! moveToSol, -- home, "^[ [ H". spec KEsc ?>> char '[' ?>> char '1' ?>> char ';' ?>> char '5' ?>> char 'H' ?>>! topB, -- Ctrl + Home spec KEsc ?>> char '[' ?>> char '1' ?>> char ';' ?>> char '5' ?>> char 'F' ?>>! botB, -- Ctrl + End
cf. http://thread.gmane.org/gmane.editors.yi.devel/2789
ctrlCh 'h' ?>>! deleteSel bdeleteB, -- Backspace under xterm
corresponding entry from joerc:
backs ^? Backspace backs ^H
Since there isn't a way to inspect the size of an image other than incrementally trying it until the size is reached, it would be nice to be able to just create a picture and then crop it to the appropriate size. This would also allow renderings to be cached and then cropped for events like scrolling a view.
Probably something like:
data HAlign = Left | HCenter | Right
data VAlign = Top | VCenter | Bottom
crop_image_anchor :: HAlign -> VAlign -> DisplayRegion -> Image -> Image
crop_image :: (Word, Word) -> DisplayRegion -> Image -> Image
Would you be willing to tag releases, e.g., 5.2.10
? That way it becomes much easier to tell when a release is available and how to look for changes in a release in case the CHANGELOG
has not been updated.
On many terminal, lnext is set to ctrl-v and iexten is enabled. (See stty -a) The result of this is that ctrl-v can be used to quote the next character. Apps using vty for input that expect to see ctrl-v (e.g. Yi) then require the user to type c-v twice to get the same effect. (See
for more information.)
To fix this, ExtendedFunctions should be added to the withoutMode list in initTermInput in LLInput.hs.
From: yi-editor/yi#514
There is no equation for mapping the 240 palette down to the 16 or 8 palette. Some code I copied from xterm for the rgb_color can be adopted to make similar reduction operators.
Not sure why it displays nothing tho... I thought it would fall back to default colors.
Lens updated to 4.5, needs dependency bump.
Seems to already be a PR for this.
Probably requires no changes other than cabal file - got Yi to compile against Vty & Lens 4.5 using --allow-newer.
I'm submitting this feature request more to document a need (in LambdaHack) than to really request anything, because I tried to do it and ended with no ideas how to even start and I suspect it's just out of the scope of vty. However, I may be missing something.
I'm afraid, distinguishing the top row number keys and keypad numbers would require reading from the raw keyboard device, since terminals themselves usually don't distinguish the two. It works in gtk just because it does not go through a terminal. The only idea I had was to turn off Num Lock and then the two sets of keys really produce different codes. Unfortunately, the top row number keys have to be distinct also from the combination of numpad keys and Shift, which produces just numbers in the Num Lock off mode. If I could detect that Shift is pressed (as in gtk), that would be it, but I don't think terminal emulators ever pass that information through, do they?
I get this error in my program:
couchnews: internal error: MVAR_CLEAN on mutable list
(GHC version 7.0.2 for x86_64_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
zsh: abort ./couchnews
I stripped it down to a minimal example, available at http://darcsden.com/stulli/couchnews
To reproduce:
I'm not sure if this a vty-ui or a vty error (or even a GHC error).
For usual IO functions, this doesn't matter. I just add liftIO
.
For functions like handlers, which expect and IO
action, this is a problem.
I cannot use my own monad like this.
From Graphics.Vty.LLInput
module:
readAll = do
(bytes, bytes_read) <- fdRead stdInput 1
when (bytes_read > 0) $ do
_ <- tryPutMVar hadInput () -- signal input
writeChan inputChannel (head bytes)
readAll
This causes vty-powered applications crash with Prelude.head: empty list
exception on unicode symbols typed in.
If you have some idea how to fix this I'd like to make a patch.
src/Data/Terminfo/Eval.hs:8:14:
Warning: -XMonoPatBinds is deprecated: Experimental feature now removed; has no effect
[ 1 of 18] Compiling Data.Terminfo.Parse ( src/Data/Terminfo/Parse.hs, dist/build/Data/Terminfo/Parse.o )
[ 2 of 18] Compiling Data.Marshalling ( src/Data/Marshalling.hs, dist/build/Data/Marshalling.o )
[ 3 of 18] Compiling Data.Terminfo.Eval ( src/Data/Terminfo/Eval.hs, dist/build/Data/Terminfo/Eval.o )
src/Data/Terminfo/Eval.hs:170:39:
Couldn't match expected type Foreign.C.Types.CSize' with actual type
Int'
In the return type of a call of fromEnum' In the third argument of
memcpy', namely (fromEnum byte_count)' In the second argument of
($!)', namely
`memcpy out_ptr src_ptr (fromEnum byte_count)'
A trivial fromIntegral should fix this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.