From 06587355968afc9a79762199a022f9c0d3230873 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 21 Jun 2015 01:02:49 +0200 Subject: [PATCH] SciEdit: Request full restyling on SetText and InsertText Fixes a regression of revision f0234cf28432ef8902a0620f2de283c81ed9b45c. Signed-off-by: Sven Strickroth --- src/TortoiseProc/PatchViewDlg.cpp | 1 - src/Utils/MiscUI/SciEdit.cpp | 14 ++++++++++++++ src/Utils/MiscUI/SciEdit.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/TortoiseProc/PatchViewDlg.cpp b/src/TortoiseProc/PatchViewDlg.cpp index 1bdd5d1d2..bced52785 100644 --- a/src/TortoiseProc/PatchViewDlg.cpp +++ b/src/TortoiseProc/PatchViewDlg.cpp @@ -69,7 +69,6 @@ void CPatchViewDlg::SetText(const CString& text) m_ctrlPatchView.Call(SCI_SETREADONLY, FALSE); m_ctrlPatchView.SetText(text); m_ctrlPatchView.Call(SCI_SETREADONLY, TRUE); - m_ctrlPatchView.Call(SCI_COLOURISE, 0, -1); if (!text.IsEmpty()) { m_ctrlPatchView.Call(SCI_GOTOPOS, 0); diff --git a/src/Utils/MiscUI/SciEdit.cpp b/src/Utils/MiscUI/SciEdit.cpp index 138c3928a..da50abc71 100644 --- a/src/Utils/MiscUI/SciEdit.cpp +++ b/src/Utils/MiscUI/SciEdit.cpp @@ -426,6 +426,7 @@ void CSciEdit::SetText(const CString& sText) Call(SCI_DOCUMENTEND); Call(SCI_NEWLINE); Call(SCI_DELETEBACK); + ReStyle(0, (int)Call(SCI_GETLENGTH)); } void CSciEdit::InsertText(const CString& sText, bool bNewLine) @@ -434,6 +435,7 @@ void CSciEdit::InsertText(const CString& sText, bool bNewLine) Call(SCI_REPLACESEL, 0, (LPARAM)(LPCSTR)sTextA); if (bNewLine) Call(SCI_REPLACESEL, 0, (LPARAM)(LPCSTR)"\n"); + ReStyle(0, (int)Call(SCI_GETLENGTH)); } CString CSciEdit::GetText() @@ -1673,3 +1675,15 @@ void CSciEdit::RestyleBugIDs() // style the bug IDs MarkEnteredBugID(0, endstylepos); } + +void CSciEdit::ReStyle(int firstPos, int lastPos) +{ + MarkEnteredBugID(firstPos, lastPos); + if (m_bDoStyle) + StyleEnteredText(firstPos, lastPos); + + StyleURLs(firstPos, lastPos); + CheckSpelling(firstPos, lastPos); + WrapLines(firstPos, lastPos); + Call(SCI_COLOURISE, firstPos, lastPos); +} diff --git a/src/Utils/MiscUI/SciEdit.h b/src/Utils/MiscUI/SciEdit.h index 8c36b3afc..5a387b9f7 100644 --- a/src/Utils/MiscUI/SciEdit.h +++ b/src/Utils/MiscUI/SciEdit.h @@ -124,6 +124,7 @@ public: CString StringFromControl(const CStringA& text); int LoadFromFile(CString &filename); void RestyleBugIDs(); + void ReStyle(int firstPos, int lastPos); private: bool IsUTF8(LPVOID pBuffer, size_t cb); -- 2.11.4.GIT