on master help sign in
Hack to work around xterm bug with reseting attributes at start of line.

Ignore-this: e707d3d01f03ee2e4193cb05a551fc94 darcs-hash:20091109075350-f0a0d-636421f51d140ec3e8802af772e8df8b40c5eb48.gz

commit83ec7644a15cc3ee34e7d85bfef22d376a38cc20 authorcoreyoconnor <coreyoconnor@gmail.com> dateSun 8 Nov 2009, 23:53 (17 years ago) parentd506ea5
3 files changed+13
src/Graphics/Vty/Inline.hs+1 src/Graphics/Vty/Terminal/Generic.hs+5 src/Graphics/Vty/Terminal/XTermColor.hs+7
src/Graphics/Vty/Inline.hs+1
@@ -41,6 +41,7 @@ put_default_attr t = do
4141 marshall_to_terminal t ( default_attr_required_bytes d )
4242 ( serialize_default_attr d )
4343 liftIO $ modifyIORef ( state_ref t ) $ \s -> s { known_fattr = Just $ FixedAttr default_style_mask Nothing Nothing }
44+ inline_hack d
4445
4546put_attr_change :: ( Applicative m, MonadIO m ) => TerminalHandle -> AttrChange () -> m ()
4647put_attr_change t c = do
src/Graphics/Vty/Terminal/Generic.hs+5
@@ -147,6 +147,10 @@ class DisplayTerminal d where
147147 default_attr_required_bytes :: d -> Word
148148 serialize_default_attr :: MonadIO m => d -> OutputBuffer -> m OutputBuffer
149149
150+ -- | See Graphics.Vty.Terminal.XTermColor.inline_hack
151+ inline_hack :: MonadIO m => d -> m ()
152+ inline_hack _d = return ()
153+
150154
151155instance DisplayTerminal DisplayHandle where
152156 context_region (DisplayHandle d _ _) = context_region d
@@ -161,6 +165,7 @@ instance DisplayTerminal DisplayHandle where
161165 serialize_set_attr (DisplayHandle d _ _) = serialize_set_attr d
162166 default_attr_required_bytes (DisplayHandle d _ _) = default_attr_required_bytes d
163167 serialize_default_attr (DisplayHandle d _ _) = serialize_default_attr d
168+ inline_hack (DisplayHandle d _ _) = inline_hack d
164169
165170-- | All terminals serialize UTF8 text to the terminal device exactly as serialized in memory.
166171utf8_text_required_bytes :: UTF8 BSCore.ByteString -> Word
src/Graphics/Vty/Terminal/XTermColor.hs+7
@@ -82,3 +82,10 @@ instance DisplayTerminal DisplayContext where
8282 default_attr_required_bytes d = default_attr_required_bytes (super_display d)
8383 serialize_default_attr d = serialize_default_attr (super_display d)
8484
85+ -- I think xterm is broken: Reseting the background color as the first bytes serialized on a new
86+ -- line does not effect the background color xterm uses to clear the line. Which is used *after*
87+ -- the next newline.
88+ inline_hack _d = do
89+ liftIO $ hPutStr stdout "\ESC[K"
90+ liftIO $ hFlush stdout
91+