@@ -230,8 +230,11 @@ gridTable opts blocksToDoc headless aligns widths headers rows = do
230230 let numcols = maximum (length aligns : length widths :
231231 map length (headers:rows))
232232 let handleGivenWidths widths' = do
233− let widthsInChars' = map ((\x -> x - 3) . floor .
234− (fromIntegral (writerColumns opts) *)) widths'
233+ let widthsInChars' = map (
234+ (\x -> if x < 1 then 1 else x) .
235+ (\x -> x - 3) . floor .
236+ (fromIntegral (writerColumns opts) *)
237+ ) widths'
235238 rawHeaders' <- zipWithM blocksToDoc
236239 (map (\w -> opts{writerColumns =
237240 min (w - 2) (writerColumns opts)}) widthsInChars')
@@ -268,11 +271,10 @@ gridTable opts blocksToDoc headless aligns widths headers rows = do
268271 let head' = makeRow rawHeaders
269272 let rows' = map (makeRow . map chomp) rawRows
270273 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)
273275 then char ':'
274276 else char ch) <>
275− text (replicate widthInChars' ch) <>
277+ text (replicate widthInChars ch) <>
276278 (if (align == AlignRight || align == AlignCenter)
277279 then char ':'
278280 else char ch)