Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005711 [Squeak] Morphic minor always 01-08-07 15:03 09-16-14 19:06
Reporter jreyes View Status public  
Assigned To nicolas cellier
Priority normal Resolution fixed  
Status resolved   Product Version 3.9
Summary 0005711: TextFieldMorph changes text position when emptied
Description Once initialized the TextFieldMorph displays an 'abc' text in the upper left corner. The text can be obviously edited but if you delete all the characters, the Morph changes its color to the default light gray and the text written after that doesnt appear in the top left corner anymore but one line below.
Additional Information "Sample code"
textMorph:=TextFieldMorph new openInWorld.
"At this point I delete all characters ('abc') mannually and write some new text"
textMorph fit. "After this, text goes to the corner again"

-------------
Pressing Alt-0 the new text goes back to the corner as well, but that behaviour should be default. This reported change in text position doesnt happen either if you select the 'abc' initial text and write some replacement, only when the TextFieldMorph is emptied.
Attached Files  Mantis 0005711 - FixTextFieldMorphLinePosition.1.cs.gz [^] (689 bytes) 08-07-08 04:15
 FixTextFieldMorphLinePosition-M5711-ASB.1.cs.gz [^] (638 bytes) 08-12-08 03:57

- Relationships

- Notes
(0012465 - 679 - 845 - 845 - 845 - 845 - 845)
Antony Blakey
08-07-08 00:01

If you do this:

  textField := TextFieldMorph new.
  textField contents: ''.
  textField extent: 400 @ 40.
  textField openInWorld.

and then this:

  event := KeyboardEvent new setType: #keystroke buttons: 0 position: 0@0 keyValue: $a asciiValue hand: nil stamp: 0.
  textField submorphs first handleKeystroke: event.

then the text is one line down. If you subsequently do this:

  textField append: 'a'.

then the text goes back to the first line. I suspect it has something to do with the null line, that is inserted when the content is empty, being incorrectly processed for keystrokes, possibly an error in an optimization. I am tracing this to find a fix.
 
(0012471 - 336 - 408 - 408 - 408 - 408 - 408)
Antony Blakey
08-07-08 04:01
edited on: 08-07-08 04:16

The bug is in TextComposer>>composeLinesFrom:to:delta:into:priorLines:atY:textStyle:text:container:wantsColumnBreaks:

When the null line is added, it uses "container topLeft", whereas the rest of the code use "container top", which for TextContainer is NOT the same as "topLeft y".

I've attached a changeset containing that fix.

 
(0012483 - 76 - 76 - 76 - 76 - 76 - 76)
Antony Blakey
08-12-08 03:57

Uploaded a properly-named change set after watching Ken Causey's screencast.
 
(0012486 - 180 - 190 - 190 - 190 - 190 - 190)
ScottWallace
08-12-08 22:43

Excellent catch, Antony! "Etoy" users are greatly affected by this bug, and I'll see to it that your fix gets into the olpc-etoys and Squeakland updates streams asap. Thank you!
 
(0012487 - 541 - 541 - 541 - 541 - 541 - 541)
ScottWallace
08-13-08 01:49

Actually, though in the image variant I was using I was able to reproduce the bug described above, and to verify that the proposed fix did work, I subsequently discovered that I could not reproduce the symptom in the current olpc/etoys and about-to-be-released squeakland images. So for the moment anyway I won't pursue pushing the change to those update streams. I don't yet understand what change(s) in those systems may have worked around the need for the fix, but I note that it wasn't any change to the method under discussion here...
 
(0012771 - 14 - 14 - 14 - 14 - 14 - 14)
MarcusDenker
11-16-08 16:41

in pharo 10151
 
(0014511 - 100 - 118 - 272 - 272 - 272 - 272)
nicolas cellier
09-16-14 19:06

Fixed in trunk 4.6
http://source.squeak.org/trunk/Graphics-topa.301.mcz [^]

Thanks Antony and Tobias
 

- Issue History
Date Modified Username Field Change
01-08-07 15:03 jreyes New Issue
08-06-08 23:44 Antony Blakey Issue Monitored: Antony Blakey
08-07-08 00:01 Antony Blakey Note Added: 0012465
08-07-08 04:01 Antony Blakey Note Added: 0012471
08-07-08 04:15 Antony Blakey File Added: Mantis 0005711 - FixTextFieldMorphLinePosition.1.cs.gz
08-07-08 04:16 Antony Blakey Note Edited: 0012471
08-12-08 03:57 Antony Blakey Note Added: 0012483
08-12-08 03:57 Antony Blakey File Added: FixTextFieldMorphLinePosition-M5711-ASB.1.cs.gz
08-12-08 22:43 ScottWallace Note Added: 0012486
08-13-08 01:49 ScottWallace Note Added: 0012487
11-16-08 16:41 MarcusDenker Note Added: 0012771
09-16-14 19:06 nicolas cellier Status new => resolved
09-16-14 19:06 nicolas cellier Fixed in Version  => trunk
09-16-14 19:06 nicolas cellier Resolution open => fixed
09-16-14 19:06 nicolas cellier Assigned To  => nicolas cellier
09-16-14 19:06 nicolas cellier Note Added: 0014511


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
72 total queries executed.
46 unique queries executed.
Powered by Mantis Bugtracker