On 22 November 2012 12:32, Igor Stasenko <[email protected]> wrote:
> On 22 November 2012 11:47, Stephan Eggermont <[email protected]> wrote:
>> Hi Igor,
>>
>> The TxText model to me seems to mix two concerns.
>> The storage of the text and manipulating it? Both cursor positioning
>> and selection manipulation are view dependent, and there might
>> be more than one.
>>
>
> No. Please read my other replies to topic.
>
> - you have text model
> - you have positions (in text)
> - you have selection which is two positions
> - you define operations, like insert, cut, replace which involving
> text and positions in them.
> - you cannot manipulate(edit) text without using positions
>
> where you see view dependent stuff?
> It is completely orthogonal.
>

perhaps you talking about 'selection' which is part of TxModel state?
then i agree that we may need to separate concerns here:
 - text storage
 - text selection.

but you can do it even right now:

| text selection |
text := TxModel new.
selection := TxSelection on: text.

selection replaceWith: 'ABC'.
selection all.
selection start moveRight.
selection end moveLeft.
selection replaceWith: '---'.
text asString
 'A---C'

i think we should remove 'selection' from TxModel class.
And instead provide a protocol for getting a new one, i.e.:

selection := text newSelection.


-- 
Best regards,
Igor Stasenko.

Reply via email to