anchor.diff:  
       Result:= true;
     end;
  -  Ed.Strings.EndUndoGroup;
  +  St.EndUndoGroup;
   
     if Result then
     begin
       Ed.Modified:= true;
  +    Ed.DoEventChange(NLineChanged);
       Ed.Update(true);
     end;
   end;
  
positive.code:   //cancel vertical selection
    Ed.DoSelect_ClearColumnBlock;
  
    Ed.Strings.BeginUndoGroup;
    for NCaret:= Ed.Carets.Count-1 downto 0 do
    begin
      Caret:= Ed.Carets[NCaret];
      if not Ed.Strings.IsIndexValid(Caret.PosY) then Continue;
      Caret.GetRange(X1, Y1, X2, Y2, bSel);
      bBackwardSel:= not Caret.IsForwardSelection;
  
      if not bSel then
        if not EditorAutoCloseBracket_NeedPair(Ed, Caret, bQuoteChar) then Continue;
  
      if not bSel then
      begin
        Ed.Strings.TextInsert(X1, Y1, CharBegin+CharEnd, false, Shift, PosAfter);
        Ed.DoCaretsShift(NCaret, X1, Y1, Shift.X, Shift.Y, PosAfter);
  
        Caret.PosX:= Caret.PosX+1;
  
negative.code:       bQuoteChar:= false;
    end;
  
    St:= Ed.Strings;
    NLineChanged:= St.Count-1;
  
    //make additional loop, to detect that ALL carets need pairing.
    //if at least one caret doesn't need, stop.
    //it's needed to make pair for all or nothing. issue #3219.
    for NCaret:= Ed.Carets.Count-1 downto 0 do
    begin
      Caret:= Ed.Carets[NCaret];
      if not St.IsIndexValid(Caret.PosY) then Continue;
      if Caret.EndY<0 then
        if not EditorAutoCloseBracket_NeedPair(Ed, Caret, bQuoteChar) then
          exit;
  