mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 06:45:27 +02:00
[BUG_FIXED] Fix folding bugs while deleting the begin/end folding keywords.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@126 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
53f1dbfc19
commit
fd383d3b55
@ -1549,6 +1549,11 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
_isDocModifing = true;
|
_isDocModifing = true;
|
||||||
::InvalidateRect(_pEditView->getHSelf(), NULL, TRUE);
|
::InvalidateRect(_pEditView->getHSelf(), NULL, TRUE);
|
||||||
}
|
}
|
||||||
|
if (notification->modificationType & SC_MOD_CHANGEFOLD)
|
||||||
|
{
|
||||||
|
_pEditView->foldChanged(notification->line,
|
||||||
|
notification->foldLevelNow, notification->foldLevelPrev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1986,7 +1991,19 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
_isHotspotDblClicked = true;
|
_isHotspotDblClicked = true;
|
||||||
_pEditView->execute(SCI_SETCHARSDEFAULT);
|
_pEditView->execute(SCI_SETCHARSDEFAULT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SCN_NEEDSHOWN :
|
||||||
|
{
|
||||||
|
int begin = _pEditView->execute(SCI_LINEFROMPOSITION, notification->position);
|
||||||
|
int end = _pEditView->execute(SCI_LINEFROMPOSITION, notification->position + notification->length);
|
||||||
|
int firstLine = begin < end ? begin : end;
|
||||||
|
int lastLine = begin > end ? begin : end;
|
||||||
|
for (int line = firstLine; line <= lastLine; line++) {
|
||||||
|
_pEditView->execute(SCI_ENSUREVISIBLE, line, 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default :
|
default :
|
||||||
break;
|
break;
|
||||||
|
@ -660,9 +660,12 @@ private:
|
|||||||
void checkLangsMenu(int id) const ;
|
void checkLangsMenu(int id) const ;
|
||||||
|
|
||||||
void setLanguage(int id, LangType langType) {
|
void setLanguage(int id, LangType langType) {
|
||||||
_pEditView->setCurrentDocType(langType);
|
if (_pEditView->setCurrentDocType(langType))
|
||||||
setLangStatus(langType);
|
{
|
||||||
checkLangsMenu(id);
|
_pEditView->foldAll(fold_uncollapse);
|
||||||
|
setLangStatus(langType);
|
||||||
|
checkLangsMenu(id);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int getToolBarState() const {
|
int getToolBarState() const {
|
||||||
|
@ -1723,4 +1723,35 @@ void ScintillaEditView::recalcHorizontalScrollbar()
|
|||||||
int currentLength = execute(SCI_GETSCROLLWIDTH); //Get current scrollbar size
|
int currentLength = execute(SCI_GETSCROLLWIDTH); //Get current scrollbar size
|
||||||
if (currentLength != maxPixel) //And if it is not the same
|
if (currentLength != maxPixel) //And if it is not the same
|
||||||
execute(SCI_SETSCROLLWIDTH, maxPixel); //update it
|
execute(SCI_SETSCROLLWIDTH, maxPixel); //update it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScintillaEditView::foldChanged(int line, int levelNow, int levelPrev)
|
||||||
|
{
|
||||||
|
if (levelNow & SC_FOLDLEVELHEADERFLAG)
|
||||||
|
{
|
||||||
|
if (!(levelPrev & SC_FOLDLEVELHEADERFLAG))
|
||||||
|
{
|
||||||
|
// Adding a fold point.
|
||||||
|
execute(SCI_SETFOLDEXPANDED, line, 1);
|
||||||
|
expand(line, true, false, 0, levelPrev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (levelPrev & SC_FOLDLEVELHEADERFLAG)
|
||||||
|
{
|
||||||
|
if (!execute(SCI_GETFOLDEXPANDED, line))
|
||||||
|
{
|
||||||
|
// Removing the fold from one that has been contracted so should expand
|
||||||
|
// otherwise lines are left invisible with no way to make them visible
|
||||||
|
execute(SCI_SETFOLDEXPANDED, line, 1);
|
||||||
|
expand(line, true, false, 0, levelPrev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!(levelNow & SC_FOLDLEVELWHITEFLAG) &&
|
||||||
|
((levelPrev & SC_FOLDLEVELNUMBERMASK) > (levelNow & SC_FOLDLEVELNUMBERMASK)))
|
||||||
|
{
|
||||||
|
// See if should still be hidden
|
||||||
|
int parentLine = execute(SCI_GETFOLDPARENT, line);
|
||||||
|
if ((parentLine < 0) || (execute(SCI_GETFOLDEXPANDED, parentLine) && execute(SCI_GETLINEVISIBLE, parentLine)))
|
||||||
|
execute(SCI_SHOWLINES, line, line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -151,14 +151,15 @@ public:
|
|||||||
|
|
||||||
void defineDocType(LangType typeDoc);
|
void defineDocType(LangType typeDoc);
|
||||||
|
|
||||||
void setCurrentDocType(LangType typeDoc) {
|
bool setCurrentDocType(LangType typeDoc) {
|
||||||
if ((_buffers[_currentIndex]._lang == typeDoc) && (typeDoc != L_USER))
|
if ((_buffers[_currentIndex]._lang == typeDoc) && (typeDoc != L_USER))
|
||||||
return;
|
return false;
|
||||||
if (typeDoc == L_USER)
|
if (typeDoc == L_USER)
|
||||||
_buffers[_currentIndex]._userLangExt[0] = '\0';
|
_buffers[_currentIndex]._userLangExt[0] = '\0';
|
||||||
|
|
||||||
_buffers[_currentIndex]._lang = typeDoc;
|
_buffers[_currentIndex]._lang = typeDoc;
|
||||||
defineDocType(typeDoc);
|
defineDocType(typeDoc);
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
void setCurrentDocUserType(const char *userLangName) {
|
void setCurrentDocUserType(const char *userLangName) {
|
||||||
@ -591,7 +592,9 @@ public:
|
|||||||
void columnReplace(const ColumnModeInfo & cmi, const char ch);
|
void columnReplace(const ColumnModeInfo & cmi, const char ch);
|
||||||
void columnReplace(ColumnModeInfo & cmi, int initial, int incr, unsigned char format);
|
void columnReplace(ColumnModeInfo & cmi, int initial, int incr, unsigned char format);
|
||||||
|
|
||||||
void ScintillaEditView::recalcHorizontalScrollbar();
|
void recalcHorizontalScrollbar();
|
||||||
|
void foldChanged(int line, int levelNow, int levelPrev);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static HINSTANCE _hLib;
|
static HINSTANCE _hLib;
|
||||||
static int _refCount;
|
static int _refCount;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user