summaryrefslogtreecommitdiff
path: root/programs/TextWrapDemo.hs
blob: f69a81dfb222d0a6280815714bff0b5793d96606 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{-# LANGUAGE CPP #-}
module Main where

#if !(MIN_VERSION_base(4,11,0))
import Data.Monoid ((<>))
#endif
import Brick
import Text.Wrap (defaultWrapSettings, preserveIndentation)

ui :: Widget ()
ui =
    t1 <=> (padTop (Pad 1) t2)
    where
      t1 = strWrap $ "Hello, world! This line is long enough that " <>
                     "it's likely to wrap on your terminal if your window " <>
                     "isn't especially wide. Try narrowing and widening " <>
                     "the window to see what happens to this text."
      settings = defaultWrapSettings { preserveIndentation = True }
      t2 = strWrapWith settings $
          "This text wraps\n" <>
          "   with different settings to preserve indentation\n" <>
          "   so that long lines wrap in nicer way."

main :: IO ()
main = simpleMain ui