anchor.diff:    end;
   end;
   
  -procedure TEditorFrame.DoSaveHistoryEx(Ed: TATSynEdit; c: TJsonConfig; const path: UnicodeString);
  +procedure TEditorFrame.DoSaveHistory_Caret(Ed: TATSynEdit; c: TJsonConfig; const path: UnicodeString);
   var
     caret: TATCaretItem;
  -  items, items2: TStringList;
  -  bookmark: TATBookmarkItem;
  -  i: integer;
  -begin
  -  if UiOps.HistoryItems[ahhLexer] then
  -    c.SetDeleteValue(path+cHistory_Lexer, LexerName[Ed], '');
  -
  -  if UiOps.HistoryItems[ahhEncoding] then
  -    c.SetValue(path+cHistory_Enc, Ed.EncodingName);
  -
  -  if UiOps.HistoryItems[ahhTopLine] then
  -    c.SetDeleteValue(path+cHistory_Top, Ed.LineTop, 0);
  -
  -  if UiOps.HistoryItems[ahhWordWrap] then
  -    c.SetDeleteValue(path+cHistory_Wrap, Ord(Ed.OptWrapMode), 0);
  -
  -  if not ReadOnlyFromFile then
  -    c.SetDeleteValue(path+cHistory_RO, ReadOnly[Ed], false);
  -
  -  if UiOps.HistoryItems[ahhRuler] then
  -    c.SetDeleteValue(path+cHistory_Ruler, Ed.OptRulerVisible, false);
  -
  -  if UiOps.HistoryItems[ahhMinimap] then
  -    c.SetDeleteValue(path+cHistory_Minimap, Ed.OptMinimapVisible, false);
  -
  -  if UiOps.HistoryItems[ahhMicromap] then
  -    c.SetDeleteValue(path+cHistory_Micromap, Ed.OptMicromapVisible, false);
  -
  -  if UiOps.HistoryItems[ahhTabSize] then
  -  begin
  -    c.SetValue(path+cHistory_TabSize, Ed.OptTabSize);
  -    c.SetValue(path+cHistory_TabSpace, Ed.OptTabSpaces);
  -  end;
  -
  -  if UiOps.HistoryItems[ahhUnprinted] then
  -  begin
  -    c.SetDeleteValue(path+cHistory_Unpri, Ed.OptUnprintedVisible, false);
  -    c.SetDeleteValue(path+cHistory_Unpri_Spaces, Ed.OptUnprintedSpaces, true);
  -    c.SetDeleteValue(path+cHistory_Unpri_Ends, Ed.OptUnprintedEnds, true);
  -    c.SetDeleteValue(path+cHistory_Unpri_Detail, Ed.OptUnprintedEndsDetails, false);
  -  end;
  -
  -  if UiOps.HistoryItems[ahhLineNumbers] then
  -    c.SetDeleteValue(path+cHistory_Nums, Ed.Gutter[Ed.GutterBandNumbers].Visible, true);
  -
  -  if UiOps.HistoryItems[ahhScale] then
  -    c.SetDeleteValue(path+cHistory_Scale, Ed.OptScaleFont, 0);
  -
  -  if UiOps.HistoryItems[ahhFolding] then
  -    c.SetDeleteValue(path+cHistory_Fold, EditorGetFoldString(Ed), '');
  -
  -  if UiOps.HistoryItems[ahhTabColor] then
  -  begin
  -    if TabColor=clNone then
  -      c.DeleteValue(path+cHistory_TabColor)
  -    else
  -      c.SetValue(path+cHistory_TabColor, ColorToString(TabColor));
  -  end;
  -
  -  if UiOps.HistoryItems[ahhCaret] then
  -   if Ed.Carets.Count>0 then
  -   begin
  +begin
  +  if Ed.Carets.Count>0 then
  +  begin
       //note: don't use c.SetDeleteValue here because non-empty value is always needed:
       //app loads file from session and skips history if key is empty
       caret:= Ed.Carets[0];
  
