Text.st
changeset 408 90799280d574
parent 407 a6e616d1d1bc
child 409 7e8c2457d5f3
equal deleted inserted replaced
407:a6e616d1d1bc 408:90799280d574
   513      and return string or text object containing those characters.
   513      and return string or text object containing those characters.
   514      If either the receiver or the argument contains emphasis information,
   514      If either the receiver or the argument contains emphasis information,
   515      a text object will be returned. Otherwise, a string (i.e. without emphasis)
   515      a text object will be returned. Otherwise, a string (i.e. without emphasis)
   516      is returned."
   516      is returned."
   517 
   517 
   518     (aStringOrText hasChangeOfEmphasis 
   518     aStringOrText hasChangeOfEmphasis ifTrue:[
   519     or:[self hasChangeOfEmphasis]) ifTrue:[
       
   520         ^ self species new
   519         ^ self species new
   521             string:(string , aStringOrText)
   520             string:(string , aStringOrText)
   522             emphasisCollection:(runs , aStringOrText emphasisCollection)
   521             emphasisCollection:(runs , aStringOrText emphasisCollection)
       
   522     ].
       
   523     runs notNil "self hasChangeOfEmphasis" ifTrue:[
       
   524         ^ self species new
       
   525             string:(string , aStringOrText)
       
   526             emphasisCollection:(runs copy add:nil withOccurrences:(aStringOrText size); yourself)
   523     ].
   527     ].
   524     ^ string , aStringOrText string
   528     ^ string , aStringOrText string
   525 
   529 
   526     "
   530     "
   527      ('hello' asText allBold) , ' world'    
   531      ('hello' asText allBold) , ' world'    
   528      'hello' , (' world' asText allBold)
   532      'hello' , (' world' asText allBold)
   529      'hello' , ' world'
   533      'hello' , ' world'
   530      ('hello' asText allBold) , (' world' asText allBold)
   534      ('hello' asText allBold) , (' world' asText allBold)
   531     "
   535     "
   532 
   536 
   533     "Modified: 16.5.1996 / 11:17:40 / cg"
   537     "Modified: 11.7.1996 / 13:22:39 / cg"
   534 !
   538 !
   535 
   539 
   536 concatenateFromString:aString
   540 concatenateFromString:aString
   537     "return the concatenation of aString and myself.
   541     "return the concatenation of aString and myself.
   538      This may be a Text (if I have emphasis) or a string (if not)."
   542      This may be a Text (if I have emphasis) or a string (if not)."
  1120 ! !
  1124 ! !
  1121 
  1125 
  1122 !Text  class methodsFor:'documentation'!
  1126 !Text  class methodsFor:'documentation'!
  1123 
  1127 
  1124 version
  1128 version
  1125     ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.24 1996-07-11 08:12:14 cg Exp $'
  1129     ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.25 1996-07-11 11:23:28 cg Exp $'
  1126 ! !
  1130 ! !
  1127 Text initialize!
  1131 Text initialize!