Re: Custom TextBuffer

On 08/29/2015 09:22 PM, Rena wrote:
This information is generated on the fly and would span millions of
lines that the user can page through.

Keep in mind that a non-pageable b-tree is used to track various
information about the text so the view has fast access to it.

I don't think GtkTextBuffer can do what you want as a subclass, nor will
it gracefully handle "unbound" input length. GtkTextIter returns an int
for character offset, so you are at least restricted to 31-bit
addressing (read: 2Gb).

I'd start by trying to open a 1Gb file. That is going to be the trivial
case of your dynamic text generation. If it can't handle that well, then
even if the buffer could dynamically generate content, the view won't
keep up. Keep in mind it needs to size all the text rows so that it can
know about line heights and how big the rendered content would be. (It
does this lazily, but still).

You might want to look at how Vte does it's scrollback. If you don't
need any sort of syntax highlighting or exotic pango layouts or word
wrapping, you might be able to do your own thing. It will be a lot
simpler code if all the line heights are the same anyway.

Good Luck,

-- Christian

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]