on master help sign in
cursor should be inside of terminal
bd6a360Yoshikuni Jujo
src/Graphics/Vty.hs+15−4
@@ -92,23 +92,34 @@ intMkVty kvar fend t = do
92
92
93 let inner_update in_pic = do
93 let inner_update in_pic = do
94 b <- display_bounds t
94 b <- display_bounds t
95+ let DisplayRegion w h = b
96+ Cursor x y = pic_cursor in_pic
97+ x' = case x of
98+ _ | x >= 0x80000000 -> 0
99+ | x >= w -> w - 1
100+ | otherwise -> x
101+ y' = case y of
102+ _ | y >= 0x80000000 -> 0
103+ | y >= h -> h - 1
104+ | otherwise -> y
105+ in_pic' = in_pic { pic_cursor = Cursor x' y' }
95 mlast_update <- readIORef last_update_ref
106 mlast_update <- readIORef last_update_ref
96 update_data <- case mlast_update of
107 update_data <- case mlast_update of
97 Nothing -> do
108 Nothing -> do
98 d <- display_context t b
109 d <- display_context t b
99− output_picture d in_pic
110+ output_picture d in_pic'
100 return (b, d)
111 return (b, d)
101 Just (last_bounds, last_context) -> do
112 Just (last_bounds, last_context) -> do
102 if b /= last_bounds
113 if b /= last_bounds
103 then do
114 then do
104 d <- display_context t b
115 d <- display_context t b
105− output_picture d in_pic
116+ output_picture d in_pic'
106 return (b, d)
117 return (b, d)
107 else do
118 else do
108− output_picture last_context in_pic
119+ output_picture last_context in_pic'
109 return (b, last_context)
120 return (b, last_context)
110 writeIORef last_update_ref $ Just update_data
121 writeIORef last_update_ref $ Just update_data
111− writeIORef last_pic_ref $ Just in_pic
122+ writeIORef last_pic_ref $ Just in_pic'
112
123
113 let inner_refresh
124 let inner_refresh
114 = writeIORef last_update_ref Nothing
125 = writeIORef last_update_ref Nothing
vty.cabal+1
@@ -98,6 +98,7 @@ Extra-Source-Files: test/Makefile
98 cbits/mk_wcwidth.c
98 cbits/mk_wcwidth.c
99 cbits/set_term_timing.c
99 cbits/set_term_timing.c
100 cbits/gwinsz.h
100 cbits/gwinsz.h
101+ cbits/output_buffer.h
101
102
102ghc-options: -O2 -funbox-strict-fields -Wall -fno-full-laziness -fspec-constr
103ghc-options: -O2 -funbox-strict-fields -Wall -fno-full-laziness -fspec-constr
103ghc-prof-options: -O2 -funbox-strict-fields -caf-all -Wall -fno-full-laziness -fspec-constr
104ghc-prof-options: -O2 -funbox-strict-fields -caf-all -Wall -fno-full-laziness -fspec-constr