Skip to content

Commit

Permalink
Fix image scroll for iterm2
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervdj committed Feb 10, 2025
1 parent e934d32 commit ce671bd
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/Patat/Images/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ module Patat.Images.Internal


--------------------------------------------------------------------------------
import Control.Exception (Exception)
import qualified Data.Aeson as A
import Data.Data (Data)
import Data.Typeable (Typeable)
import Control.Exception (Exception)
import qualified Data.Aeson as A
import Data.Data (Data)
import qualified Data.List as L
import Data.Typeable (Typeable)
import Patat.Cleanup
import System.Environment
import qualified Data.List as L
import qualified System.IO as IO

--------------------------------------------------------------------------------
data Config a = Auto | Explicit a deriving (Eq)
Expand Down Expand Up @@ -48,4 +49,7 @@ withEscapeSequence f = do
let inScreen = maybe False ("screen" `L.isPrefixOf`) term
putStr $ if inScreen then "\ESCPtmux;\ESC\ESC]" else "\ESC]"
f
putStrLn $ if inScreen then "\a\ESC\\" else "\a"
putStr $ if inScreen then "\a\ESC\\" else "\a"
-- Make sure we don't print a newline after the image, or it may scroll
-- slightly out of view to the top. We flush instead.
IO.hFlush IO.stdout

0 comments on commit ce671bd

Please sign in to comment.