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

Gerald Klix cuis.01 at klix.ch
Fri Aug 6 10:17:01 PDT 2021


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
> 
> 
> 
> 
> 
-------------- next part --------------
'From Haver 5.0 [latest update: #4738] on 6 August 2021 at 7:13:47 pm'!

!Preferences class methodsFor: 'misc' stamp: 'KLG 8/6/2021 19:12:05'!
inspectStringsLiteraly
	"Answer true if the inspector should display string as the are."

	self valueOfFlag: #inspectStringsLiteraly ifAbsent: [ true ]! !


!Inspector methodsFor: 'selecting' stamp: 'KLG 8/6/2021 19:06:30'!
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]]! !



More information about the Cuis-dev mailing list