Skip to content
Permalink
Browse files

Issue #140: Avoid writing the tabs.ini file through WriteString if no…

…thing was effectively changed
  • Loading branch information...
ansgarbecker committed Apr 10, 2019
1 parent af5daca commit a6d372cd386f276af109982ccd529aa3b0da999f
Showing with 7 additions and 2 deletions.
  1. +7 −2 source/main.pas
@@ -2164,13 +2164,18 @@ procedure TMainForm.StoreTabs;
TabsIni := InitTabsIniFile;

// Todo: erase sections from closed tabs
// ab: is that really required? Tabs with deleted files don't get restored anyway.

for Tab in QueryTabs do begin
Tab.BackupUnsavedContent;
Section := Tab.Uid;

if Tab.Memo.GetTextLen > 0 then begin
TabsIni.WriteString(Section, 'BackupFilename', Tab.MemoBackupFilename);
TabsIni.WriteString(Section, 'Filename', Tab.MemoFilename);
// Avoid writing the tabs.ini file through WriteString if nothing was effectively changed
if TabsIni.ReadString(Section, 'BackupFilename', '') <> Tab.MemoBackupFilename then
TabsIni.WriteString(Section, 'BackupFilename', Tab.MemoBackupFilename);
if TabsIni.ReadString(Section, 'Filename', '') <> Tab.MemoFilename then
TabsIni.WriteString(Section, 'Filename', Tab.MemoFilename);
end;
end;

0 comments on commit a6d372c

Please sign in to comment.
You can’t perform that action at this time.