diff --git a/src/Language/Haskell/Stylish/Util.hs b/src/Language/Haskell/Stylish/Util.hs
--- a/src/Language/Haskell/Stylish/Util.hs
+++ b/src/Language/Haskell/Stylish/Util.hs
@@ -65,11 +65,14 @@
     -- TODO: In order to optimize this, use a difference list instead of a
     -- regular list for 'ls'.
     step (ls, curr, width) str
-        | width' > maxWidth = (ls ++ [curr], indent ind str, ind + len)
-        | otherwise         = (ls, curr ++ " " ++ str, width')
+        | nextLine  = (ls ++ [curr], indent ind str, ind + len)
+        | otherwise = (ls, curr ++ " " ++ str, width')
       where
-        len    = length str
-        width' = width + 1 + len
+        -- Put it on the next line if it would make the current line too long,
+        -- AND if it doesn't make the next line too long.
+        nextLine = width' > maxWidth && ind + len <= maxWidth
+        len      = length str
+        width'   = width + 1 + len
 
 
 --------------------------------------------------------------------------------
diff --git a/stylish-haskell.cabal b/stylish-haskell.cabal
--- a/stylish-haskell.cabal
+++ b/stylish-haskell.cabal
@@ -1,5 +1,5 @@
 Name:          stylish-haskell
-Version:       0.5.2.0
+Version:       0.5.3.0
 Synopsis:      Haskell code prettifier
 Homepage:      https://github.com/jaspervdj/stylish-haskell
 License:       BSD3
diff --git a/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs b/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs
--- a/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs
+++ b/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs
@@ -22,6 +22,7 @@
     , testCase "case 02" case02
     , testCase "case 03" case03
     , testCase "case 04" case04
+    , testCase "case 05" case05
     ]
 
 
@@ -112,3 +113,11 @@
         , "                                   object, parseEither, typeMismatch, (.!=),"
         , "                                   (.:), (.:?), (.=))"
         ]
+
+
+--------------------------------------------------------------------------------
+case05 :: Assertion
+case05 = input' @=? testStep (step 80 Group) input'
+  where
+    input' = "import Distribution.PackageDescription.Configuration " ++
+        "(finalizePackageDescription)\n"
