Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

pharo
Status: Accepted
Owner: [hidden email]

New issue 3472 by [hidden email]: Text selection problem in  
Pharo-dev 1.2
http://code.google.com/p/pharo/issues/detail?id=3472

- loaded the ConfigurationOfPharo to create a pharo-dev from a core 1.2
- in the welcome workspace evaluate the "ProfStef go"
- a new window pops up ("Hello! I'm Professor Stef blah)
- run the provided "ProfStef next" from this workspace, the tutorial will  
change to page (2/27)
- now set the cursor behind the provided "ProfStef next." expression and  
select the text by dragging from right to left
-> error: #basicNew: failed

Reason:
- when selecting the text from right to left a negative size is calculated  
for the string allocation, see this stack:


ByteString class(Object)>>error:
        Receiver: ByteString
        Arguments and temporary variables:
                aString: 'basicNew: failed'
        Receiver's instance variables:
                superclass: String
                methodDict: a  
MethodDictionary(#asByteArray->(ByteString>>#asByteArray "a Compi...etc...
                format: 23554
                instanceVariables: nil
                organization: ('accessing' at: at:put: byteAt: byteAt:put: byteSize  
indexOfAnyO...etc...
                subclasses: nil
                name: #ByteString
                classPool: a Dictionary(#NonAsciiMap->#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  
0 0 0 0...etc...
                sharedPools: nil
                environment: a SystemDictionary(lots of globals)
                category: #'Collections-Strings'
                traitComposition: {}
                localSelectors: nil

ByteString class(Object)>>primitiveFailed:
        Receiver: ByteString
        Arguments and temporary variables:
                selector: #basicNew:
        Receiver's instance variables:
                superclass: String
                methodDict: a  
MethodDictionary(#asByteArray->(ByteString>>#asByteArray "a Compi...etc...
                format: 23554
                instanceVariables: nil
                organization: ('accessing' at: at:put: byteAt: byteAt:put: byteSize  
indexOfAnyO...etc...
                subclasses: nil
                name: #ByteString
                classPool: a Dictionary(#NonAsciiMap->#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  
0 0 0 0...etc...
                sharedPools: nil
                environment: a SystemDictionary(lots of globals)
                category: #'Collections-Strings'
                traitComposition: {}
                localSelectors: nil

ByteString class(Object)>>primitiveFailed
        Receiver: ByteString
        Arguments and temporary variables:

        Receiver's instance variables:
                superclass: String
                methodDict: a  
MethodDictionary(#asByteArray->(ByteString>>#asByteArray "a Compi...etc...
                format: 23554
                instanceVariables: nil
                organization: ('accessing' at: at:put: byteAt: byteAt:put: byteSize  
indexOfAnyO...etc...
                subclasses: nil
                name: #ByteString
                classPool: a Dictionary(#NonAsciiMap->#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  
0 0 0 0...etc...
                sharedPools: nil
                environment: a SystemDictionary(lots of globals)
                category: #'Collections-Strings'
                traitComposition: {}
                localSelectors: nil

ByteString class(Behavior)>>basicNew:
        Receiver: ByteString
        Arguments and temporary variables:
                sizeRequested: -1
        Receiver's instance variables:
                superclass: String
                methodDict: a  
MethodDictionary(#asByteArray->(ByteString>>#asByteArray "a Compi...etc...
                format: 23554
                instanceVariables: nil
                organization: ('accessing' at: at:put: byteAt: byteAt:put: byteSize  
indexOfAnyO...etc...
                subclasses: nil
                name: #ByteString
                classPool: a Dictionary(#NonAsciiMap->#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  
0 0 0 0...etc...
                sharedPools: nil
                environment: a SystemDictionary(lots of globals)
                category: #'Collections-Strings'
                traitComposition: {}
                localSelectors: nil

ByteString class(String class)>>new:
        Receiver: ByteString
        Arguments and temporary variables:
                sizeRequested: -1
        Receiver's instance variables:
                superclass: String
                methodDict: a  
MethodDictionary(#asByteArray->(ByteString>>#asByteArray "a Compi...etc...
                format: 23554
                instanceVariables: nil
                organization: ('accessing' at: at:put: byteAt: byteAt:put: byteSize  
indexOfAnyO...etc...
                subclasses: nil
                name: #ByteString
                classPool: a Dictionary(#NonAsciiMap->#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  
0 0 0 0...etc...
                sharedPools: nil
                environment: a SystemDictionary(lots of globals)
                category: #'Collections-Strings'
                traitComposition: {}
                localSelectors: nil

ByteString(SequenceableCollection)>>copyFrom:to:
        Receiver: '"Now you''re a Do It master ! Let''s talk about printing. It''s  
a Do It which prints the ...etc...
        Arguments and temporary variables:
                start: 550
                stop: 548
                newSize: -1
        Receiver's instance variables:
'"Now you''re a Do It master ! Let''s talk about printing. It''s a Do It  
which prints the ...etc...

Text>>copyFrom:to:
        Receiver: a Text for '"Now you''re a Do It master ! Let''s talk about  
printing. It''s a Do It which ...etc...
        Arguments and temporary variables:
                start: 550
                stop: 563
                realStart: 550
                realStop: 548
        Receiver's instance variables:
                string: '"Now you''re a Do It master ! Let''s talk about printing. It''s  
a Do I...etc...
                runs: a RunArray runs: #(212 2 1 1 1 1 1 1 2 166 2 4 1 5 1 2 4 1 3 1 2  
79 2 14 ...etc...

SmalltalkEditor(TextEditor)>>selection
        Receiver: a SmalltalkEditor
        Arguments and temporary variables:

        Receiver's instance variables:
                morph: a TextMorphForEditView(1029177344)
                selectionShowing: true
                model: a LessonView
                editingState: a SmalltalkEditingState

Compiler>>evaluate:in:to:notifying:ifFail:logged:
        Receiver: a Compiler
        Arguments and temporary variables:
                textOrStream: a ReadWriteStream '"Cool ! (I like to say Cooool :) ).  
You''ve ju...etc...
                aContext: nil
                receiver: nil
                aRequestor: a SmalltalkEditor
                failBlock: [FakeClassPool adopt: nil.
        ^ #failedDoit]
                logFlag: true
                methodNode: DoIt
        ^ ProfStef next
                method: (UndefinedObject>>#DoIt "a CompiledMethod(687603712)")
                value: a LessonView
                toLog: nil
                itsSelection: nil
                itsSelectionString: nil
        Receiver's instance variables:
                sourceStream: a ReadWriteStream '"Cool ! (I like to say Cooool :) ).  
You''ve ju...etc...
                requestor: a SmalltalkEditor
                class: UndefinedObject
                category: nil
                context: nil
                parser: a Parser

[rcvr class evaluatorClass new
                evaluate: self selectionForDoitAsStream
                in: ctxt
                to: rcvr
                notifying: self
                ifFail: [FakeClassPool adopt: nil.
                        ^ #failedDoit]
                logged: true] in SmalltalkEditor>>evaluateSelection
        Receiver: a SmalltalkEditor
        Arguments and temporary variables:
                rcvr: nil
                ctxt: nil
        Receiver's instance variables:
                morph: a TextMorphForEditView(1029177344)
                selectionShowing: true
                model: a LessonView
                editingState: a SmalltalkEditingState

BlockClosure>>on:do:
        Receiver: [rcvr class evaluatorClass new
                evaluate: self selectionForDoitAsStream
                in: ctxt
                to: ...etc...
        Arguments and temporary variables:
                exception: OutOfScopeNotification
                handlerAction: [:ex | ex resume: true]
                handlerActive: true
        Receiver's instance variables:
                outerContext: SmalltalkEditor>>evaluateSelection
                startpc: 116
                numArgs: 0

SmalltalkEditor>>evaluateSelection
        Receiver: a SmalltalkEditor
        Arguments and temporary variables:
                result: nil
                rcvr: nil
                ctxt: nil
        Receiver's instance variables:
                morph: a TextMorphForEditView(1029177344)
                selectionShowing: true
                model: a LessonView
                editingState: a SmalltalkEditingState

SmalltalkEditor>>doIt
        Receiver: a SmalltalkEditor
        Arguments and temporary variables:

        Receiver's instance variables:
                morph: a TextMorphForEditView(1029177344)
                selectionShowing: true
                model: a LessonView
                editingState: a SmalltalkEditingState



Reply | Threaded
Open this post in threaded view
|

Re: Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

pharo
Updates:
        Labels: Milestone-1.2-DevImage

Comment #1 on issue 3472 by marcus.denker: Text selection problem in  
Pharo-dev 1.2
http://code.google.com/p/pharo/issues/detail?id=3472

(No comment was entered for this change.)


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

pharo

Comment #2 on issue 3472 by aplantec: Text selection problem in Pharo-dev  
1.2
http://code.google.com/p/pharo/issues/detail?id=3472

It comes from SmalltalkEditor>>evaluateSelection
....
rcvr class evaluatorClass new
             evaluate: self selectionForDoitAsStream
             in: ctxt
             to: rcvr
             notifying: editor
             ifFail: [FakeClassPool adopt: nil. ^ #failedDoit]
             logged: true.
...
where the editor is passed as the requestor to Compiler>>  
evaluate:in:to:notifying:ifFail:logged:.
It is bad because as a result of 'ProfStef next', the textMorph is set with  
a new text and as a board effect the morph paragraph/editor are released.
So the editor morph should be passed instead of the editor itself.
A fix is coming soon.






Reply | Threaded
Open this post in threaded view
|

Re: Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

pharo
Updates:
        Status: Fixed

Comment #3 on issue 3472 by aplantec: Text selection problem in Pharo-dev  
1.2
http://code.google.com/p/pharo/issues/detail?id=3472

In InBox
SLICE-Issue-3472-Text-selection-problem-in-Pharo-dev-12


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

pharo
Updates:
        Status: Closed
        Labels: -Milestone-1.2-DevImage Milestone-1.2

Comment #4 on issue 3472 by marcus.denker: Text selection problem in  
Pharo-dev 1.2
http://code.google.com/p/pharo/issues/detail?id=3472

12284


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

pharo
Updates:
        Status: Fixed

Comment #5 on issue 3472 by aplantec: Text selection problem in Pharo-dev  
1.2
http://code.google.com/p/pharo/issues/detail?id=3472

too fast Marcus :)
In the case the text is to be changed by the compiler (correction of a  
message name), 4 methods a lacking in textMorph.
try to evaluate:
Smalltalk curent
=> DNU because TextMorph does no implement #correctFrom: to:, #select,  
#deselect and #selectInvisiblyFrom: to:

in InBox
SLICE-Issue-3472-Text-selection-problem-in-Pharo-dev-12-Part-2


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

pharo
Updates:
        Cc: stephane.ducasse

Comment #6 on issue 3472 by laurent.laffont: Text selection problem in  
Pharo-dev 1.2
http://code.google.com/p/pharo/issues/detail?id=3472

Issue 3453 has been merged into this issue.


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

pharo
Updates:
        Status: Closed

Comment #7 on issue 3472 by stephane.ducasse: Text selection problem in  
Pharo-dev 1.2
http://code.google.com/p/pharo/issues/detail?id=3472

Thanks a lot alain.
Now in 12285


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

pharo
Updates:
        Status: Fixed
        Labels: Milestone-1.3

Comment #8 on issue 3472 by [hidden email]: Text selection problem in  
Pharo-dev 1.2
http://code.google.com/p/pharo/issues/detail?id=3472

in inbox,
SLICE-Issue-3472-smalltalkEditor-evaluateSelection-fix
should be ok for 1.2 and 1.3



Reply | Threaded
Open this post in threaded view
|

Re: Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

pharo

Comment #9 on issue 3472 by [hidden email]: Text selection problem  
in Pharo-dev 1.2
http://code.google.com/p/pharo/issues/detail?id=3472

Thanks a lot alain.
This is because there are people like you that this communaute is great.

Stef


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

pharo

Comment #10 on issue 3472 by [hidden email]: Text selection problem  
in Pharo-dev 1.2
http://code.google.com/p/pharo/issues/detail?id=3472

in 12329


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3472 in pharo: Text selection problem in Pharo-dev 1.2

pharo
Updates:
        Status: Closed

Comment #11 on issue 3472 by [hidden email]: Text selection problem  
in Pharo-dev 1.2
http://code.google.com/p/pharo/issues/detail?id=3472

in 13034