Fixed saved duplicated file in the same view issue

While D:\test.txt has been opend. And open new Tab (new 1), add random text then save
it as D:\test.txt - 2 different tabs having same file opened and they could have
different content.

The fix checks for opened file existence only in the other view
(either in sub view or in main view), but does not check in same view.

Fixes #3384, Closes #3500
This commit is contained in:
SinghRajenM 2017-07-08 00:43:11 +05:30 committed by Don HO
parent 50c2a300e7
commit feff20893f
1 changed files with 5 additions and 2 deletions

View File

@ -1328,8 +1328,11 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
if (pfn)
{
BufferID other = _pNonDocTab->findBufferByName(pfn);
if (other == BUFFER_INVALID) //can save, other view doesnt contain buffer
BufferID other = _pDocTab->findBufferByName(pfn);
if (other == BUFFER_INVALID)
other = _pNonDocTab->findBufferByName(pfn);
if (other == BUFFER_INVALID) //can save, as both (same and other) view don't contain buffer
{
bool res = doSave(bufferID, pfn, isSaveCopy);
//buf->setNeedsLexing(true); //commented to fix wrapping being removed after save as (due to SCI_CLEARSTYLE or something, seems to be Scintilla bug)