SyntaxEditor vNext - Customizing Line Numbers

by Avatar Bill Henning (Actipro)
Tuesday, December 5, 2017 at 5:08pm

BlogPostBanner-SyntaxEditor-DevNotes

As mentioned in a previous post, we have been working on refactoring the core internal implementation of our SyntaxEditor code editor control on the WPF, UWP, and WinForms platforms.  This effort is being made to bring all three platforms onto the same codebase for easier updating moving forward, and to enhance features wherever possible.

In the previous SyntaxEditor vNext post, we showed some massive improvements in SyntaxEditor touch interaction, including inertia-based touch scrolling and pinch-to-zoom features.  In today's post, we'll examine a new feature area that allows you to customize the line numbers displayed in each view's line number margin.

Default Behavior

By default, a view's line number margin displays the line number (document line index plus one) for each view line.  If a view line is a wrapped line, nothing appears for that view line in the margin.

SyntaxEditorLineNumbersDefault

In vNext, several new features are being added to support customization of the line number display.

Document Fragment Scenario

One scenario where line number customization is appropriate is when you have an enormous file and only want SyntaxEditor to show a fragment of it, such as several thousand lines.  In this scenario, you might make a document with lines 10,000-20,000 in it.  The first line in SyntaxEditor is really line 10,000 in the file, but it normally shows as line #1 in the line number margin.  This can be confusing to the end user.

SyntaxEditorLineNumbersOrigin

A new property on the document class allows you to change the line number origin, which defaults to 1.  For the scenario described above, you'd set it to 10,000 instead.  All line numbers after that origin number will continue to be relative to it.

Advanced Scenarios

What about cases where a language might have specific line numbers or labels that should show for certain view lines?  This is possible too via a new language service that allows for completely customizing the text to display for each view line in the line number margin.

SyntaxEditorLineNumbersCustom

In the screenshot above, we've set the line number margin to show the zero-based offset of each line.  For a couple lines, we've also indicated labels for the namespace and class lines.

Summary

The new custom line numbering features are very easy to use for changing default line number margin content.

Code Writer v3 Released

by Avatar Bill Henning (Actipro)
Friday, December 1, 2017 at 9:21pm

BlogPostBanner-CodeWriter-v3

Reimagined Windows 10 Design

ExplorerSideBar

NewDocumentPopup

CommandPalette

SideBarCollapsed

The app is minimalist in nature, and while it does feature a side bar, the side bar can be collapsed by pressing the unpin button.  This affords a distraction-free environment while you edit text/code.

Code Writer has find/replace functionality, print/share support, advanced editing commands, and a wide array of settings. 

Summary

If you have the Windows 10 Fall Creators Update or later, download Code Writer for free from the Windows Store today to check out v3.0 and all it has to offer.  The new redesign has been a labor of love that has been in development for many months.  We're very pleased to get it out into your hands as a showcase of what you can do with Actipro's Universal Windows Controls.  Enjoy!

Want to get the latest news about Code Writer?  Follow our @CodeWriterApp Twitter account.

Want to chat with us about Code Writer?  Please register to join our Slack workspace and join the #codewriter channel once added.

If you are a Universal Windows app developer, you can download a free evaluation of our Universal Windows Controls to use in your own apps.  Code Writer makes use of our SyntaxEditor, Docking/MDI, PropertyGrid, and Editors controls.  SyntaxEditor is of particular interest because it lets you add advanced code and text editing to your own apps.

TaskWideLearnMore TaskWideWindowsStore