[Cuis-dev] Displaying TextEditor as not dirty when saved contents are equal to current edits

Mariano Montone marianomontone at gmail.com
Sat Nov 19 13:37:49 PST 2022


Hi guys,

this change broke some of my text editing morphs. I can fix them using a 
custom PluggableTextModel subclass, but, the problem is in the #isDirty 
implementation in TextModelMorph:

isDirty

     textGetter ifNil: [ 
^ super isDirty ].
     
^ ((textProvider perform: textGetter) = (CodeProvider 
normalizeCodeForCodeFiles: actualContents)) not.

That normalization for comparing text is ok for Smalltalk code, but not 
for a generic text model, which I think PluggableTextModel should be 
able to be used with.

How about removing that #isDirty implementation in PluggableTextModel 
and use a SmalltalkCodeTextModel or similar with that implementation of 
#isDirty for when working with Smalltalk code?


        Mariano


El 15/11/22 a las 14:16, Juan Vuletich via Cuis-dev escribió:
> On 11/12/2022 8:58 PM, Santiago Cubino via Cuis-dev wrote:
>> Hello,
>>
>> My name is Santiago Cubino, I'm a student at UBA. I was recently 
>> introduced to Smalltalk and Cuis.
>>
>> I think it would be nice if Cuis detected that a TextEditor is free 
>> of changes when you are editing code, and for some reason regret the 
>> changes by undoing or editing it back to what it was before.
>>
>> Some IDEs already implement this by checking the undo-redo three, so 
>> that if you are standing in the same point that the one the file was 
>> saved, the file is marked free of edits.
>>
>> Maybe, in Cuis, it would be better to even detect this by checking 
>> directly if the acceptedChanges differ from the currentChanges. So 
>> that if you add code and then remove it, the editor shows as pristine.
>>
>> Below is attached a .cs with my implementation of the feature. I'm 
>> open to critics and suggestions.
>>
>> Cheers
>> Santiago.
>
> Hi Santiago,
>
> Welcome to the Cuis community!
>
> Great contribution. The implementation is spot on. I just pushed it to 
> github. I also added you as a known Cuis contributor.
>
> Thanks!
>



More information about the Cuis-dev mailing list