 
     deleteLine: ({text, currentRow}) ->
         maxRow = @editSession.getLength()
-        if @editor.getReadOnly() or currentRow >= maxRow - 2
+        if @editor.getReadOnly() or currentRow >= maxRow - @codeSuffixLength
             return
         line = text.getLine currentRow
         if text.getLength() == 1


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


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