20140501 Buffer Plans

Embarrassingly, I’ve been stuck thinking about a pretty simple problem involving encapsulating the buffer data in such a way that I can format individual sections of it. I’m leaning towards packaging the buffer segments in one form of data initially when the window dimensions are known:

 "text":  [text of some uniform format],
 "style": [some standard style - probably for amending ctx.font],
 "type":   [plaintext or hyperlink], 
 "action": [further defined if "type" is "hyperlink" - performs a 
           command once the hyperlink is clicked.]

… and then simply organizing this data into lines in a buffer printing object. The buffer printing object would be largely identical, except that a) the objects follow wordwrapping rules according to the size of the window, so the text is trimmed; b) the buffer printing object could be caching the computed data but must be updated whenever the window’s size changes; c) would have smaller helper functions that add to the buffer printing object that would add individual lines to the raw buffer object and the buffer printing object. This second object and how it would work has been where I’ve been stuck, although it’s a pretty simple set of problems once you think about it. It’s just breaking those problems down that’s been the problem. Maybe I just need to write it out. Maybe that’s what I’m doing now!

I shall think about this more later tonight.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.