parent
0405e230eb
commit
f75f8b8d40
@ -1119,6 +1119,7 @@ Continue?"/> <!-- HowToReproduce: when you openned file is modified and saved, t
|
||||
<DocReloadWarning title="Reload" message="Are you sure you want to reload the current file and lose the changes made in Notepad++?"/>
|
||||
<FileLockedWarning title="Save failed" message="Please check whether if this file is opened in another program"/>
|
||||
<FileAlreadyOpenedInNpp title="" message="The file is already opened in Notepad++."/> <!-- HowToReproduce: Open a new document and open a file "c:/tmp/foo", save this new document by choosing "c:/tmp/foo" as file to save, reply the override popup "yes", then this message appears. -->
|
||||
<RenameTabTemporaryNameAlreadyInUse title="Rename failed" message="The specified name is already in use on another tab."/> <!-- HowToReproduce: Rename the tab of an untitled document and provide a name that is the same as an already-existing tab of an untitled document. -->
|
||||
<DeleteFileFailed title="Delete File" message="Delete File failed"/> <!-- HowToReproduce: this message prevents from system failure. It's hard to reproduce. -->
|
||||
|
||||
<NbFileToOpenImportantWarning title="Amount of files to open is too large" message="$INT_REPLACE$ files are about to be opened.
|
||||
|
@ -1741,23 +1741,40 @@ bool Notepad_plus::fileRename(BufferID id)
|
||||
TCHAR *tabNewName = reinterpret_cast<TCHAR *>(strDlg.doDialog());
|
||||
if (tabNewName)
|
||||
{
|
||||
success = true;
|
||||
buf->setFileName(tabNewName);
|
||||
bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
|
||||
if (isSnapshotMode)
|
||||
BufferID sameNamedBufferId = _pDocTab->findBufferByName(tabNewName);
|
||||
if (sameNamedBufferId == BUFFER_INVALID)
|
||||
{
|
||||
generic_string oldBackUpFile = buf->getBackupFileName();
|
||||
sameNamedBufferId = _pNonDocTab->findBufferByName(tabNewName);
|
||||
}
|
||||
|
||||
if (sameNamedBufferId != BUFFER_INVALID)
|
||||
{
|
||||
_nativeLangSpeaker.messageBox("RenameTabTemporaryNameAlreadyInUse",
|
||||
_pPublicInterface->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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user