 
     insertLine: ({text, line, currentRow}) ->
         maxRow = @editSession.getLength()
-        if currentRow + 1 <= 3 or currentRow + 1 >= maxRow - 2
+        if currentRow + 1 <= 3 or currentRow + 1 >= maxRow - @codeSuffixLength
             return
         inputsDiv = jQuery('#insertButtons')
 

                public static void main(String[] args) {\n
                """
        codeSuffix = '    }\n}'
        unless codeText.startsWith codePrefix
            tab = @editSession.getTabString()
            tab += tab


    switchDown: ({currentRow, currentColumn}) ->
        maxRow = @editSession.getLength()
        if @editor.getReadOnly() or currentRow + 1 >= maxRow - @codeSuffixLength
            return
        if currentRow < maxRow - 1
            @editSession.moveLinesDown(currentRow, currentRow)
