Status: Accepted
Owner: torsten....@astares.de

New issue 3472 by torsten....@astares.de: 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 via email to