     if pattern = @config.get(property, scope: scopeDescriptor)
       new OnigRegExp(pattern)
 
+  # when the previous line matches this pattern than increase indentation of the
+  # current line
   increaseIndentRegexForScopeDescriptor: (scopeDescriptor) ->
     @getRegexForProperty(scopeDescriptor, 'editor.increaseIndentPattern')
 
+  # when the *current* line matches this pattern than decrease indentation of
+  # the current line (this, e.g., puts closing brackets with nothing before them
+  # at the level of the opening statement, as in the KR style for C)
+  decreaseThisIndentRegexForScopeDescriptor: (scopeDescriptor) ->
+    @getRegexForProperty(scopeDescriptor, 'editor.decreaseThisIndentPattern')
+
+  # when the previous line matches this pattern than decrease indentation of the
+  # current line
   decreaseIndentRegexForScopeDescriptor: (scopeDescriptor) ->
     @getRegexForProperty(scopeDescriptor, 'editor.decreaseIndentPattern')
-
-  decreaseNextIndentRegexForScopeDescriptor: (scopeDescriptor) ->
-    @getRegexForProperty(scopeDescriptor, 'editor.decreaseNextIndentPattern')
 
   foldEndRegexForScopeDescriptor: (scopeDescriptor) ->
     @getRegexForProperty(scopeDescriptor, 'editor.foldEndPattern')

    if increaseIndentRegex = @increaseIndentRegexForScopeDescriptor(scopeDescriptor)
      desiredIndentLevel -= 1 unless increaseIndentRegex.testSync(precedingLine)

    if decreaseNextIndentRegex = @decreaseNextIndentRegexForScopeDescriptor(scopeDescriptor)
      desiredIndentLevel -= 1 if decreaseNextIndentRegex.testSync(precedingLine)

    if desiredIndentLevel >= 0 and desiredIndentLevel < currentIndentLevel
      @editor.setIndentationForBufferRow(bufferRow, desiredIndentLevel)



    unless @editor.isBufferRowCommented(precedingRow)
      precedingLine = @buffer.lineForRow(precedingRow)
      tokenizedPrecedingLine =
        @editor.displayBuffer.tokenizedBuffer
        .buildTokenizedLineForRowWithText(precedingRow, precedingLine)

      # console.log "preceding", tokenizedPrecedingLine

      # desiredIndentLevel += 1 if increaseIndentRegex?.testSync(precedingLine)
      if increaseIndentRegex
        desiredIndentLevel += @countRegex(increaseIndentRegex, precedingLine, tokenizedPrecedingLine)
      # desiredIndentLevel -= 1 if decreaseIndentRegex?.testSync(precedingLine)
      if decreaseIndentRegex
        desiredIndentLevel -= @countRegex(decreaseIndentRegex, precedingLine, tokenizedPrecedingLine)
      # we need to add back one if we already closed one scope on the previous line itself
      if decreaseThisIndentRegex and @countRegex(decreaseThisIndentRegex, precedingLine, tokenizedPrecedingLine)
        desiredIndentLevel += 1

    unless @buffer.isRowBlank(precedingRow)
      # desiredIndentLevel -= 1 if decreaseThisIndentRegex?.testSync(line)
      if decreaseThisIndentRegex and @countRegex(decreaseThisIndentRegex, line, tokenizedLine)
        desiredIndentLevel -= 1
      # desiredIndentLevel -= @countRegex(decreaseThisIndentRegex, line) if decreaseThisIndentRegex

    # console.log("suggestedIndentForTokenizedLineAtBufferRow: rtv", desiredIndentLevel)
    Math.max(desiredIndentLevel, 0)

  # Calculate a minimum indent level for a range of lines excluding empty lines.
