@@ -230,8 +230,11 @@ gridTable opts blocksToDoc headless aligns widths headers rows = do
230 let numcols = maximum (length aligns : length widths :
230 let numcols = maximum (length aligns : length widths :
231 map length (headers:rows))
231 map length (headers:rows))
232 let handleGivenWidths widths' = do
232 let handleGivenWidths widths' = do
233− let widthsInChars' = map ((\x -> x - 3) . floor .
233+ let widthsInChars' = map (
234+ (\x -> if x < 1 then 1 else x) .
235+ (\x -> x - 3) . floor .
234− (fromIntegral (writerColumns opts) *)) widths'
236+ (fromIntegral (writerColumns opts) *)
235 rawHeaders' <- zipWithM blocksToDoc
238 rawHeaders' <- zipWithM blocksToDoc
236 (map (\w -> opts{writerColumns =
239 (map (\w -> opts{writerColumns =
237 min (w - 2) (writerColumns opts)}) widthsInChars')
240 min (w - 2) (writerColumns opts)}) widthsInChars')
@@ -268,11 +271,10 @@ gridTable opts blocksToDoc headless aligns widths headers rows = do
268 let head' = makeRow rawHeaders
271 let head' = makeRow rawHeaders
269 let rows' = map (makeRow . map chomp) rawRows
272 let rows' = map (makeRow . map chomp) rawRows
270 let borderpart ch align widthInChars =
273 let borderpart ch align widthInChars =
271− let widthInChars' = if widthInChars < 1 then 1 else widthInChars
272− in (if (align == AlignLeft || align == AlignCenter)
274+ (if (align == AlignLeft || align == AlignCenter)
273 then char ':'
275 then char ':'
274 else char ch) <>
276 else char ch) <>
275− text (replicate widthInChars' ch) <>
277+ text (replicate widthInChars ch) <>
276 (if (align == AlignRight || align == AlignCenter)
278 (if (align == AlignRight || align == AlignCenter)
277 then char ':'
279 then char ':'
278 else char ch)
280 else char ch)