Line Numbering with new version

SyntaxEditor for Windows Forms Forum

Posted 16 years ago by Howie
Avatar
Hello,

Will the new version of the syntax editor include more support for custom line numbering / renumbering? For example if I had the following line numbers I would like to number on my own numbering scheme. I would also want the new outlining to then hide the line numbers that fall in that range.

10
11
12
13

I choose to renumber by 10
10
20
30
40

Now if I choose a new line it should be 50,60,70 etc.

Now if Line 20 is #region and line 40 is #end region then I should only see line 10,50,60,70 etc. Will I be able to do this now with version 2?

Thanks,

Howie

Comments (4)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Howie,

This is on our TODO list however it won't be in the 2.0 release. It is definitely something we'd like to implement after the 2.0 release though. I believe with how outlining is currently working, the line numbers would behave as you indicated when they hide.

Just FYI, we have automatic outlining mostly working at this point but still need to iron out a couple issues.

For this feature it would be very helpful if you could provide some more specific details on implementation ideas. For instance how would you like to assign a number to new lines? Like if you had lines 10-100 at 10 intervals, what happens when you insert in the middle there? You gave an example of what should happen at the end but the middle is more complicated. Also can this be an automatic design or do you think you'd have to renumber manually? We can always provide helper methods for renumbering lines over a range of lines.


Actipro Software Support

Posted 16 years ago by Howie
Avatar
The way I would like it in my app would be to have in my base system the numbering pattern and the renumbering option. So if I set numbering pattern to 1 and my renumbering to 5 then my code window would then add 1 to every line inserted so when I get to 5 it would add 5 to the last number force a renumber to all lines after. So take the following example.

11
12
13
14
15
16
17

I then insert at 14 with a new base system of 1 now I have to force a renumber so it would look like this

11
12
13
14
15 !This is a new line
20 ! line 15 I apply the renumber count to it
21 ! line 16 I apply the renumber count to it
22 ! line 17 I apply the renumber count to it

But lets say the count pattern was changed to 10 and renumber was set to 5 now this is what would of happened in that situation ( you would never do this because you are always renumbering! It is just for concept.)

11
12
13
14
25
30
31
32

Most business basic editors are set so that they count pattern is set to 1 and renumber is by 5 or 10. If you are at the end of the line you add by the renumber so if I take the last example I would have a renumber happen and I would add 5 to each new line.

11
12
13
14
25
30
31
32
37 ! this is a new line
42 ! this is a new line
47 ! this is a new line

Now after I added these 3 new lines if I inserted at 37 I would get the following.

11
12
13
14
25
30
31
32
37 ! 37 before
42 ! this is a new line and forced a renumber so I add 5
47 ! 42 renumber
52 ! 47 renumber

Now lets go to the real world where I would have a pattern set to 1 and a renumber set to 10 this would of happened

11
12
13
14
25
30
31
32
37 ! 37 before
47 ! this is a new line and forced a renumber so I add 10
52 ! 42 + the renumber
57 ! 47 + the renumber

I just need the ablity to be able to do something like this and if the control could handle the basics for me that would be great. I know this all sounds crazy but this is how business basic / top down editors usually work!

Thanks

Howie
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Thanks for the great examples Howie! That will help when we go to implement it.


Actipro Software Support

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The latest 3.0 pre-release has added a DocumentLine.CustomLineNumber property which accepts a string. If you specify a non-null value, it will display that value in the line number margin. To not display anything for a line, just set it to an empty string. To use the default line index, set it to null.

With that you can create your own logic for numbering lines and set the property appropriately. You can add your logic in the DocumentTextChanged event.

The 3.0 pre-release also lets you align the line number text to the left, center, or right.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.