"Column 80 guide" and caret position inconsistency

SyntaxEditor for Windows Forms Forum

Posted 10 years ago by Oleg
Version: 4.0.0283
Platform: .NET 3.5
Environment: Windows XP (32-bit)
Avatar
Hi,

There is an inconsistency between the position of "Column 80 guide" and the current Caret position if proportional font is used.

Steps to reproduce:
- Start sample "SDI Editor Application"
- Set the editor font to some proportional font (e.g. "Freestyle script")
- Turn on "Column 80 guide" option.
- Put cursor to some line in SyntaxEditor at the "column 80 guide" position.
- The information provided in status bar doesn't show 80th column. And there is no way (at least I haven't found it) to get this information.

You may look at Visual Studio for example. It displays the correct position in status bar in this case.

Comments (1)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Oleg,

Ther column guide shows at 80 x average character size. But you are correct the variable-width font columns aren't being calculated correctly right now. At the moment they are being calculated based on number of characters and tabs, however it should be based on the x-location and average character size, meaning in variable-width fonts, sometimes a character may span more than one column (like for 'm') or more than one character could fit in a column (like for 'i').

We've done this correctly in the WPF version. We plan on updating it in the WinForms version for the next major version (which we hope to have based on the newer framework being prototyped in the WPF version) but as for now we can't change it since there are some other features that rely on the information being returned as-is. So in the meantime, column reporting will be in inaccurate with variable-width fonts.

You could possibly calculate a column on your own though if you get the bounds of the caret's character and divide the x-location that by SyntaxEditor.CharacterWidth property. Then report that result in the UI.


Actipro Software Support

The latest build of this product (v2018.1 build 0342) was released 11 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.