Skip to content

Commit

Permalink
Merge pull request rizonesoft#479 from RaiKoHoff/Bugfixes_RC2_V
Browse files Browse the repository at this point in the history
+ fix: bug, where styling stopped after hotspot highlighting
  • Loading branch information
rizonesoft committed May 6, 2018
2 parents 1032301 + e790105 commit f25db39
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
31 changes: 22 additions & 9 deletions src/Edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -5250,7 +5250,6 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
_IGNORE_NOTIFY_CHANGE_;
if (EditToggleView(g_hwndEdit, false)) { _DeleteLineStateAll(LINESTATE_OCCURRENCE_MARK); }
StringCchCopyA(g_lastFind, COUNTOF(g_lastFind), sg_pefrData->szFind);
g_iMarkOccurrencesCount = 0;
RegExResult_t match = _FindHasMatch(g_hwndEdit, sg_pefrData, (sg_pefrData->bMarkOccurences), false);
if (regexMatch != match) {
regexMatch = match;
Expand Down Expand Up @@ -6689,6 +6688,7 @@ static bool __fastcall _HighlightIfBrace(HWND hwnd, DocPos iPos)
//=============================================================================
//
// EditApplyLexerStyle()
// if iRangeEnd == -1 : apply style from iRangeStart to document end
//
void EditApplyLexerStyle(HWND hwnd, DocPos iRangeStart, DocPos iRangeEnd)
{
Expand All @@ -6703,20 +6703,33 @@ void EditApplyLexerStyle(HWND hwnd, DocPos iRangeStart, DocPos iRangeEnd)
//
void EditFinalizeStyling(HWND hwnd, DocPos iEndPos)
{
if (iEndPos <= 0) {
iEndPos = Sci_GetDocEndPosition();
}

DocPos const iEndStyled = SciCall_GetEndStyled();

if (iEndStyled < iEndPos)
if ((iEndPos < 0) || (iEndStyled < iEndPos))
{
DocLn const iStartLine = SciCall_LineFromPosition(iEndStyled) + 1;
DocPos const iStartStyling = SciCall_PositionFromLine(iStartLine);
EditApplyLexerStyle(hwnd, iStartStyling, iEndPos);
EditApplyLexerStyle(hwnd, iEndStyled, iEndPos);
}
}

//void EditFinalizeStyling(HWND hwnd, DocPos iEndPos)
//{
// if (iEndPos <= 0) {
// iEndPos = Sci_GetDocEndPosition();
// }
//
// DocPos const iEndStyled = SciCall_GetEndStyled();
//
// if (iEndStyled < iEndPos)
// {
// DocLn const iStartLine = SciCall_LineFromPosition(iEndStyled) + 1;
// DocPos const iStartStyling = SciCall_PositionFromLine(iStartLine);
// EditApplyLexerStyle(hwnd, iStartStyling, iEndPos);
// }
//}
//




//=============================================================================
//
Expand Down
9 changes: 2 additions & 7 deletions src/Notepad3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,8 @@ static void __fastcall _InitializeSciEditCtrl(HWND hwndEditCtrl)
// SC_PERFORMED_UNDO, SC_PERFORMED_REDO, SC_MULTISTEPUNDOREDO, SC_LASTSTEPINUNDOREDO, SC_MOD_CHANGEMARKER,
// SC_MOD_BEFOREINSERT, SC_MOD_BEFOREDELETE, SC_MULTILINEUNDOREDO, and SC_MODEVENTMASKALL.
//
int const evtMask1 = SC_MOD_CONTAINER | SC_PERFORMED_USER | SC_PERFORMED_UNDO | SC_PERFORMED_REDO | SC_MOD_CHANGESTYLE;
///~ Don't use: SC_PERFORMED_USER | SC_MOD_CHANGESTYLE;
int const evtMask1 = SC_MOD_CONTAINER | SC_PERFORMED_UNDO | SC_PERFORMED_REDO;
int const evtMask2 = SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE;

SendMessage(hwndEditCtrl, SCI_SETMODEVENTMASK, (WPARAM)(evtMask1 | evtMask2), 0);
Expand Down Expand Up @@ -5770,12 +5771,6 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
RestoreAction(scn->token, REDO);
}
}
else if (iModType & SC_MOD_CHANGESTYLE) {
const DocPos iStartPos = (DocPos)scn->position;
const DocPos iEndPos = (DocPos)(scn->position + scn->length);
EditUpdateUrlHotspots(g_hwndEdit, iStartPos, iEndPos, g_bHyperlinkHotspot);
bModified = false; // not yet
}
if (bModified) {
if (g_iMarkOccurrences > 0) {
MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences, true);
Expand Down

0 comments on commit f25db39

Please sign in to comment.