From f308539abe07b9749c7963e669b838b7e96cd02c Mon Sep 17 00:00:00 2001 From: Scott Sumner <30118311+sasumner@users.noreply.github.com> Date: Sat, 20 Mar 2021 16:53:55 -0400 Subject: [PATCH] SaveAs moves original path to recent files history Fix #9673, close #9678 --- PowerEditor/src/NppIO.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 0ae1b878d..391880d5c 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -1628,6 +1628,9 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy) bufferID = _pEditView->getCurrentBufferID(); Buffer * buf = MainFileManager.getBufferByID(bufferID); + generic_string origPathname = buf->getFullPathName(); + bool wasUntitled = buf->isUntitled(); + CustomFileDialog fDlg(_pPublicInterface->getHSelf()); fDlg.setExtFilter(TEXT("All types"), TEXT(".*")); @@ -1665,6 +1668,10 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy) bool res = doSave(bufferID, fn.c_str(), isSaveCopy); //buf->setNeedsLexing(true); //commented to fix wrapping being removed after save as (due to SCI_CLEARSTYLE or something, seems to be Scintilla bug) //Changing lexer after save seems to work properly + if (!wasUntitled && !isSaveCopy) + { + _lastRecentFileList.add(origPathname.c_str()); + } return res; } else //cannot save, other view has buffer already open, activate it @@ -1679,10 +1686,10 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy) } } else // cancel button is pressed - { - checkModifiedDocument(true); + { + checkModifiedDocument(true); return false; - } + } } bool Notepad_plus::fileRename(BufferID id)