mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
Merge pull request #3309 from RaiKoHoff/Dev_Sci501
Fix lazy styling (no need for SCN_STYLENEEDED)
This commit is contained in:
commit
691f559dad
@ -274,7 +274,7 @@ class LexerJSON : public DefaultLexer {
|
||||
setKeywordJSON_LD(CharacterSet::setAlpha, ":@"),
|
||||
setKeywordJSON(CharacterSet::setAlpha, "$_+-") {
|
||||
}
|
||||
virtual ~LexerJSON() {}
|
||||
virtual ~LexerJSON() = default;
|
||||
int SCI_METHOD Version() const override {
|
||||
return lvRelease5;
|
||||
}
|
||||
|
||||
@ -23,7 +23,9 @@ public:
|
||||
setAlpha=setLower|setUpper,
|
||||
setAlphaNum=setAlpha|setDigits
|
||||
};
|
||||
CharacterSet(setBase base=setNone, const char *initialSet="", int size_=0x80, bool valueAfter_=false) {
|
||||
CharacterSet(setBase base=setNone, const char *initialSet="", int size_=0x80, bool valueAfter_=false)
|
||||
: bset(nullptr)
|
||||
{
|
||||
size = size_;
|
||||
valueAfter = valueAfter_;
|
||||
bset = new bool[size];
|
||||
|
||||
49
src/Edit.c
49
src/Edit.c
@ -7664,50 +7664,6 @@ bool EditAutoCompleteWord(HWND hwnd, bool autoInsert)
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// EditDoStyling()
|
||||
//
|
||||
void EditDoVisibleStyling()
|
||||
{
|
||||
DocLn const iStartLine = SciCall_DocLineFromVisible(SciCall_GetFirstVisibleLine());
|
||||
DocLn const iEndLine = min_ln((iStartLine + SciCall_LinesOnScreen()), (SciCall_GetLineCount() - 1));
|
||||
EditDoStyling(SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// EditDoStyling()
|
||||
//
|
||||
void EditDoStyling(DocPos iStartPos, DocPos iEndPos)
|
||||
{
|
||||
static bool guard = false; // protect against recursion by notification event SCN_STYLENEEDED
|
||||
|
||||
if (Flags.bHugeFileLoadState) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!guard) {
|
||||
guard = true;
|
||||
if (iStartPos < 0) {
|
||||
iStartPos = SciCall_GetEndStyled();
|
||||
} else {
|
||||
iStartPos = SciCall_PositionFromLine(SciCall_LineFromPosition(iStartPos));
|
||||
}
|
||||
|
||||
if (iEndPos < 0) {
|
||||
Sci_ApplyLexerStyle(iStartPos, -1);
|
||||
} else {
|
||||
iEndPos = SciCall_GetLineEndPosition(SciCall_LineFromPosition(iEndPos));
|
||||
if (iStartPos < iEndPos) {
|
||||
Sci_ApplyLexerStyle(iStartPos, iEndPos);
|
||||
}
|
||||
}
|
||||
guard = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// EditUpdateVisibleIndicators()
|
||||
@ -7828,8 +7784,6 @@ void EditUpdateIndicators(DocPos startPos, DocPos endPos, bool bClearOnly)
|
||||
} else {
|
||||
_ClearIndicatorInRange(INDIC_NP3_UNICODE_POINT, -1, startPos, endPos);
|
||||
}
|
||||
|
||||
EditDoStyling(startPos, endPos);
|
||||
}
|
||||
|
||||
|
||||
@ -7846,7 +7800,7 @@ void EditFoldMarkedLineRange(HWND hwnd, bool bHideLines)
|
||||
FocusedView.ShowCodeFolding = Settings.ShowCodeFolding;
|
||||
Style_SetFoldingProperties(FocusedView.CodeFoldingAvailable);
|
||||
Style_SetFolding(hwnd, FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding);
|
||||
Sci_ApplyLexerStyle(0, -1);
|
||||
Sci_ColouriseAll();
|
||||
EditMarkAllOccurrences(hwnd, true);
|
||||
} else { // ===== fold lines without marker =====
|
||||
// prepare hidden (folding) settings
|
||||
@ -9310,6 +9264,7 @@ void EditToggleFolds(FOLD_ACTION action, bool bForceAll)
|
||||
}
|
||||
}
|
||||
}
|
||||
Sci_ColouriseAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -117,8 +117,6 @@ void EditToggleView(HWND hwnd);
|
||||
void EditSelectWordAtPos(const DocPos iPos, const bool bForceWord);
|
||||
int EditAddSearchFlags(int flags, bool bRegEx, bool bWordStart, bool bMatchCase, bool bMatchWords, bool bDotMatchAll);
|
||||
void EditMarkAll(char* pszFind, int sFlags, DocPos rangeStart, DocPos rangeEnd, bool bMultiSel);
|
||||
void EditDoVisibleStyling();
|
||||
void EditDoStyling(DocPos iStartPos, DocPos iEndPos);
|
||||
void EditUpdateVisibleIndicators();
|
||||
void EditUpdateIndicators(DocPos startPos, DocPos endPos, bool bClearOnly);
|
||||
void EditSetAccelWordNav(HWND hwnd,bool);
|
||||
|
||||
@ -2846,11 +2846,8 @@ LRESULT MsgThemeChanged(HWND hwnd, WPARAM wParam,LPARAM lParam)
|
||||
|
||||
MarkAllOccurrences(_MQ_FAST, false);
|
||||
|
||||
if (Flags.bHugeFileLoadState) {
|
||||
EditDoVisibleStyling();
|
||||
} else {
|
||||
EditDoStyling(0, -1);
|
||||
}
|
||||
SciCall_StartStyling(0);
|
||||
Sci_ColouriseAll();
|
||||
|
||||
EditUpdateVisibleIndicators();
|
||||
|
||||
@ -7511,8 +7508,9 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const SCNotification* const scn)
|
||||
}
|
||||
break;
|
||||
|
||||
case SCN_STYLENEEDED: { // this event needs SCI_SETLEXER(SCLEX_CONTAINER)
|
||||
EditDoStyling(-1, scn->position);
|
||||
case SCN_STYLENEEDED: {
|
||||
// this event needs SCI_SETLEXER(SCLEX_CONTAINER)
|
||||
//EditUpdateIndicators(SciCall_GetEndStyled(), scn->position, false);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@ -749,8 +749,7 @@ inline void Sci_RedrawScrollbars()
|
||||
#define Sci_ReplaceTarget(M,L,T) (((M) == SCI_REPLACETARGET) ? SciCall_ReplaceTarget((L),(T)) : SciCall_ReplaceTargetRe((L),(T)))
|
||||
|
||||
// if iRangeEnd == -1 : apply style from iRangeStart to document end
|
||||
#define Sci_ApplyLexerStyle(B, E) SciCall_Colourise((DocPos)(B), (DocPos)(E));
|
||||
#define Sci_LexerStyleAll() SciCall_Colourise(0, -1)
|
||||
#define Sci_ColouriseAll() SciCall_Colourise(0, -1)
|
||||
|
||||
#define Sci_DisableMouseDWellNotification() SciCall_SetMouseDWellTime(SC_TIME_FOREVER)
|
||||
|
||||
|
||||
@ -1501,16 +1501,13 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
SciCall_SetLayoutCache(SC_CACHE_PAGE); //~SC_CACHE_DOCUMENT ~ memory consumption !
|
||||
SciCall_SetPositionCache(SciCall_GetPositionCache()); // clear - default=1024
|
||||
|
||||
//~Sci_LexerStyleAll();
|
||||
SciCall_StartStyling(0);
|
||||
SciCall_SetIdleStyling(SC_IDLESTYLING_ALL);
|
||||
|
||||
// apply lexer styles
|
||||
if (Flags.bHugeFileLoadState) {
|
||||
SciCall_SetIdleStyling(SC_IDLESTYLING_ALL);
|
||||
EditUpdateVisibleIndicators();
|
||||
} else {
|
||||
SciCall_SetIdleStyling(SC_IDLESTYLING_NONE);
|
||||
EditDoStyling(0, -1);
|
||||
EditUpdateIndicators(0, -1, false);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user