Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Quiss on October 10, 2018, 01:38:47 PM

Title: ThreadSearch preview syntax highlighting
Post by: Quiss on October 10, 2018, 01:38:47 PM
Hi,

ThreadSearch preview editor always uses default highlighting even if you use different color theme (Settings-Editor-Syntax highlighting-Color theme). Also it doesn't check "Highlight wxSmith sections differently" in Settings-Editor-General Settings-C/C++ Editor settings.
src/plugins/contrib/ThreadSearch/ThreadSearchView.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/plugins/contrib/ThreadSearch/ThreadSearchView.cpp b/src/plugins/contrib/ThreadSearch/ThreadSearchView.cpp
index 890bc9756..3e99df2f9 100644
--- a/src/plugins/contrib/ThreadSearch/ThreadSearchView.cpp
+++ b/src/plugins/contrib/ThreadSearch/ThreadSearchView.cpp
@@ -532,12 +532,13 @@ bool ThreadSearchView::UpdatePreview(const wxString& file, long line)

         // Colorize
         cbEditor::ApplyStyles(m_pSearchPreview);
-        EditorColourSet EdColSet;
+        EditorColourSet EdColSet(Manager::Get()->GetEditorManager()->GetColourSet()->GetName());
         EdColSet.Apply(EdColSet.GetLanguageForFilename(m_PreviewFilePath), m_pSearchPreview, false,
                        true);

         SetFoldingIndicator(mgr->ReadInt(_T("/folding/indicator"), 2));
         UnderlineFoldedLines(mgr->ReadBool(_T("/folding/underline_folded_line"), true));
+        m_pSearchPreview->SetProperty(_T("highlight.wxsmith"), mgr->ReadBool(_T("/highlight_wxsmith"), true) ? _T("1") : _T("0"));
     }

     if ( success == true )

My question is where should we get theme name? Like above, by EditorManager or ConfigManager?
Title: Re: ThreadSearch preview syntax highlighting
Post by: oBFusCATed on October 10, 2018, 05:21:13 PM
Huh, someone used this mode for something... I was considering its removal in my plans to cleanup the search experience in C::B :)
Title: Re: ThreadSearch preview syntax highlighting
Post by: Quiss on October 12, 2018, 07:29:55 AM
Removal of what; color themes or code duplication in ThreadSearchView?
Title: Re: ThreadSearch preview syntax highlighting
Post by: oBFusCATed on October 12, 2018, 08:18:32 AM
The code preview in the threadsearch :)
Title: Re: ThreadSearch preview syntax highlighting
Post by: Quiss on October 12, 2018, 08:42:44 AM
I think preview is very useful. After thread search, I check from preview if it's the section I'm searching for. And then I double click and open the related file. Without preview, it would be an open-not related-close file loop, time consuming.