[Cuis-dev] [IMPROV] Re: I think i found a bug in the debugger

Juan Vuletich juan at jvuletich.org
Sat Aug 7 12:54:06 PDT 2021


I don't think the preference is needed. What about simply:

selectionPrintString
     "Returns the current selection as a string"
     ^ self safelyPrintWith: [
         self selection printTextLimitedTo: self printStringLimit ].

?

Thanks,

-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich


On 8/6/2021 2:17 PM, Gerald Klix via Cuis-dev wrote:
> Nicola,
>
> I always thought this is on purpose, but did
> not like it.
> If you look at Inspector>>#selectionPrintString
>
> --- snip ---
> selectionPrintString
>     "Returns the current selection as a string"
>     ^self safelyPrintWith: [
>         | selectedValue |
>         selectedValue _ self selection.
>         (selectedValue is: #String)
>             ifTrue: [ selectedValue ]
>             ifFalse: [ selectedValue printTextLimitedTo: self 
> printStringLimit]]
> --- snap ---
> it has a special case for strings, confirming my suspicion.
>
> If you use this method implementation instead
> --- Schnipp ---
> selectionPrintString
>     "Returns the current selection as a string"
>     ^self safelyPrintWith: [
>         | selectedValue |
>         selectedValue _ self selection.
>         (selectedValue is: #String) and: [ Preferences 
> inspectStringsLiteraly ] ::
>             ifTrue: [ selectedValue ]
>             ifFalse: [ selectedValue printTextLimitedTo: self 
> printStringLimit]]
> --- Schnapp ---
> we will get the behavior you desired.
> Please note the inspectStringsLiteraly-method, that
> defaults to false when not implemented, by virtur
> of Preferences DNU logic.
>
> The attached change set makes the inspector configurable
> but retains the old behavior.
> Maybe we can convince Juan to integrate that improvement.
>
> HTH and Best Regards,
>
> Gerald
>
>
> On 8/6/21 6:14 PM, Nicola Mingotti via Cuis-dev wrote:
>>
>> Hi guys,
>>
>> I hit a stupid bug today ... to find it was nasty, i think because
>> the debugger does not show what (at least I) would expect.
>>
>> Please see the attached picture here:
>> https://pasteboard.co/KeEwgAy.png
>>
>> If you look at the debugger bottom right pane you think
>> that 'aStringRepr' is nil, right? Well, it is not so,
>> If you inspect it, see inspector in the middle of the screen,
>> you see it actually is 'nil', that is a String containing a 3 letter 
>> value.
>>
>> This happens also for numbers, if they are inside Strings the debugger
>> does not show eg: '123', but 123. That is some kind of "print 
>> representation".
>>
>> I think this is very much undesirable and an unexpected behavior,
>> at least for a beginner;)
>>
>> bye
>> Nicola
>>


More information about the Cuis-dev mailing list