Skip to content

Commit

Permalink
scroll caret into view on reformat; address #84
Browse files Browse the repository at this point in the history
Horizontally scroll all the way to the left when reformatting a file
    (only when reformatting the entire file; not in selection-based mode).
This avoids annoyances when there are very long lines and word wrap is turned off.
  • Loading branch information
molsonkiko committed Nov 23, 2024
1 parent dfd63ea commit 7c6ce50
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 54 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Since v7.0, holding down `Enter` in a multiline textbox (like the [tree viewer query box](/docs/README.md#remespath)) only adds one newline when the key is lifted.
- Maybe use pre-7.1 (dictionary-based rather than indicator-based) [selection remembering](/docs/README.md#working-with-selections) for Notepad++ 8.5.5 and earlier? Indicators are risky with those older NPP's because of the lack of `NPPM_ALLOCATEINDICATOR`.

## [8.3.0] - 2024-11-22

### Added

### Changed

### Fixed

1. When a file is [pretty-printed or compressed](/docs/README.md#the-basics) or [edited with RemesPath](/docs/RemesPath.md#editing-with-assignment-expressions), the caret will be scrolled into view. Previously, if the file contained very long lines and word wrapping was turned off, [the user might have to manually scroll to the left](https://github.com/molsonkiko/JsonToolsNppPlugin/issues/84) after pretty-printing or compressing.

## [8.2.0] - 2024-11-09

### Added
Expand Down
1 change: 1 addition & 0 deletions JsonToolsNppPlugin/Forms/GrepperForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ private void RemoveSelectedFilesButton_Click(object sender, EventArgs e)
string fileOpen = Npp.notepad.GetCurrentFilePath();
Npp.notepad.OpenFile(tv.fname);
Npp.editor.SetText(Main.PrettyPrintFromSettings(tv.json));
Npp.editor.ScrollCaret();
tv.SubmitQueryButton.PerformClick();
Npp.notepad.OpenFile(fileOpen);
if (Main.openTreeViewer != null && !Main.openTreeViewer.IsDisposed)
Expand Down
3 changes: 3 additions & 0 deletions JsonToolsNppPlugin/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,8 @@ public static void CompressJson()
}
info = AddJsonForFile(activeFname, json);
Npp.RemoveTrailingSOH();
if (!usesSelections)
Npp.editor.ScrollCaret();
Npp.editor.EndUndoAction();
lastEditedTime = DateTime.MaxValue; // avoid redundant parsing
if (!usesSelections)
Expand Down Expand Up @@ -1155,6 +1157,7 @@ static void DumpYaml()
return;
}
Npp.editor.SetText(yaml);
Npp.editor.ScrollCaret();
Npp.RemoveTrailingSOH();
Npp.notepad.SetCurrentLanguage(LangType.L_YAML);
}
Expand Down
4 changes: 2 additions & 2 deletions JsonToolsNppPlugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("8.2.0.0")]
[assembly: AssemblyFileVersion("8.2.0.0")]
[assembly: AssemblyVersion("8.2.0.1")]
[assembly: AssemblyFileVersion("8.2.0.1")]
Loading

0 comments on commit 7c6ce50

Please sign in to comment.