pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.19k stars 351 forks source link

Rubric has wrong selection interval when selection is empty #2676

Closed jecisc closed 5 years ago

jecisc commented 5 years ago

Currently, Rubric returns an interval 1 to: 0 when the selection is empty. This is confusing because when I see a selection such as "1 to 0" I expect to get the first character selected from the right to the left.

To reproduce:

rub := RubTextFieldArea new setTextWith: 'Test'; yourself.

rub selectionInterval.

This can cause trouble in some projects such as Spec. When we clear the selection, Spec is saying that the selection should be 0 to: 0 but rubric set once again the selection to 1 to: 0.

StevenCostiou commented 5 years ago

After digging a bit:

So it seems that is not really a bug, but that it lacks comments.

plantec commented 5 years ago

This selection interval convention is inherited from PluggableTextMorph. It is like that since years. So not a bug and I don't see how it could be changed. In the future maybe when we will be able to drop Morphic and Rubric...

estebanlm commented 5 years ago

yup, I do not think this can be fix (or has sense to do it). I think is better to adapt Spec2.