Styled text from file-in?

shaping at bigfoot.com shaping at bigfoot.com
Thu Sep 2 06:31:05 UTC 1999


Hi.

Can can someone tell me how to file-in text and apply its style chunk?
The method below skips the style chunk:

[ReadWriteStream>>]
fileInAnnouncing: announcement
"This is special for reading expressions from text that has been formatted
 with exclamation delimitors. The expressions are read and passed to the
 Compiler. Answer the result of compilation.  Put up a progress report with
     the given announcement as the title."
 | val chunk |
 announcement displayProgressAt: Sensor cursorPoint
  from: 0 to: self size
  during:
  [:bar |
  [self atEnd]
   whileFalse:
    [bar value: self position.
    self skipSeparators.
    val _ (self peekFor: $!)
     ifTrue: [(Compiler evaluate: self nextChunk logged: false)
        scanFrom: self]
     ifFalse: [chunk _ self nextChunk.
       self checkForPreamble: chunk.
       Compiler evaluate: chunk logged: true].
    self skipStyleChunk].
  self close].
 ^ val


I suppose I have to convert the style chunk into an appropriate
text-attribute run array and apply it to the text before it is compiled.  I
don't see any examples of how this is done.  Any pointers would be
appreciated.


Regards,

Shaping





More information about the Squeak-dev mailing list