Fix bug: hide lines not working right when closing.

Fix bug: Files not in recent list on exit and no session saved.
Fix bug: bad copy/pate code in getCurrentOpenedFiles.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@278 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
harrybharry 2008-07-08 16:03:40 +00:00
parent 8fb47c3ba1
commit 1338ac4fe5
3 changed files with 33 additions and 19 deletions

View File

@ -7599,14 +7599,15 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
fullScreenToggle();
const NppGUI & nppgui = pNppParam->getNppGUI();
_lastRecentFileList.setLock(true);
if (_configStyleDlg.isCreated() && ::IsWindowVisible(_configStyleDlg.getHSelf()))
_configStyleDlg.restoreGlobalOverrideValues();
Session currentSession;
if (nppgui._rememberLastSession)
if (nppgui._rememberLastSession) {
getCurrentOpenedFiles(currentSession);
_lastRecentFileList.setLock(true); //only lock when the session is remembered
}
if (fileCloseAll())
{
@ -8179,8 +8180,9 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
session._activeSubIndex = _subDocTab.getCurrentTabIndex();
//Use _invisibleEditView to temporarily open documents to retrieve markers
Buffer * mainBuf = _mainEditView.getCurrentBuffer();
Buffer * subBuf = _subEditView.getCurrentBuffer();
//Buffer * mainBuf = _mainEditView.getCurrentBuffer();
//Buffer * subBuf = _subEditView.getCurrentBuffer();
Document oldDoc = _invisibleEditView.execute(SCI_GETDOCPOINTER);
for (int i = 0 ; i < _mainDocTab.nbItem() ; i++)
{
@ -8194,11 +8196,11 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
sessionFileInfo sfi(buf->getFilePath(), langName, buf->getPosition(&_mainEditView));
//_mainEditView.activateBuffer(buf->getID());
_mainEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
int maxLine = _mainEditView.execute(SCI_GETLINECOUNT);
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
int maxLine = _invisibleEditView.execute(SCI_GETLINECOUNT);
for (int j = 0 ; j < maxLine ; j++)
{
if ((_mainEditView.execute(SCI_MARKERGET, j)&(1 << MARK_BOOKMARK)) != 0)
if ((_invisibleEditView.execute(SCI_MARKERGET, j)&(1 << MARK_BOOKMARK)) != 0)
{
sfi.marks.push_back(j);
}
@ -8218,11 +8220,11 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
sessionFileInfo sfi(buf->getFilePath(), langName, buf->getPosition(&_subEditView));
_subEditView.activateBuffer(buf->getID());
int maxLine = _subEditView.execute(SCI_GETLINECOUNT);
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
int maxLine = _invisibleEditView.execute(SCI_GETLINECOUNT);
for (int j = 0 ; j < maxLine ; j++)
{
if ((_subEditView.execute(SCI_MARKERGET, j)&(1 << MARK_BOOKMARK)) != 0)
if ((_invisibleEditView.execute(SCI_MARKERGET, j)&(1 << MARK_BOOKMARK)) != 0)
{
sfi.marks.push_back(j);
}
@ -8233,10 +8235,12 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
//_mainEditView.activateBuffer(mainBuf->getID()); //restore buffer
//_subEditView.activateBuffer(subBuf->getID()); //restore buffer
_mainEditView.execute(SCI_SETDOCPOINTER, 0, mainBuf->getDocument());
_mainEditView.restoreCurrentPos();
_subEditView.execute(SCI_SETDOCPOINTER, 0, subBuf->getDocument());
_subEditView.restoreCurrentPos();
//_mainEditView.execute(SCI_SETDOCPOINTER, 0, mainBuf->getDocument());
//_mainEditView.restoreCurrentPos();
//_subEditView.execute(SCI_SETDOCPOINTER, 0, subBuf->getDocument());
//_subEditView.restoreCurrentPos();
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, oldDoc);
}
bool Notepad_plus::fileLoadSession(const char *fn)

View File

@ -305,8 +305,16 @@ int Buffer::removeReference(ScintillaEditView * identifier) {
}
void Buffer::setHideLineChanged(bool isHide, int location) {
//First run through all docs without removing markers
for(int i = 0; i < _references; i++) {
_referees.at(i)->notifyMarkers(this, isHide, location, (i == _references-1));
_referees.at(i)->notifyMarkers(this, isHide, location, false);//(i == _references-1));
}
if (!isHide) { //no deleting if hiding lines
//Then all docs to remove markers.
for(int i = 0; i < _references; i++) {
_referees.at(i)->notifyMarkers(this, isHide, location, true);
}
}
}
void Buffer::setDeferredReload() { //triggers a reload on the next Document access

View File

@ -1881,7 +1881,7 @@ void ScintillaEditView::runMarkers(bool doHide, int searchStart, bool endOfDoc,
if ( ((state & (1 << MARK_HIDELINESEND)) != 0) ) {
if (doDelete)
execute(SCI_MARKERDELETE, i, MARK_HIDELINESEND);
if (isInSection) {
else if (isInSection) {
if (startShowing >= i) { //because of fold skipping, we passed the close tag. In that case we cant do anything
if (!endOfDoc) {
return;
@ -1893,14 +1893,16 @@ void ScintillaEditView::runMarkers(bool doHide, int searchStart, bool endOfDoc,
if (!endOfDoc) {
return; //done, only single section requested
} //otherwise keep going
isInSection = false;
}
isInSection = false;
}
if ( ((state & (1 << MARK_HIDELINESBEGIN)) != 0) ) {
isInSection = true;
startShowing = i+1;
if (doDelete)
execute(SCI_MARKERDELETE, i, MARK_HIDELINESBEGIN);
else {
isInSection = true;
startShowing = i+1;
}
}
int levelLine = execute(SCI_GETFOLDLEVEL, i, 0);