adding lazy line numbers to lister

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
Samuel
Power Member
Power Member
Posts: 1930
Joined: 2003-08-29, 15:44 UTC
Location: Germany, Brandenburg an der Havel
Contact:

adding lazy line numbers to lister

Post by *Samuel »

Recently, I often have to open code files with lister instead of a dev studio. I really could use some line numbers.

I know it has been requested many, many times. And the reply has always been you would need to read the whole file. (when lister shows the end of the file it only reads something like the last 10KB of the file [this is referred as block in the 3. proposal] - this is a very good feature, no one wants a slower lister!)

Here are my modified approaches:

1. Filesize limit
Add a wincmd.ini option "LineNumberLimit=100".
When a file has fewer KB then specified then show line numbers otherwise don't show them.
Simple.


2. Activate on demand
Add a menu item "Show line numbers" deactivated by default.
Needs translation.


3. Activate when available (could be combined with 1 or 2)
If I have read all consecutive blocks from the beginning to the current block (by scrolling down) then show line numbers otherwise omit them.

Example: For a file with 86KB there are 9 10KB blocks to read:

Code: Select all

Block 1 has been read:     185 line breaks           > line numbers can be shown:    0 + n
Block 2 has been read:     215 line breaks           > line numbers can be shown:  185 + n
Block 3 has been read:     144 line breaks           > line numbers can be shown:  400 + n
Block 4 has not been read: line break number unknown > line numbers can not be shown
Block 5 has been read:     360 line breaks           > line numbers can not be shown
Block 6 has been read:      83 line breaks           > line numbers can not be shown
Block 7 has not been read: line break number unknown > line numbers can not be shown
Block 8 has not been read: line break number unknown > line numbers can not be shown
Block 9 has not been read: line break number unknown > line numbers can not be shown
If one scrolls into block 4 now then the line numbers in block 6 would be available without reading block 1, 2, 3 or 5:

Code: Select all

Block 1 has been read:     185 line breaks           > line numbers can be shown:    0 + n
Block 2 has been read:     215 line breaks           > line numbers can be shown:  185 + n
Block 3 has been read:     144 line breaks           > line numbers can be shown:  544 + n
Block 4 has been read:     160 line breaks           > line numbers can be shown:  704 + n
Block 5 has been read:     360 line breaks           > line numbers can be shown: 1064 + n
Block 6 has been read:      83 line breaks           > line numbers can be shown: 1147 + n
Block 7 has not been read: line break number unknown > line numbers can not be shown
Block 8 has not been read: line break number unknown > line numbers can not be shown
Block 9 has not been read: line break number unknown > line numbers can not be shown
IMO this approach is very efficient. One would only need one array holding the number of line breaks in the blocks. You currently have to parse for the line breaks to show the block. There could be a wincmd.ini option: "CalculateLineNumbersInBackground" reading missing blocks in a background thread.

Hope I could
Post Reply