2012/10/23 Igor Stasenko <[email protected]> > Take a look at http://www.smalltalkhub.com/#!/~sig/TxText > > there's already a working (since tests are green ;) > implementation of new text model. > And, as you said, you don't have to deal with hardcoded stuff. > The text model provides a 'position' API, > which can be used to navigate text directly: > - moveLeft, moveRight, lineUp, lineDown etc > There's also a 'selection' model, which allows you to 'cut' , or > 'replace' portions > of text at given position. > So, the text model designed by having text editor in mind. > I am working on making attributes work for it (bold/italic etc).. > and then renderer, layouting and editor(s). > > Well, actually editor will be most simplest piece of puzzle after i > finish all the bottom layers :) >
Ok. I look at code. Nice design. Good tests. When I experimented with my implementation (very little) I also introduced cursor object which was responsible for moving, inserting and deletion characters and holds position in text. I stop my experiment when I start think about text layout and how it can influence "cursor behaviour". You have #moveDown method to move cursor down to next line. But how you consider implement this for "visual text lines" which created by text layout without CR separator? Do you consider rebuild TextModel instance when text bounds will changed? (to reflect visual lines state). Same questions about text selection. How to track selection positions when text bounds changed and it influence visual lines state?
