pharo-spec / Spec

Spec is a framework in Pharo for describing user interfaces.
MIT License
61 stars 63 forks source link

Code presenter: fix subscription to interaction model changed #1567

Open tinchodias opened 3 months ago

tinchodias commented 3 months ago

Code presenter breaks the general presenter-adapter spec2 pattern when it subscribes itself via whenInteractionModelChangedDo:. Normally, the Morphic adapter subscribe on their buildWidget.

https://github.com/pharo-spec/Spec/blob/b4d3215a1f4edc4d6385de5084d0c36614b50195/src/Spec2-Code/SpCodePresenter.class.st#L653-L658

tinchodias commented 3 months ago

Same happens in other properties of text presenter with selection: there is whenSelectionChangedDo: available, but when adapter is informed in this way:

updateSelectionFromModel: aSelection

    self withAdapterDo: [ :anAdapter | 
        anAdapter setSelectionFromModel: aSelection ]

But also others: look at senders of withAdapterDo:. So I may be wrong with this issue.