Skip to content

Commit

Permalink
v3.4.1: fix issue #9 - arrow keys change line
Browse files Browse the repository at this point in the history
FIXED
1. Resolved [Issue #9](#9). Navigating through the tree using the arrow keys instead of the mouse now correctly updates the line number and the current path displayed in the box below the tree.
  • Loading branch information
molsonkiko committed Sep 23, 2022
1 parent 02e9abe commit 844ec1b
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ This project has many features that were implemented in a [standalone app](https
- Sometimes recursive queries may cause an infinite loop, or something else that leads to Notepad++ crashing. Recursive queries are almost always fine, and I only saw this bug once. Not sure why yet.
- The tree view doesn't automatically reset when the user does an undo or redo action. You have to close and reopen the treeview for the changes to be reflected. This is annoying, but I can't seem to get my [Main.OnNotification](/JsonToolsNppPlugin/Main.cs) method to respond to undo and redo actions.

## [3.4.1] - 2022-09-22

### Fixed

1. Resolved [Issue #9](https://github.com/molsonkiko/JsonToolsNppPlugin/issues/9). Navigating through the tree using the arrow keys instead of the mouse now correctly updates the line number and the current path displayed in the box below the tree.

## [3.4.0] - 2022-09-22

### Added
Expand Down
1 change: 1 addition & 0 deletions JsonToolsNppPlugin/Forms/TreeViewer.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 16 additions & 6 deletions JsonToolsNppPlugin/Forms/TreeViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,22 @@ private void FullTreeCheckBox_CheckedChanged(object sender, EventArgs e)
}

/// <summary>
/// snap the caret to the line of the JNode corresponding to the TreeNode clicked.<br></br>
/// Snap the caret to the line of the JNode corresponding to the TreeNode selected.<br></br>
/// Also populate the current path box with the path to the selected node.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Tree_AfterSelect(object sender, TreeViewEventArgs e)
{
if (Npp.GetCurrentPath() != fname) return;
TreeNode node = e.Node;
string path = node.FullPath;
Npp.editor.GotoLine(pathsToJNodes[path].line_num);
// might also want to make it so that the selected line is scrolled to the top
CurrentPathBox.Text = PathToTreeNode(node, Main.settings.key_style);
}

/// <summary>
/// On right click, throw up a context menu that lets you do the following:<br></br>
/// - Copy the current node's value to the clipboard<br></br>
/// - Copy the node's path (Python style) to the clipboard<br></br>
Expand All @@ -451,12 +466,7 @@ private void FullTreeCheckBox_CheckedChanged(object sender, EventArgs e)
/// <param name="e"></param>
private void Tree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (Npp.GetCurrentPath() != fname) return;
TreeNode node = e.Node;
string path = node.FullPath;
Npp.editor.GotoLine(pathsToJNodes[path].line_num);
CurrentPathBox.Text = PathToTreeNode(node, Main.settings.key_style);
// might also want to make it so that the selected line is scrolled to the top
if (e.Button == MouseButtons.Right)
{
// open a context menu that lets the user copy things to clipboard
Expand Down
2 changes: 1 addition & 1 deletion JsonToolsNppPlugin/Forms/TreeViewer.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADC
CgAAAk1TRnQBSQFMAgEBCAEAAVgBAAFYAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CgAAAk1TRnQBSQFMAgEBCAEAAWgBAAFoAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down
4 changes: 2 additions & 2 deletions JsonToolsNppPlugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.4.0")]
[assembly: AssemblyFileVersion("3.4.0")]
[assembly: AssemblyVersion("3.4.1")]
[assembly: AssemblyFileVersion("3.4.1")]
Binary file modified JsonToolsNppPlugin/Release_x64.zip
Binary file not shown.
Binary file modified JsonToolsNppPlugin/Release_x86.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Any issues, feel free to email me at mjolsonsfca@gmail.com.
* non-string key in object
* `]` closing an object or `}` closing an array
4. Get a report of all the syntax errors in the document (`linting` must be active).
5. Open a [drop-down tree view](/docs/README.md#the-basics) of the document. [Clicking on a node](/docs/README.md#get-info-about-tree-nodes) in the tree navigates to the corresponding line in the document.
5. Open a [drop-down tree view](/docs/README.md#the-basics) of the document. [Selecting a node](/docs/README.md#get-info-about-tree-nodes) in the tree navigates to the corresponding line in the document.
6. [Get the path to the current line](/docs/README.md#path-to-current-line)
7. Query and edit JSON with the [RemesPath](/docs/RemesPath.md) query language.
8. Parse [JSON Lines](/docs/README.md#json-lines-documents) documents.
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ We can open up the JSON tree viewer in the main menu by navigating Plugins -> Js

![JSON tree view immediately after creation](/docs/tree%20first%20view.PNG)

You can click on the nodes in that tree to see the children. When you do this, the caret will snap to the line of the node you've selected.
You can click on the nodes in that tree to see the children. When you select a node, the caret will snap to the line of the node you've selected.

__NOTES__
1. If you submit a RemesPath query that is anything other than the default `@`, the JSON tree may no longer send the caret to the correct line.
Expand Down

0 comments on commit 844ec1b

Please sign in to comment.