       '"' + (if @strippedElement.length <= 8 then @strippedElement else
                 (@strippedElement.slice 0, 3) + '..' + (@strippedElement.slice -3)) + '"'
 
-module.exports =
+module.exports = TextManipulation =
   ListElement: ListElement
 
   # Computing the layout for all elements is a bit overkill, but can be optimized later, if necessary.

  constructor: (bufferText, range) ->
    [@start, @end] = range
    element = bufferText.slice @start, @end
    @leadingWhitespace  = (/^\s*/.exec(element) ? [''])[0]
    @trailingWhitespace = (/\s*$/.exec(element) ? [''])[0]
    @eltStart = @start + @leadingWhitespace.length
    @eltEnd = @end - @trailingWhitespace.length
    @strippedElement = bufferText.slice @eltStart, @eltEnd

      when ')' then '('
      else console.error 'Unknown closing bracket \'' + closingBracket + '\''

  getLeadingWhitespace: (text) ->
    (/^\s*/.exec(text) ? [''])[0]

  getTrailingWhitespace: (text) ->
    (/\s*$/.exec(text) ? [''])[0]

  stripLeadingWhitespace: (text) ->
    text.replace(/^\s+/, '')

  stripTrailingWhitespace: (text) ->
    text.replace(/\s+$/, '')
