BTextView linenumbers

Is it possible to create a line number in a BTextView in a simple way. Especially if the text is longer than the view and is therefore wrapped.

Would anyone have an example of how something like this could be implemented?

as an example. This example is a merged screenshot.


1 Like

Koder seems to use BScintillaView to do that. I don’t know if BTextVIew can but there’s a source package in HaikuDepot if you want to see how it does it.

BTextView does not support line numbers but adding them would be fairly trivial (for me anyway) since beta3. You’d have to add get/set methods (document), set the left inset, draw the bg and line numbers (stored in lines array along with line height) and add a setting in StyledEdit to turn line numbers on and off (used to test.)

1 Like

Thanks for the answers. I will look.

Regards lorglas