The Trunk: ST80-nice.68.mcz

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

The Trunk: ST80-nice.68.mcz

commits-2
Nicolas Cellier uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-nice.68.mcz

==================== Summary ====================

Name: ST80-nice.68
Author: nice
Time: 16 November 2009, 5:51:16 am
UUID: 186aafc1-fc50-bb42-8376-d8873c66d460
Ancestors: ST80-nice.67

Handle more crlf cases

=============== Diff against ST80-nice.67 ===============

Item was changed:
  ----- Method: ParagraphEditor>>browseClassFromIt (in category 'menu messages') -----
  browseClassFromIt
  "Launch a browser for the class indicated by the current selection.
  If multiple classes matching the selection exist, let the user choose among them."
  | aBrow aClass |
  self
  lineSelectAndEmptyCheck: [^ self].
  aClass := Utilities
+ classFromPattern: (self selection string copyWithoutAll: CharacterSet separators)
- classFromPattern: (self selection string copyWithout: Character cr)
  withCaption: 'choose a class to browse...'.
  aClass
  ifNil: [^ view flash].
  self
  terminateAndInitializeAround:
  [aBrow := SystemBrowser default new.
  aBrow setClass: aClass selector: nil.
  aBrow class
  openBrowserView: (aBrow openEditString: nil) label: 'System Browser'].!

Item was changed:
  ----- Method: ParagraphEditor>>explainScan: (in category 'explain') -----
  explainScan: string
+ "Remove beginning and trailing separators (space, tab, cr,...)"
- "Remove beginning and trailing space, tab, cr.
- 1/15/96 sw: copied intact from BrowserCodeController"
 
+ ^string withBlanksTrimmed!
- | c beg end |
- beg := 1.
- end := string size.
-
- [beg = end ifTrue: [^string copyFrom: 1 to: 1].
- "if all blank, tell about the first"
- c := string at: beg.
- c = Character space or: [c = Character tab or: [c = Character cr]]]
- whileTrue: [beg := beg + 1].
-
- [c := string at: end.
- c = Character space or: [c = Character tab or: [c = Character cr]]]
- whileTrue: [end := end - 1].
- ^string copyFrom: beg to: end "Return purely visible characters"!

Item was changed:
  ----- Method: ParagraphEditor>>explainChar: (in category 'explain') -----
  explainChar: string
  "Does string start with a special character?"
 
  | char |
+ char := string at: 1.
- char _ string at: 1.
  char = $. ifTrue: [^'"Period marks the end of a Smalltalk statement.  A period in the middle of a number means a decimal point.  (The number is an instance of class Float)."'].
  char = $' ifTrue: [^'"The characters between two single quotes are made into an instance of class String"'].
  char = $" ifTrue: [^'"Double quotes enclose a comment.  Smalltalk ignores everything between double quotes."'].
  char = $# ifTrue: [^'"The characters following a hash mark are made into an instance of class Symbol.  If parenthesis follow a hash mark, an instance of class Array is made.  It contains literal constants."'].
  (char = $( or: [char = $)]) ifTrue: [^'"Expressions enclosed in parenthesis are evaluated first"'].
  (char = $[ or: [char = $]]) ifTrue: [^'"The code inside square brackets is an unevaluated block of code.  It becomes an instance of BlockContext and is usually passed as an argument."'].
  (char = ${ or: [char = $}]) ifTrue: [^ '"A sequence of expressions separated by periods, when enclosed in curly braces, are evaluated to yield the elements of a new Array"'].
  (char = $< or: [char = $>]) ifTrue: [^'"<primitive: xx> means that this method is usually preformed directly by the virtual machine.  If this method is primitive, its Smalltalk code is executed only when the primitive fails."'].
  char = $^ ifTrue: [^'"Uparrow means return from this method.  The value returned is the expression following the ^"'].
  char = $| ifTrue: [^'"Vertical bars enclose the names of the temporary variables used in this method.  In a block, the vertical bar separates the argument names from the rest of the code."'].
  char = $_ ifTrue: [^'"Left arrow means assignment.  The value of the expression after the left arrow is stored into the variable before it."'].
  char = $; ifTrue: [^'"Semicolon means cascading.  The message after the semicolon is sent to the same object which received the message before the semicolon."'].
  char = $: ifTrue: [^'"A colon at the end of a keyword means that an argument is expected to follow.  Methods which take more than one argument have selectors with more than one keyword.  (One keyword, ending with a colon, appears before each argument).', '\\' withCRs, 'A colon before a variable name just inside a block means that the block takes an agrument.  (When the block is evaluated, the argument will be assigned to the variable whose name appears after the colon)."'].
  char = $$ ifTrue: [^'"The single character following a dollar sign is made into an instance of class Character"'].
  char = $- ifTrue: [^'"A minus sign in front of a number means a negative number."'].
  char = $e ifTrue: [^'"An e in the middle of a number means that the exponent follows."'].
  char = $r ifTrue: [^'"An r in the middle of a bunch of digits is an instance of Integer expressed in a certain radix.  The digits before the r denote the base and the digits after it express a number in that base."'].
  char = Character space ifTrue: [^'"the space Character"'].
  char = Character tab ifTrue: [^'"the tab Character"'].
  char = Character cr ifTrue: [^'"the carriage return Character"'].
+ char = Character lf ifTrue: [^'"the line feed Character"'].
  ^nil!

Item was changed:
  ----- Method: ParagraphEditor>>changeLfToCr: (in category 'editing keys') -----
  changeLfToCr: characterStream
+ "Replace all LFs by CRs, and CR-LF pairs by single CRs.
- "Replace all LFs by CRs.
  Triggered by Cmd-U -- useful when getting code from FTP sites"
+
- | cr lf |
  sensor keyboard. "flush the triggering cmd-key character"
- cr := Character cr.  lf := Character linefeed.
  self replaceSelectionWith: (Text fromString:
+ (self selection string withSqueakLineEndings)).
- (self selection string collect: [:c | c = lf ifTrue: [cr] ifFalse: [c]])).
  ^ true!