anchor.diff:          member this.PreBackspace handledCommand =
               handledCommand <- false
   
  -            match tryGetCaretPosition this with
  -            | Some caretPos ->
  -                let snapshot = subjectBuffer.CurrentSnapshot
  -
  -                if caretPos.Position > 0 &&
  -                        caretPos.Position - 1 = openingPoint.GetPoint(snapshot).Position &&
  -                        not this.HasForwardTyping then
  -                
  -                    use undo = this.CreateUndoTransaction()
  -                    use edit = subjectBuffer.CreateEdit()
  -
  -                    let span = SnapshotSpan(openingPoint.GetPoint(snapshot), closingPoint.GetPoint(snapshot))
  -
  -                    edit.Delete(span.Span) |> ignore
  -
  -                    if edit.HasFailedChanges then
  -                        edit.Cancel()
  -                        undo.Cancel()
  -                        Debug.Fail("Unable to clear braces")
  -                    else
  -                        // handle the command so the backspace does 
  -                        // not go through since we've already cleared the braces
  -                        handledCommand <- true
  -                        edit.Apply() |> ignore // FIXME: ApplyAndLogExceptions()
  -                        undo.Complete()
  -                        this.EndSession()
  -            | _ -> ()
  +            let caretPos = tryGetCaretPosition this
  +            let snapshot = subjectBuffer.CurrentSnapshot
  +
  +            if caretPos.IsSome && caretPos.Value.Position > 0 && (caretPos.Value.Position - 1) = openingPoint.GetPoint(snapshot).Position && not this.HasForwardTyping then    
  +                use undo = this.CreateUndoTransaction()
  +                use edit = subjectBuffer.CreateEdit()
  +
  +                let span = SnapshotSpan(openingPoint.GetPoint(snapshot), closingPoint.GetPoint(snapshot))
  +
  +                edit.Delete(span.Span) |> ignore
  +
  +                if edit.HasFailedChanges then
  +                    edit.Cancel()
  +                    undo.Cancel()
  +                    Debug.Fail("Unable to clear braces")
  +                else
  +                    // handle the command so the backspace does 
  +                    // not go through since we've already cleared the braces
  +                    handledCommand <- true
  +                    edit.Apply() |> ignore // FIXME: ApplyAndLogExceptions()
  +                    undo.Complete()
  +                    this.EndSession()
              
           member __.PostBackspace() = ()
   
  
positive.code:             Debug.Fail("The closing point was not found at the expected position.")
              this.EndSession()
          else
  
              let openingSnapshotPoint = closingSnapshotPoint.Subtract(1)
  
              if openingSnapshotPoint.GetChar() <> openingBrace then
  
negative.code:                             // exit without setting the closing point which will take us off the stack
                              edit.Cancel()
                              undo.Cancel()
                              None
                          else
                              Some(edit.Apply()) // FIXME: perhaps, it should be ApplyAndLogExceptions()
  
                      match nextSnapshot with
                      | None -> ()
                      | Some(nextSnapshot) ->
  
                          let beforePoint = beforeTrackingPoint.GetPoint(textView.TextSnapshot)
  
                          // switch from positive to negative tracking so it stays against the closing brace
                          closingPoint <- subjectBuffer.CurrentSnapshot.CreateTrackingPoint(closingPoint.GetPoint(nextSnapshot).Position, PointTrackingMode.Negative)
  
                          Debug.Assert(closingPoint.GetPoint(nextSnapshot).Position > 0 && (SnapshotSpan(closingPoint.GetPoint(nextSnapshot).Subtract(1), 1)).GetText().Equals(closingBrace.ToString()),
                              "The closing point does not match the closing brace character")
  
                          // move the caret back between the braces
                          textView.Caret.MoveTo(beforePoint) |> ignore
  
                          session.AfterStart(this, cancellationToken)
  
                          undo.Complete()
  
      member __.HasNoForwardTyping(caretPoint: SnapshotPoint, endPoint: SnapshotPoint) =
          Debug.Assert(caretPoint.Snapshot = endPoint.Snapshot, "snapshots do not match")
  