The WPF-based text editor component used in SharpDevelop
Перейти к файлу
Daniel Grunwald e5e068c28d New implementation of HeightTree
The HeightTree is the data structure that maps between document line numbers and visual Y positions. It handles both the varying heights of lines (e.g. due to word-wrapping) and the collapsing of lines (e.g. due to folding).

Where the old implementation was based on a red-black tree, the new implementation is inspired by B+ trees.
We no longer need a separate memory allocation for every line in the document. This should dramatically reduce the memory consumption: a comment in the old code indicated that each line took 56 bytes of memory.
But that was in 32-bit days; in a 64-bit process the old implementation actually needed 88 bytes per line.

The new implementation should need 168 bytes per leaf node which holds 8-16 lines, i.e. we need 10.5-21 bytes per line for the leaf nodes.
It additionally needs 456 bytes per inner node (for the inner node and its children array). The level just above the leafs holds 64-256 lines per inner node, i.e. we need 1.8-7.2 bytes per line for the second level.
Thus the total memory consumption of the new tree should in the worst case still be below 29.2 bytes per line (`168/8 + sum(456/(8**lvl) for lvl in range(2,100))`).
However after freshly loading a large document from disk we should be close to the best case which in total is just 12.4 bytes per line (`168/16 + sum(456/(16**lvl) for lvl in range(2,100))`).

Apart from the reduced memory usage, the behavior of the new tree should be identical to the old behavior.
In particular, all operations (line insertion, line deletion, collapsing, uncollapsing, line<->Y queries) maintain their externally-visible behavior and their O(lg N) run-time.
set_DefaultLineHeight runs in O(N) now (previously could take O(N lg N)).
2022-09-04 18:59:55 +02:00
.github/workflows Build unit tests are split by framework 2022-05-16 07:25:59 +02:00
BuildTools Fix indentation and clean up. 2019-07-04 13:02:32 +02:00
Documentation Fix "SHFB(0,0): error BE0071: Unable to locate information for the project framework version '.NET Framework 4.5' or a suitable redirected version on this system. See error number help topic for details." (note: generates a new warning with auto-upgrade to net5.0, this is intentional) 2021-06-01 09:34:38 +02:00
ICSharpCode.AvalonEdit New implementation of HeightTree 2022-09-04 18:59:55 +02:00
ICSharpCode.AvalonEdit.Sample Change to AvalonEdit Target Frameworks to .NET Framework 4.6.2, .NET Core 3.1 and .NET 6.0. Fixes #343. Supersedes #286. 2022-05-16 07:17:06 +02:00
ICSharpCode.AvalonEdit.Tests New implementation of HeightTree 2022-09-04 18:59:55 +02:00
ThirdParty-Highlightings Add attribution to highlighting definitions coming from #144 2020-02-04 16:20:59 +01:00
.editorconfig Add proper .editorconfig and fix formatting. 2019-07-04 12:07:47 +02:00
.gitattributes remove dependencies on NRefactory 2014-04-10 22:13:03 +02:00
.gitignore Update gitignore 2021-06-01 09:01:04 +02:00
ChangeLog.md Change to AvalonEdit Target Frameworks to .NET Framework 4.6.2, .NET Core 3.1 and .NET 6.0. Fixes #343. Supersedes #286. 2022-05-16 07:17:06 +02:00
ICSharpCode.AvalonEdit.Documentation.sln extra project file for dok 2019-03-24 18:19:15 +01:00
ICSharpCode.AvalonEdit.sln extra project file for dok 2019-03-24 18:19:15 +01:00
LICENSE Fix attribution (cp) 2019-03-25 20:56:00 +01:00
README.md NuGet packages updates 2021-12-10 09:42:22 +01:00
global.json Add net6.0-windows tfm 2021-11-09 08:43:24 +01:00

README.md

AvalonEdit NuGet Build AvalonEdit

AvalonEdit is the name of the WPF-based text editor in SharpDevelop 4.x "Mirador" and beyond. It is also being used in ILSpy and many other projects.

Downloads

AvalonEdit is available as NuGet package. Usage details, documentation and more can be found on the AvalonEdit homepage

How to build

AvalonEdit is targeting net6.0-windows, net5.0-windows, netcoreapp3.1, net40 and net45 TFMs. Because of net6.0-windows you must have the .NET 6.0 SDK installed on your machine. Visual Studio 2022 Community and up is required for working with the solution (global.json will select the proper SDK to use for building for you).

Documentation

Check out the official documentation and the samples and articles wiki page

To build the Documentation you need to install Sandcastle from https://github.com/EWSoftware/SHFB/releases (currently validated tooling is v2021.4.9.0)

The build of the Documentation can take very long, please be patient.

License

AvalonEdit is distributed under the MIT License.

Projects using AvalonEdit

A good place to start are the "top 10" listed under GitHub Usage for the AvalonEdit package on NuGet.

Note: if your project is not listed here, let us know! :)