John Levon wrote: > Hopefully one day we will have a simple cursor class that is an iterator > on a document, and another class that has one of those and a pixel > offset (for passing mouse clicks around or something). But that's some > way off I suppose.
I don't know really. Each time I make my mind, I feel tempted to change it. I've implemented the change by keeping a (par,pos) as a fixed reference, and it works pretty well (attached). Here we have: public: int top_y() const; void top_y(int newy); private: top_par_; top_pos_; top_pos_offset_; Then top_y(int newy) finds a (par,pos) near newy and stores them with the offset of its position wrt newy. The problem would be obviously when we delete the reference par. I haven't been able to fire this bug, because it seems that always that a par is deleted, then void top_y(int) is called before int top_y(). But I haven't tried so much, and it seems buggy anyway. What about keeping an up-to-date int top_row_, that is we increment top_row if we add a row before, decrement it if we delete a row before? Right now I'm pretty convinced that this is the right solution. What do you (all) think? Alfredo