         goal.removeBoundary()
         @removeGoal index
 
-    makeCaseAction: (content) -> @getCurrentGoal().then (goal) =>
-        goal.writeLines content
+    makeCaseAction: (content) ->  @protectCursor =>
+        @getCurrentGoalOrWarn().then (goal) =>
+            goal.writeLines content
 
 module.exports = TextBuffer

                goal  = new Goal @core.editor, index, pos.start, pos.end - 2
                @goals.push goal

    giveAction: (index, content) ->
        log 'Text Buffer', "handling give-action #{content}"
        goal = @findGoal index
        if content

            if goals.length is 1
                resolve goals[0]
            else
                reject()

    getCurrentGoalOrWarn: (cursor = @core.editor.getCursorBufferPosition()) ->
        @getCurrentGoal cursor
            .fail =>
                warn 'Text Buffer', 'out of goal'
                @core.panel.outputInfo 'For this command, please place the cursor in a goal'

    warnCurrentGoalIfEmpty: (goal, warning) =>
        content = goal.getContent()
