Skip to content

Commit bed415c

Browse files
committed
Handle both the views
fixes #162, closes #162
1 parent ffbb76d commit bed415c

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

NppJSONViewer/NppJsonViewer/JsonViewDlg.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,20 @@ void JsonViewDlg::CompressJson()
100100
void JsonViewDlg::HandleTabActivated()
101101
{
102102
const bool bIsVisible = isCreated() && isVisible();
103-
if (bIsVisible && m_Editor->IsJsonFile())
103+
if (bIsVisible)
104104
{
105-
if (m_pSetting->bFollowCurrentTab)
105+
m_Editor->RefreshViewHandle();
106+
if (m_Editor->IsJsonFile())
106107
{
107-
DrawJsonTree();
108-
}
109-
110-
if (m_pSetting->bAutoFormat)
111-
{
112-
FormatJson();
108+
if (m_pSetting->bFollowCurrentTab)
109+
{
110+
DrawJsonTree();
111+
}
112+
113+
if (m_pSetting->bAutoFormat)
114+
{
115+
FormatJson();
116+
}
113117
}
114118
}
115119
}

NppJSONViewer/NppJsonViewer/ScintillaEditor.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
ScintillaEditor::ScintillaEditor(const NppData &nppData)
66
: m_NppData(nppData)
7+
{
8+
RefreshViewHandle();
9+
}
10+
11+
void ScintillaEditor::RefreshViewHandle()
712
{
813
int which = -1;
914
::SendMessage(m_NppData._nppHandle, NPPM_GETCURRENTSCINTILLA, 0, reinterpret_cast<LPARAM>(&which));

NppJSONViewer/NppJsonViewer/ScintillaEditor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class ScintillaEditor
99
explicit ScintillaEditor(const NppData &nppData);
1010
~ScintillaEditor() = default;
1111

12+
void RefreshViewHandle();
1213
std::string GetJsonText();
1314
void SetLangAsJson() const;
1415
bool IsJsonFile() const;

0 commit comments

Comments
 (0)