Pretty Print bug?

Ned Konz ned at squeakland.org
Sun Jun 20 00:03:10 UTC 2004


On Saturday 19 June 2004 3:20 pm, Russell Penney wrote:
> That looks like the problem; I use the switch-ctrl-alt preference. Which
> method is it that does this madness? Maybe I should just use the Keymapping
> package.

It's not really the ctrl/alt swapping that's the problem. Here's why:


In Browser>>selectedMessage there is this code:

	(Sensor controlKeyPressed
		or: [method fileIndex > 0 and: [(SourceFiles at: method fileIndex) == nil]])
		ifTrue:
		["Emergency or no source file -- decompile without temp names"
		contents _ (class decompilerClass new decompile: selector in: class method: 
method)
			decompileString.
		contents _ contents asText makeSelectorBoldIn: class.
		^ contents copy].


But if you're accepting from the keyboard, you would have typed a Ctrl-S 
(which would be viewed as an Alt-S with the ctrl/alt swapped). So unless 
*both* the Control and Alt keys are down you'd never see the decompilation.

Hmm... my windowing system eats Ctrl-Alt combinations, I think. So I'd never 
see this (and besides, my Ctrl key is to the left of my A key and so is 
nowhere near my Alt key).

Anyway, maybe you're occasionally hitting the Ctrl *and* the Alt keys together 
or in quick succession when accepting the method.

And also there is this:

	Sensor leftShiftDown ifTrue:
		["Special request to decompile, old and dubious interface"
		^ self decompiledSourceIntoContents].

So if you happen to hit the SHIFT key immediately AFTER accepting but before 
the browser gets around to displaying the new text you get the decompilation.

But that decompilation would have its variable names.

So the one you're seeing is, I think, the Ctrl-Alt-S. Which would have the 
same problem with or without the swapped keys.

Anyway, does anyone use Ctrl-Alt-S to accept text and view decompiled code 
without variable names? Since our browsers have the "what to show" button 
easy to get to, I would imagine that this would be preferred.

Would there be any objection to either getting rid of this or making a 
Preference for it?

Here's the existing modes:

* Source
* Pretty-printed source
* Pretty-printed source with color
* Decompiled
* Decompiled without temp names -- Ctrl-Alt-S (I think this is the only way to 
get to this in Morphic, since holding the control key down will give you a 
control-menu when clicking on something).

Anyway, I think I can fix this. Stay tuned.
-- 
Ned Konz
http://bike-nomad.com/squeak/



More information about the Squeak-dev mailing list