Merge pull request #1159 from RaiKoHoff/Dev_RC

Hyperlink and Lexer style update cooperation
This commit is contained in:
Rainer Kottenhoff 2019-05-01 02:23:07 +02:00 committed by GitHub
commit 7ccde65294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 34 additions and 46 deletions

View File

@ -1 +1 @@
1684
1685

View File

@ -1 +1 @@
"develop"
"RC"

View File

@ -3,8 +3,8 @@
<assemblyIdentity
name="Notepad3"
processorArchitecture="*"
version="5.19.430.1684"
version="5.19.501.1685"
type="win32"
/>
<description>Notepad3 develop</description>
<description>Notepad3 RC</description>
</assembly>

View File

@ -6166,25 +6166,6 @@ void EditMarkAllOccurrences(HWND hwnd, bool bForceClear)
}
//=============================================================================
//
// EditUpdateVisibleUrlHotspot()
//
void EditUpdateVisibleUrlHotspot(bool bEnabled)
{
if (bEnabled)
{
if (_IsInTargetTransaction()) { return; } // do not block, next event occurs for sure
DocLn const iStartLine = SciCall_DocLineFromVisible(SciCall_GetFirstVisibleLine());
DocLn const iEndLine = min_ln((iStartLine + SciCall_LinesOnScreen()), (SciCall_GetLineCount() - 1));
_IGNORE_NOTIFY_CHANGE_;
EditUpdateUrlHotspots(Globals.hwndEdit, SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine), bEnabled);
_OBSERVE_NOTIFY_CHANGE_;
}
}
//=============================================================================
//
// EditApplyVisibleStyle()
@ -6194,10 +6175,12 @@ void EditApplyVisibleStyle(HWND hwnd)
DocLn const iStartLine = SciCall_DocLineFromVisible(SciCall_GetFirstVisibleLine());
DocLn const iEndLine = min_ln((iStartLine + SciCall_LinesOnScreen()), (SciCall_GetLineCount() - 1));
if (Settings.HyperlinkHotspot && !_IsInTargetTransaction()) {
_IGNORE_NOTIFY_CHANGE_;
EditUpdateUrlHotspots(hwnd, SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine), true);
_OBSERVE_NOTIFY_CHANGE_;
}
else if (!Globals.bHideNonMatchedLines) {
Sci_ApplyStyle(SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine));
Sci_ApplyLexerStyle(SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine));
}
}
@ -6868,8 +6851,10 @@ bool EditAutoCompleteWord(HWND hwnd, bool autoInsert)
//
void EditUpdateUrlHotspots(HWND hwnd, DocPos startPos, DocPos endPos, bool bActiveHotspot)
{
if (Globals.bHideNonMatchedLines) { return; }
if (endPos < 0) {
endPos = Sci_GetDocEndPosition();
endPos = Sci_GetDocEndPosition() - 1;
}
else if (endPos < startPos) {
swapos(&startPos, &endPos);
@ -6890,12 +6875,15 @@ void EditUpdateUrlHotspots(HWND hwnd, DocPos startPos, DocPos endPos, bool bActi
// 1st apply current lexer style
EditFinalizeStyling(startPos);
SciCall_StartStyling(startPos);
_ENTER_TARGET_TRANSACTION_;
DocPos start = startPos;
DocPos end = endPos;
do {
SciCall_StartStyling(start);
DocPos const iPos = _FindInTarget(hwnd, pszUrlRegEx, iRegExLen, SCFIND_NP3_REGEX, &start, &end, false, FRMOD_IGNORE);
if (iPos < 0) {
@ -6906,6 +6894,7 @@ void EditUpdateUrlHotspots(HWND hwnd, DocPos startPos, DocPos endPos, bool bActi
break; // wrong match
}
// mark this match
EditFinalizeStyling(iPos);
SciCall_StartStyling(iPos);
if (bActiveHotspot) {
SciCall_SetStyling((DocPosCR)mlen, Style_GetHotspotStyleID());
@ -6913,15 +6902,17 @@ void EditUpdateUrlHotspots(HWND hwnd, DocPos startPos, DocPos endPos, bool bActi
else {
EditFinalizeStyling(end);
}
// next occurrence
start = end;
start = end + 1;
end = endPos;
} while (start < end);
_LEAVE_TARGET_TRANSACTION_;
SciCall_StartStyling(endPos);
EditFinalizeStyling(endPos);
SciCall_StartStyling(endPos + 1);
}
@ -6953,7 +6944,7 @@ void EditHideNotMarkedLineRange(HWND hwnd, DocPos iStartPos, DocPos iEndPos, boo
SciCall_SetFoldFlags(0);
Style_SetFolding(hwnd, Globals.bCodeFoldingAvailable && Settings.ShowCodeFolding);
SciCall_FoldAll(EXPAND);
Sci_ApplyStyle(0, -1);
Sci_ApplyLexerStyle(0, -1);
EditUpdateUrlHotspots(hwnd, 0, -1, Settings.HyperlinkHotspot);
EditFinalizeStyling(-1);
}
@ -7077,10 +7068,8 @@ static bool _HighlightIfBrace(HWND hwnd, DocPos iPos)
void EditFinalizeStyling(DocPos iEndPos)
{
DocPos const iEndStyled = SciCall_GetEndStyled();
if ((iEndPos < 0) || (iEndStyled < iEndPos))
{
Sci_ApplyStyle(iEndStyled, iEndPos);
if ((iEndPos < 0) || (iEndStyled < iEndPos)) {
Sci_ApplyLexerStyle(iEndStyled, iEndPos);
}
}

View File

@ -109,7 +109,6 @@ void EditSetBookmarkList(HWND hwnd,LPCWSTR pszBookMarks);
void EditFinalizeStyling(DocPos iEndPos);
void EditMarkAllOccurrences(HWND hwnd, bool bForceClear);
void EditUpdateVisibleUrlHotspot(bool);
void EditApplyVisibleStyle(HWND hwnd);
void EditHideNotMarkedLineRange(HWND hwnd, DocPos iStartPos, DocPos iEndPos, bool);

View File

@ -2414,9 +2414,6 @@ LRESULT MsgSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
EndDeferWindowPos(hdwp);
s_WinCurrentWidth = cx;
EditEnsureSelectionVisible(Globals.hwndEdit);
UpdateAllBars(false);
return 0;
@ -3242,7 +3239,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDT_TIMER_UPDATE_HOTSPOT:
EditUpdateVisibleUrlHotspot(Settings.HyperlinkHotspot);
EditApplyVisibleStyle(Globals.hwndEdit);
break;
@ -3534,7 +3531,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
if (EditSetNewEncoding(Globals.hwndEdit, iNewEncoding, (s_flagSetEncoding != CPI_NONE),
StringCchLenW(Globals.CurrentFile,COUNTOF(Globals.CurrentFile)) == 0)) {
if (SendMessage(Globals.hwndEdit,SCI_GETLENGTH,0,0) == 0) {
if (SciCall_GetTextLength() == 0) {
Encoding_Current(iNewEncoding);
Encoding_HasChanged(iNewEncoding);
}
@ -3547,6 +3544,9 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
}
_OBSERVE_NOTIFY_CHANGE_;
EndWaitCursor();
Sci_ApplyLexerStyle(0, -1);
EditUpdateUrlHotspots(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot);
EditFinalizeStyling(-1);
UpdateStatusbar(false);
}
break;
@ -3554,7 +3554,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_ENCODING_RECODE:
{
if (StringCchLenW(Globals.CurrentFile,COUNTOF(Globals.CurrentFile)))
if (StrIsNotEmpty(Globals.CurrentFile))
{
cpi_enc_t iNewEncoding = Encoding_MapUnicode(Encoding_Current(CPI_GET));
@ -6548,7 +6548,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
else if (iUpd & SC_UPDATE_CONTENT) {
// ignoring SC_UPDATE_CONTENT cause Style and Marker are out of scope here
// using WM_COMMAND -> SCEN_CHANGE instead!
//~MarkAllOccurrences(Settings2.UpdateDelayMarkAllCoccurrences, false);
//~~~MarkAllOccurrences(Settings2.UpdateDelayMarkAllCoccurrences, false);
}
}
@ -6566,7 +6566,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
if (Settings.HyperlinkHotspot) {
UpdateVisibleUrlHotspot(Settings2.UpdateDelayHyperlinkStyling);
}
//@@@~EditApplyVisibleStyle(Globals.hwndEdit);
//~~~EditApplyVisibleStyle(Globals.hwndEdit);
}
}
break;

View File

@ -520,7 +520,7 @@ inline DocPos Sci_GetRangeMaxLineLength(DocLn iBeginLine, DocLn iEndLine) {
#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_ApplyStyle(B, E) SciCall_Colourise((B), (E));
#define Sci_ApplyLexerStyle(B, E) SciCall_Colourise((B), (E));
//=============================================================================

View File

@ -1311,7 +1311,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
Style_SetUrlHotSpot(hwnd, Settings.HyperlinkHotspot);
// apply lexer styles
Sci_ApplyStyle(0, -1);
Sci_ApplyLexerStyle(0, -1);
EditUpdateUrlHotspots(hwnd, 0, -1, Settings.HyperlinkHotspot);
EditFinalizeStyling(-1);

View File

@ -7,8 +7,8 @@
#define SAPPNAME "Notepad3"
#define VERSION_MAJOR 5
#define VERSION_MINOR 19
#define VERSION_REV 430
#define VERSION_BUILD 1684
#define VERSION_REV 501
#define VERSION_BUILD 1685
#define SCINTILLA_VER 415
#define ONIGMO_REGEX_VER 6.2.0
#define VERSION_PATCH develop
#define VERSION_PATCH RC