on master help sign in
hm. remove the hFlush from output_byte_buffer.

Ignore-this: 6b564f9e1156eb98f43a594658a700ff darcs-hash:20100812200035-f0a0d-6e288a1caf6e3fa06a1a2734fe52de3ae6403a2f.gz

commitdbc218c7ea651ce949665612821c68c89fb54702 authorcoreyoconnor <coreyoconnor@gmail.com> dateThu 12 Aug 2010, 13:00 (16 years ago) parentbcda3db
5 files changed+20−5
src/Graphics/Vty/Inline.hs+4 src/Graphics/Vty/Terminal/TerminfoBased.hs+3−1 src/Graphics/Vty/Terminal/XTermColor.hs+8−3 test/Makefile+1−1 test/interactive_terminal_test.hs+4
src/Graphics/Vty/Inline.hs+4
@@ -16,6 +16,8 @@ import qualified Data.String.UTF8 as UTF8
1616import Data.IORef
1717import Data.Monoid ( mappend )
1818
19+import System.IO
20+
1921type InlineM v = State Attr v
2022
2123back_color :: Color -> InlineM ()
@@ -52,6 +54,7 @@ put_attr_change t c = do
5254 attr' = limit_attr_for_display d attr
5355 fattr' = fix_display_attr fattr attr'
5456 diffs = display_attr_diffs fattr fattr'
57+ liftIO $ hFlush stdout
5558 liftIO $ marshall_to_terminal t ( attr_required_bytes d fattr attr' diffs )
5659 ( serialize_set_attr d fattr attr' diffs )
5760 liftIO $ modifyIORef ( state_ref t ) $ \s -> s { known_fattr = Just fattr' }
@@ -60,6 +63,7 @@ put_attr_change t c = do
6063put_string :: ( Applicative m, MonadIO m ) => TerminalHandle -> String -> m ()
6164put_string t s = do
6265 let s_utf8 = UTF8.fromString s
66+ liftIO $ hFlush stdout
6367 liftIO $ marshall_to_terminal t ( utf8_text_required_bytes s_utf8)
6468 ( serialize_utf8_text s_utf8 )
6569
src/Graphics/Vty/Terminal/TerminfoBased.hs+3−1
@@ -146,6 +146,7 @@ instance Terminal Term where
146146 -- Screen on OS X does not appear to support smcup?
147147 -- To approximate the expected behavior: clear the screen and then move the mouse to the
148148 -- home position.
149+ liftIO $ hFlush stdout
149150 liftIO $ marshall_cap_to_terminal t clear_screen []
150151 return ()
151152
@@ -171,9 +172,10 @@ instance Terminal Term where
171172
172173 -- Output the byte buffer of the specified size to the terminal device.
173174 output_byte_buffer t out_ptr out_byte_count = do
175+ -- if the out fd is actually the same as stdout's then a
174176 -- flush is required *before* the c_output_byte_buffer call
175177 -- otherwise there may still be data in GHC's internal stdout buffer.
176− hFlush stdout
178+ -- _ <- handleToFd stdout
177179 let Fd c_fd = term_fd t
178180 if out_byte_count /= 0
179181 then c_output_byte_buffer c_fd out_ptr ( toEnum $! fromEnum out_byte_count )
src/Graphics/Vty/Terminal/XTermColor.hs+8−3
@@ -14,6 +14,8 @@ import qualified Graphics.Vty.Terminal.TerminfoBased as TerminfoBased
1414import Control.Applicative
1515import Control.Monad.Trans
1616
17+import qualified Data.String.UTF8 as UTF8
18+
1719import System.IO
1820
1921data XTermColor = XTermColor
@@ -88,7 +90,10 @@ instance DisplayTerminal DisplayContext where
8890 -- I think xterm is broken: Reseting the background color as the first bytes serialized on a new
8991 -- line does not effect the background color xterm uses to clear the line. Which is used *after*
9092 -- the next newline.
91− inline_hack _d = do
92− liftIO $ hPutStr stdout "\ESC[K"
93− liftIO $ hFlush stdout
93+ inline_hack d = do
94+ let t = case super_display d of
95+ DisplayHandle _ t_ _ -> t_
96+ let s_utf8 = UTF8.fromString "\ESC[K"
97+ liftIO $ marshall_to_terminal t ( utf8_text_required_bytes s_utf8)
98+ ( serialize_utf8_text s_utf8 )
9499
test/Makefile+1−1
@@ -26,7 +26,7 @@ $(VERIF_TESTS)
2626$(shell mkdir -p objects )
2727
2828# TODO: Tests should also be buildable referencing the currently installed vty
29−GHC_ARGS=--make -i../src -package parallel -package deepseq-1.1.0.0 -hide-package transformers -hide-package monads-fd -hide-package monads-tf -package QuickCheck-2.1.0.3 -ignore-package vty ../cbits/gwinsz.c ../cbits/output_buffer.c ../cbits/set_term_timing.c ../cbits/mk_wcwidth.c -O -funbox-strict-fields -Wall -threaded -fno-full-laziness -fspec-constr -odir objects -hidir objects
29+GHC_ARGS=--make -i../src -package parallel -package deepseq-1.1.0.0 -hide-package transformers -hide-package monads-fd -hide-package monads-tf -package QuickCheck-2.1.1.1 -ignore-package vty ../cbits/gwinsz.c ../cbits/output_buffer.c ../cbits/set_term_timing.c ../cbits/mk_wcwidth.c -O -funbox-strict-fields -Wall -threaded -fno-full-laziness -fspec-constr -odir objects -hidir objects
3030
3131GHC_PROF_ARGS=-prof -auto-all $(GHC_ARGS)
3232
test/interactive_terminal_test.hs+4
@@ -238,8 +238,10 @@ display_bounds_test_1 = Test
238238 forM_ [1 .. h - 2] $ \y -> do
239239 set_cursor_pos t 0 y
240240 putStr "X"
241+ hFlush stdout
241242 set_cursor_pos t (w - 1) y
242243 putStr "X"
244+ hFlush stdout
243245 set_cursor_pos t 0 (h - 1)
244246 let row_h = replicate (fromEnum w - 1) 'X'
245247 putStr row_h
@@ -289,8 +291,10 @@ display_bounds_test_3 = Test
289291 forM_ [1 .. h - 2] $ \y -> do
290292 set_cursor_pos t 0 y
291293 putStr "X"
294+ hFlush stdout
292295 set_cursor_pos t (w - 1) y
293296 putStr "X"
297+ hFlush stdout
294298 set_cursor_pos t 0 (h - 1)
295299 let row_h = row_0
296300 putStr row_h