positive.code:       Format('%d,%d,%d,%d,', [caret.PosX, caret.PosY, caret.EndX, caret.EndY])
        );
     end;
  
    if UiOps.HistoryItems[ahhBookmarks] then
    begin
     items:= TStringList.Create;
     items2:= TStringList.Create;
     try
      for i:= 0 to Ed.Strings.Bookmarks.Count-1 do
      begin
        bookmark:= Ed.Strings.Bookmarks[i];
  
negative.code:     else
        c.DeleteValue(path+cHistory_BookmarkKind);
  
    finally
      FreeAndNil(items2);
      FreeAndNil(items);
    end;
  end;
  
  procedure TEditorFrame.DoSaveHistoryEx(Ed: TATSynEdit; c: TJsonConfig; const path: UnicodeString);
  begin
    if UiOps.HistoryItems[ahhLexer] then
      c.SetDeleteValue(path+cHistory_Lexer, LexerName[Ed], '');
  
    if UiOps.HistoryItems[ahhEncoding] then
      c.SetValue(path+cHistory_Enc, Ed.EncodingName);
  
    if UiOps.HistoryItems[ahhTopLine] then
      c.SetDeleteValue(path+cHistory_Top, Ed.LineTop, 0);
  
    if UiOps.HistoryItems[ahhWordWrap] then
      c.SetDeleteValue(path+cHistory_Wrap, Ord(Ed.OptWrapMode), 0);
  
    if not ReadOnlyFromFile then
      c.SetDeleteValue(path+cHistory_RO, ReadOnly[Ed], false);
  
    if UiOps.HistoryItems[ahhRuler] then
      c.SetDeleteValue(path+cHistory_Ruler, Ed.OptRulerVisible, false);
  
    if UiOps.HistoryItems[ahhMinimap] then
      c.SetDeleteValue(path+cHistory_Minimap, Ed.OptMinimapVisible, false);
  
    if UiOps.HistoryItems[ahhMicromap] then
      c.SetDeleteValue(path+cHistory_Micromap, Ed.OptMicromapVisible, false);
  
    if UiOps.HistoryItems[ahhTabSize] then
    begin
      c.SetValue(path+cHistory_TabSize, Ed.OptTabSize);
      c.SetValue(path+cHistory_TabSpace, Ed.OptTabSpaces);
    end;
  
    if UiOps.HistoryItems[ahhUnprinted] then
    begin
      c.SetDeleteValue(path+cHistory_Unpri, Ed.OptUnprintedVisible, false);
      c.SetDeleteValue(path+cHistory_Unpri_Spaces, Ed.OptUnprintedSpaces, true);
      c.SetDeleteValue(path+cHistory_Unpri_Ends, Ed.OptUnprintedEnds, true);
      c.SetDeleteValue(path+cHistory_Unpri_Detail, Ed.OptUnprintedEndsDetails, false);
    end;
  
    if UiOps.HistoryItems[ahhLineNumbers] then
      c.SetDeleteValue(path+cHistory_Nums, Ed.Gutter[Ed.GutterBandNumbers].Visible, true);
  
    if UiOps.HistoryItems[ahhScale] then
      c.SetDeleteValue(path+cHistory_Scale, Ed.OptScaleFont, 0);
  
    if UiOps.HistoryItems[ahhFolding] then
      c.SetDeleteValue(path+cHistory_Fold, EditorGetFoldString(Ed), '');
  
    if UiOps.HistoryItems[ahhTabColor] then
    begin
      if TabColor=clNone then
        c.DeleteValue(path+cHistory_TabColor)
      else
        c.SetValue(path+cHistory_TabColor, ColorToString(TabColor));
    end;
  
    if UiOps.HistoryItems[ahhCaret] then
      DoSaveHistory_Caret(Ed, c, path);
  
    if UiOps.HistoryItems[ahhBookmarks] then
      DoSaveHistory_Bookmarks(Ed, c, path);
  
    if UiOps.HistoryItems[ahhCodeTreeFilter] then
    begin
  