   # called when repeated
   repeatInsert: (selection, text) ->
     selection.insertText(text, autoIndent: true)
+
+  getInsertionCount: ->
+    @insertionCount ?= if @supportInsertionCount then (@getCount() - 1) else 0
+    @insertionCount
 
   execute: ->
     if @isRepeated()

    range = getNewTextRangeFromCheckpoint(@editor, @getCheckpoint(purpose))
    fn(range) if range?

  repeatInsertCountTimes: (count) ->
    @withAddedBufferRangeFromCheckpoint 'undo', (range) =>
      text = @editor.getTextInBufferRange(range)
      _.times count, =>
        for selection in @editor.getSelections()
          selection.insertText(text, autoIndent: true)

  observeWillDeactivateMode: ->
    # Need to preserve here since count is reset on operationStack::process finished()
    count = @getCount() - 1
    disposable = @vimState.modeManager.preemptWillDeactivateMode ({mode}) =>
      return unless mode is 'insert'
      disposable.dispose()

      @vimState.mark.set('^', @editor.getCursorBufferPosition())
      text = ''
      @withAddedBufferRangeFromCheckpoint 'insert', (range) =>
        # Marker can track following extra insert incase count specified
        @setMarkForChange(range)
        text = @editor.getTextInBufferRange(range)
        @saveInsertedText(text)
        @vimState.register.set('.', {text})

      if @supportInsertionCount and count > 0
        @repeatInsertCountTimes(count)

      # grouping changes for undo checkpoint need to come last
      @editor.groupChangesSinceCheckpoint(@getCheckpoint('undo'))

  @extend()
  target: 'MoveToNextFoldStart'

class InsertAboveWithNewline extends ActivateInsertMode
  @extend()
  execute: ->
