File tree Expand file tree Collapse file tree 1 file changed +11
-15
lines changed
NppJSONViewer/NppJsonViewer Expand file tree Collapse file tree 1 file changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -233,34 +233,30 @@ auto TreeViewCtrl::GetNodePath(HTREEITEM hti) -> std::wstring
233233 if (nodeKey[nodeKey.size () - 1 ] == TEXT (' "' ))
234234 nodeKey.pop_back ();
235235
236- if (wstrJsonPath.empty ())
236+ std::wstring separator = TEXT (" ." );
237+ if (nodeKey[0 ] == TEXT (' [' ))
237238 {
238- wstrJsonPath = nodeKey;
239+ bArray = true ;
240+ wstrJsonPath = nodeKey + separator + wstrJsonPath;
239241 }
240242 else
241243 {
242- std::wstring separator = TEXT (" ." );
243- if (nodeKey[0 ] == TEXT (' [' ))
244+ if (bArray)
244245 {
245- bArray = true ;
246- wstrJsonPath = nodeKey + separator + wstrJsonPath;
247- }
248- else
249- {
250- if (bArray)
251- {
252- bArray = false ;
253- separator.clear ();
254- }
255- wstrJsonPath = nodeKey + separator + wstrJsonPath;
246+ bArray = false ;
247+ separator.clear ();
256248 }
249+ wstrJsonPath = nodeKey + separator + wstrJsonPath;
257250 }
258251 }
259252
260253 HTREEITEM htiParent = GetParentItem (hitTravel);
261254 hitTravel = htiParent;
262255 }
263256
257+ // remove trailling dot (.)
258+ wstrJsonPath.pop_back ();
259+
264260 return wstrJsonPath;
265261}
266262
You can’t perform that action at this time.
0 commit comments