summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorOndřej Janošík <j.ondra14@gmail.com>2015-07-09 10:39:21 +0200
committerOndřej Janošík <j.ondra14@gmail.com>2015-07-09 10:39:21 +0200
commit9246c3c7e26af612a7c9aabf8daf88d17ef836ab (patch)
tree5268a8e2a2f0511e1d5016d41d094795ca2fc42b /src
parent36b68c573bcca27d6e651fb44c520ba88bd31669 (diff)
downloadstylish-haskell-9246c3c7e26af612a7c9aabf8daf88d17ef836ab.tar.gz
Fix for wrapping when max collumn count is set to small number
Wrapper no longer gives up when max collumn count is set to small number and properly wraps items on new lines instead of putting everything on the same line.
Diffstat (limited to 'src')
-rw-r--r--src/Language/Haskell/Stylish/Util.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Language/Haskell/Stylish/Util.hs b/src/Language/Haskell/Stylish/Util.hs
index 51b5df9..6621108 100644
--- a/src/Language/Haskell/Stylish/Util.hs
+++ b/src/Language/Haskell/Stylish/Util.hs
@@ -73,9 +73,8 @@ wrap maxWidth leading ind strs' = wrap' leading strs'
ss : wrapRest maxWidth ind (str:strs)
| otherwise = wrap' (ss ++ " " ++ str) strs
- overflows ss str = (length ss + length str) >= maxWidth
- && ind + length str <= maxWidth
-
+ overflows ss str = length ss > maxWidth ||
+ ((length ss + length str) >= maxWidth && ind + length str <= maxWidth)
--------------------------------------------------------------------------------