Request: Virtual TextComponent


#1

Hi Jules!

It seems, the TextComponent is not suitable for a large textual content (approximately more than 1 Mb). The bigger its content is the slower it performs. Especially, this is an issue if the text is going to be syntactically highlighted (even more work to do).

I suggest to develop a virtual TextComponent that works like ListBoxComponent manages its items. This text component is supposed to display only the visible portion of a text that is currently in the view. It should ask (call back) a user function to provide the necessary rows every time the component needs to display different rows of a text. The user defined callback function is supposed to get row numbers that need to be displayed. Another user callback function is intended to manage text changes every time the user moves out from the changed row. This function is supposed to take a row number and the text that row contains. Even more, maybe several callback functions to handle row insertions, row deletions, row changes etc.

This way a very large text files can be mapped or be read into memory or even rows can be read directly from a file when needed and handled with ease.

So, Jules, what do you think about that?


#2

I don’t think it’d work! Well, not for anything like the existing text comp.

How could a user class provide the rows that it needs when there’s word-wrapping going on? It’s just not possible, because changing the width completely changes the line content.

As I think I mentioned elsewhere, I’ve got a half-written code editor component that I’d like to release at some point, and I think that sounds more like what you’re looking for?


#3

[quote=“jules”]I don’t think it’d work! Well, not for anything like the existing text comp.

How could a user class provide the rows that it needs when there’s word-wrapping going on? It’s just not possible, because changing the width completely changes the line content.

As I think I mentioned elsewhere, I’ve got a half-written code editor component that I’d like to release at some point, and I think that sounds more like what you’re looking for?[/quote]

Yes, you’re absolutely right. My post was exactly about source code editing component.

Ok. How long to wait for your code approximately? Can’t help waiting to dig into it :slight_smile: