[BUG_FIXED] Fix SaveAll command hanging issue while session snapshot is enabled.

[CHANGE_BEHAVIOUR] Disable session snapshot while command line -nosession is used.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1240 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/trunk
Don Ho 11 years ago
parent 924dc4d4ef
commit 4ab4945f0a

@ -128,7 +128,7 @@ Notepad_plus::Notepad_plus(): _mainWindowStatus(0), _pDocTab(NULL), _pEditView(N
_linkTriggered(true), _isHotspotDblClicked(false), _isFolding(false),
_sysMenuEntering(false),
_autoCompleteMain(&_mainEditView), _autoCompleteSub(&_subEditView), _smartHighlighter(&_findReplaceDlg),
_isFileOpening(false), _rememberThisSession(true), _pAnsiCharPanel(NULL), _pClipboardHistoryPanel(NULL)
_isFileOpening(false), _pAnsiCharPanel(NULL), _pClipboardHistoryPanel(NULL)
{
ZeroMemory(&_prevSelectedRange, sizeof(_prevSelectedRange));

@ -422,8 +422,6 @@ private:
vector<pair<int, int> > _hideLinesMarks;
StyleArray _hotspotStyles;
bool _rememberThisSession; // always true. except -nosession is indicated on the launch time
AnsiCharPanel *_pAnsiCharPanel;
ClipboardHistoryPanel *_pClipboardHistoryPanel;

@ -63,7 +63,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
::SystemParametersInfo(SPI_GETWORKAREA, 0, &workAreaRect, 0);
NppParameters *pNppParams = NppParameters::getInstance();
const NppGUI & nppGUI = pNppParams->getNppGUI();
NppGUI & nppGUI = (NppGUI &)pNppParams->getNppGUI();
if (cmdLineParams->_isNoPlugin)
_notepad_plus_plus_core._pluginsManager.disable();
@ -131,7 +131,8 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
{
::SendMessage(_hSelf, WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0);
}
_notepad_plus_plus_core._rememberThisSession = !cmdLineParams->_isNoSession;
nppGUI._isCmdlineNosessionActivated = cmdLineParams->_isNoSession;
if (nppGUI._rememberLastSession && !cmdLineParams->_isNoSession)
{
_notepad_plus_plus_core.loadLastSession();

@ -474,7 +474,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{
CmdLineParams *cmdLineParam = (CmdLineParams *)pCopyData->lpData;
pNppParam->setCmdlineParam(*cmdLineParam);
_rememberThisSession = !cmdLineParam->_isNoSession;
NppGUI nppGui = (NppGUI)pNppParam->getNppGUI();
nppGui._isCmdlineNosessionActivated = cmdLineParam->_isNoSession;
break;
}
@ -530,7 +531,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_SAVECURRENTSESSION:
{
NppParameters *nppParam = NppParameters::getInstance();
if (nppParam->getNppGUI()._rememberLastSession && _rememberThisSession)
const NppGUI nppGui = nppParam->getNppGUI();
if (nppGui._rememberLastSession && !nppGui._isCmdlineNosessionActivated)
{
Session currentSession;
getCurrentOpenedFiles(currentSession, true);
@ -1472,7 +1475,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
saveUserDefineLangs();
saveShortcuts();
if (nppgui._rememberLastSession && _rememberThisSession)
if (nppgui._rememberLastSession && !nppgui._isCmdlineNosessionActivated)
saveSession(currentSession);
//Sends WM_DESTROY, Notepad++ will end

@ -109,16 +109,6 @@ BOOL Notepad_plus::notify(SCNotification *notification)
}
bool isDirty = notification->nmhdr.code == SCN_SAVEPOINTLEFT;
buf->setDirty(isDirty);
if (notification->nmhdr.code == SCN_SAVEPOINTREACHED)
{
bool isSnapshotMode = NppParameters::getInstance()->getNppGUI().isSnapshotMode();
if (isSnapshotMode)
{
MainFileManager->backupCurrentBuffer();
}
}
break;
}

@ -709,7 +709,7 @@ struct NppGUI
_tabStatus(TAB_DRAWTOPBAR | TAB_DRAWINACTIVETAB | TAB_DRAGNDROP), _splitterPos(POS_HORIZOTAL),\
_userDefineDlgStatus(UDD_DOCKED), _tabSize(8), _tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _fileAutoDetectionOriginalValue(_fileAutoDetection),\
_checkHistoryFiles(true) ,_enableSmartHilite(true), _disableSmartHiliteTmp(false), _enableTagsMatchHilite(true), _enableTagAttrsHilite(true), _enableHiliteNonHTMLZone(false),\
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _detectEncoding(true), _backup(bak_none), _useDir(false), _backupDir(TEXT("")),\
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _isCmdlineNosessionActivated(false), _detectEncoding(true), _backup(bak_none), _useDir(false), _backupDir(TEXT("")),\
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
_autocStatus(autoc_both), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),\
@ -752,7 +752,8 @@ struct NppGUI
bool _isMaximized;
bool _isMinimizedToTray;
bool _rememberLastSession;
bool _rememberLastSession; // remember next session boolean will be written in the settings
bool _isCmdlineNosessionActivated; // used for if -nosession is indicated on the launch time
bool _detectEncoding;
bool _doTaskList;
bool _maitainIndent;
@ -815,7 +816,7 @@ struct NppGUI
generic_string _themeName;
MultiInstSetting _multiInstSetting;
bool _fileSwitcherWithoutExtColumn;
bool isSnapshotMode() const {return _isSnapshotMode && _rememberLastSession;};
bool isSnapshotMode() const {return _isSnapshotMode && _rememberLastSession && !_isCmdlineNosessionActivated;};
bool _isSnapshotMode;
size_t _snapshotBackupTiming;
};

Loading…
Cancel
Save