Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Text/GridTable/Trace.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import Data.List (foldl')
import Data.Maybe (fromMaybe)
import Data.Set (Set)
import Data.Text (Text)
import Text.DocLayout (charWidth)
import Text.DocLayout (charWidth, realLength)
import Text.GridTable.ArrayTable
import qualified Data.Map.Strict as Map
import qualified Data.Set as Set
Expand Down Expand Up @@ -99,7 +99,7 @@ initialTraceInfo = TraceInfo
-- | Converts a list of lines into a char array.
toCharGrid :: [Text] -> CharGrid
toCharGrid lines =
let chars = foldr (\t m -> max m (T.length t)) 0 lines -- potential overcount
let chars = foldr (\t m -> max m (realLength t)) 0 lines -- potential overcount
gbounds = ( (CharRow 1, CharCol 1)
, (CharRow (length lines), CharCol chars)
)
Expand Down
17 changes: 17 additions & 0 deletions test/test-gridtables.hs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,23 @@ gridTableTests = testGroup "parseArrayTable"
, arrayTableColSpecs = defaultAlign [10, 1]
})

, testCase "combined characters" $
let gt = T.unlines
[ "+---+------+"
, "| a | back |"
, "+===+======+"
, "| ø̞ | o̞ |"
, "+---+------+"
]
in parse' gridTable gt @?=
Right (ArrayTable
{ arrayTableCells = listArray ((1,1),(2,2))
[ ContentCell 1 1 [" a "], ContentCell 1 1 [" back "], ContentCell 1 1 [" ø̞ "], ContentCell 1 1 [" o̞ "]]
, arrayTableHead = Just 1
, arrayTableFoot = Nothing
, arrayTableColSpecs = defaultAlign [3, 6]
})

]

, testCase "unterminated row" $
Expand Down
Loading