       lastWhitespaceScreenColumn = -1
       lastWhitespaceBufferColumn = -1
       lastWhitespaceWidth = -1
-      lastNonWhitespaceScreenColumn = -1
-      lastNonWhitespaceBufferColumn = -1
+      lastWordEndScreenColumn = -1
+      lastWordEndBufferColumn = -1
       lastWrapBufferColumn = 0
 
       while bufferColumn <= bufferLineLength

            screenLineWidth += indentLength

        if character is ' ' or character is '\t'
          lastWhitespaceScreenColumn = screenColumn
          lastWhitespaceBufferColumn = bufferColumn
          lastWhitespaceWidth = screenLineWidth
        else
          lastNonWhitespaceScreenColumn = screenColumn
          lastNonWhitespaceBufferColumn = bufferColumn

        if foldEndBufferPosition?
          if screenColumn > tokensScreenExtent

          wrapScreenColumn = lastWhitespaceScreenColumn + 1
          wrapBufferColumn = lastWhitespaceBufferColumn + 1
          wrapWidth = lastWhitespaceWidth + 1
          trimmedWhitespaceStartScreenColumn = lastWordEndScreenColumn + 1
          trimmedWhitespaceStartBufferColumn = lastWordEndBufferColumn + 1

          if wrapBufferColumn <= lastWrapBufferColumn
            wrapScreenColumn = screenColumn
