From 85abfb0527d3aa1f59e13fa8b52a5f8769d68093 Mon Sep 17 00:00:00 2001 From: SinghRajenM Date: Thu, 13 Oct 2022 10:15:54 +0530 Subject: [PATCH] Set language type properly #fixes #147 #closes #147 --- NppJSONViewer/NppJsonViewer/JsonViewDlg.cpp | 6 ++++-- NppJSONViewer/NppJsonViewer/ScintillaEditor.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NppJSONViewer/NppJsonViewer/JsonViewDlg.cpp b/NppJSONViewer/NppJsonViewer/JsonViewDlg.cpp index bb515a7..3ad0b9f 100644 --- a/NppJSONViewer/NppJsonViewer/JsonViewDlg.cpp +++ b/NppJSONViewer/NppJsonViewer/JsonViewDlg.cpp @@ -181,8 +181,10 @@ void JsonViewDlg::PopulateTreeUsingSax(HTREEITEM tree_root, const std::string &j ShowMessage(JSON_ERROR_TITLE, (JSON_ERR_VALIDATE + StringHelper::ToWstring(err)).c_str(), MB_OK | MB_ICONERROR); } } - - m_Editor->SetLangAsJson(); + else + { + m_Editor->SetLangAsJson(); + } } HTREEITEM JsonViewDlg::InsertToTree(HTREEITEM parent, const std::string &text) diff --git a/NppJSONViewer/NppJsonViewer/ScintillaEditor.cpp b/NppJSONViewer/NppJsonViewer/ScintillaEditor.cpp index 5cb312c..37e31da 100644 --- a/NppJSONViewer/NppJsonViewer/ScintillaEditor.cpp +++ b/NppJSONViewer/NppJsonViewer/ScintillaEditor.cpp @@ -39,7 +39,7 @@ std::string ScintillaEditor::GetJsonText() void ScintillaEditor::SetLangAsJson() const { - ::SendMessage(m_hScintilla, NPPM_SETCURRENTLANGTYPE, 0, LangType::L_JSON); + ::SendMessage(m_NppData._nppHandle, NPPM_SETCURRENTLANGTYPE, 0, LangType::L_JSON); } bool ScintillaEditor::IsJsonFile() const