Hi. 2015-11-27 8:57 GMT+01:00 Nicolai Hess <[email protected]>:
> Impressive! > How does it compare to Rubric or TxText ? > Rubric based on top of old Text objects. > I see some similarities with TxText (and you worked on TxText too?). Does > it mean this is a more complete version of TxText. With similar > core and/or the same design. > Yes. Twisty was born from TxText. My contribution to It was only about editors and layouts. There was only text model at that time. And it state was not good. I realized that active text model will simplify anything. My idea was that text should announce any change. Cursor objects should subscribe on it and automatically restore state after changes. Without this logic any code which modifies text should know about any cursors and selections to restore it state. I start refactor text model to implement my idea. And at that point Igor join project again. His idea was different. He not like active text. He was think that cursors should be immutable text positions. And any problems with it should be solved at higher level (not at text model level). Igor worked on it full time. But I had very limited free time for this. So I decided to fork this project and slowly implement my idea. It was interesting what it can provide. And now Twisty and TxText has no common parts. But structure of text model is very similar. It is kind of linked list. There is big difference how text morphs build layouts and show it contents. Igor implemented very nice approach to layout and show only visible parts of text. I'm not done it yet. But I implemented very optimized layout restoring algorithm where layout is not rebuilt completely after changes but only small parts of it is fixed. So no full scanning of text after changes. But for the first time morph layouts full text. And it take time for big texts. It should not be very difficult to implement Igor approach (Twisty already know how to layout text regions). But it adds some complexity and I have no time for this . For some cases different optimization should be done. If you want to show big text file you definitely don't want to load all this file into memory to build full text instance. Only visible part of file should be loaded as text and then you will need to show it fully. This case not requires current logic of TxText. It is different. I know it will be better if Twisty will be based on TxText. But it is not. And I not know how difficult to implement same editors with TxText. Twisty implements active model to make it easy. > All classes are commented +1 for Twy -1 for Rubric :) > You should read it first :). I am sure comments should be improved. What I like about rubrics textcomponents are the Text/Line decorations like > in RubLipsumWithSegmentsExample (see screenshot). > > Does Twy support this too? Something can be done now. Something not :). In Twisty you extend TwyTextMorph by implementing new kind of text tool TwyTextTool. For example look at TwySelectionTool. Text selection is actually same kind of decoration as underlines in rubric example. It shows selected region with specific background. Any tool in Twisty can provide "drawing text decoration" which can draw required text regions specifically. Of course current hooks are not enough for particular cases. For example line numbers and icons on text margins are not supported. For that tools should be able to build margins and draw something on it. Another absent thing: TwyTextMorph works with text instance. There is no way how to open it on text region. I saw such examples in Rubric when selected region was shown on separate panel. I want make text and text regions polymorphic to allow this case.
