From 10554cf21bf65b5c9de37adf375a105990a0d711 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 18 Jul 2015 23:08:31 +0200 Subject: [PATCH] TortoiseGitBlame: Reinitialize the editor on every file load Open a file with a lexer first (e.g. a .cpp file) and then open a .txt file. See that the .cpp styling rules are still applied to the .txt file. Signed-off-by: Sven Strickroth --- src/TortoiseGitBlame/TortoiseGitBlameView.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/TortoiseGitBlame/TortoiseGitBlameView.cpp b/src/TortoiseGitBlame/TortoiseGitBlameView.cpp index d91ac9af9..2094796a3 100644 --- a/src/TortoiseGitBlame/TortoiseGitBlameView.cpp +++ b/src/TortoiseGitBlame/TortoiseGitBlameView.cpp @@ -283,7 +283,7 @@ int CTortoiseGitBlameView::OnCreate(LPCREATESTRUCT lpcs) m_TextView.Init(0,FALSE); m_TextView.ShowWindow( SW_SHOW); CreateFont(); - InitialiseEditor(); + SendEditor(SCI_SETREADONLY, TRUE); m_ToolTip.Create(this->GetParent()); ::AfxGetApp()->GetMainWnd(); @@ -621,6 +621,7 @@ void CTortoiseGitBlameView::SetAStyle(int style, COLORREF fore, COLORREF back, i void CTortoiseGitBlameView::InitialiseEditor() { + SendEditor(SCI_STYLERESETDEFAULT); // Set up the global default style. These attributes are used wherever no explicit choices are made. std::string fontName = CUnicodeUtils::StdGetUTF8((stdstring)CRegStdString(_T("Software\\TortoiseGit\\BlameFontName"), _T("Courier New"))); SetAStyle(STYLE_DEFAULT, @@ -652,6 +653,7 @@ void CTortoiseGitBlameView::InitialiseEditor() } SendEditor(SCI_SETWRAPMODE, SC_WRAP_NONE); + SendEditor(SCI_STYLECLEARALL); } bool CTortoiseGitBlameView::DoSearch(CTortoiseGitBlameData::SearchDirection direction) @@ -1068,6 +1070,7 @@ void CTortoiseGitBlameView::StringExpand(LPWSTR str) const void CTortoiseGitBlameView::SetupLexer(CString filename) { int start=filename.ReverseFind(_T('.')); + SendEditor(SCI_SETLEXER, SCLEX_NULL); if (start>0) { //_tcscpy_s(line, 20, lineptr+1); @@ -1545,6 +1548,7 @@ void CTortoiseGitBlameView::UpdateInfo(int Encode) { CreateFont(); + InitialiseEditor(); SendEditor(SCI_SETREADONLY, FALSE); SendEditor(SCI_CLEARALL); SendEditor(EM_EMPTYUNDOBUFFER); -- 2.11.4.GIT