From f75f8b8d40912bca6f501c2664ef93aa8ec2a9ab Mon Sep 17 00:00:00 2001
From: Scott Sumner <30118311+sasumner@users.noreply.github.com>
Date: Sun, 8 Nov 2020 08:49:28 -0500
Subject: [PATCH] Prevent names of untitled tabs from duplication
Fix #9119, close #9127
---
PowerEditor/installer/nativeLang/english.xml | 1 +
PowerEditor/src/NppIO.cpp | 43 ++++++++++++++------
2 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml
index 4ba4201d..08bdd7f1 100644
--- a/PowerEditor/installer/nativeLang/english.xml
+++ b/PowerEditor/installer/nativeLang/english.xml
@@ -1119,6 +1119,7 @@ Continue?"/>
+
getHSelf(),
+ TEXT("The specified name is already in use on another tab."),
+ TEXT("Rename failed"),
+ MB_OK | MB_ICONSTOP);
+ }
+ else
+ {
+ success = true;
+ buf->setFileName(tabNewName);
+ bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
+ if (isSnapshotMode)
+ {
+ generic_string oldBackUpFile = buf->getBackupFileName();
- // Change the backup file name and let MainFileManager decide the new filename
- buf->setBackupFileName(TEXT(""));
+ // Change the backup file name and let MainFileManager decide the new filename
+ buf->setBackupFileName(TEXT(""));
- // Create new backup
- buf->setModifiedStatus(true);
- bool bRes = MainFileManager.backupCurrentBuffer();
+ // Create new backup
+ buf->setModifiedStatus(true);
+ bool bRes = MainFileManager.backupCurrentBuffer();
- // Delete old backup
- if (bRes)
- ::DeleteFile(oldBackUpFile.c_str());
+ // Delete old backup
+ if (bRes)
+ ::DeleteFile(oldBackUpFile.c_str());
+ }
}
}
}