The Trunk: Morphic-nice.230.mcz

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

The Trunk: Morphic-nice.230.mcz

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

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

Name: Morphic-nice.230
Author: nice
Time: 17 November 2009, 2:13:52 am
UUID: a7f74e9f-dc9e-4e52-877f-b285683fd052
Ancestors: Morphic-nice.229

Fix selection of last line in case of LF delimiters
This was the awfully hard to find #fixupLastLineIfCR

=============== Diff against Morphic-nice.229 ===============

Item was changed:
  ----- Method: NewParagraph>>indentationOfLineIndex:ifBlank: (in category 'private') -----
  indentationOfLineIndex: lineIndex ifBlank: aBlock
  "Answer the number of leading tabs in the line at lineIndex.  If there are
  no visible characters, pass the number of tabs to aBlock and return its value.
  If the line is word-wrap overflow, back up a line and recur."
 
+ | arrayIndex first last crlf |
+ crlf := CharacterSet crlf.
- | arrayIndex first last cr |
- cr := Character cr.
  arrayIndex := lineIndex.
  [first := (lines at: arrayIndex) first.
+ first > 1 and: [crlf includes: (text string at: first - 1)]] whileTrue: "word wrap"
- first > 1 and: [(text string at: first - 1) ~~ cr]] whileTrue: "word wrap"
  [arrayIndex := arrayIndex - 1].
  last := (lines at: arrayIndex) last.
 
  ^(text string copyFrom: first to: last) indentationIfBlank: aBlock.
  !

Item was changed:
  ----- Method: TextComposer>>composeEachRectangleIn: (in category 'as yet unclassified') -----
  composeEachRectangleIn: rectangles
 
  | myLine lastChar |
 
  1 to: rectangles size do: [:i |
  currCharIndex <= theText size ifFalse: [^false].
  myLine := scanner
  composeFrom: currCharIndex
  inRectangle: (rectangles at: i)
  firstLine: isFirstLine
  leftSide: i=1
  rightSide: i=rectangles size.
  lines addLast: myLine.
  actualHeight := actualHeight max: myLine lineHeight.  "includes font changes"
  currCharIndex := myLine last + 1.
  lastChar := theText at: myLine last.
+ (CharacterSet crlf includes: lastChar) ifTrue: [^#cr].
- lastChar = Character cr ifTrue: [^#cr].
  wantsColumnBreaks ifTrue: [
  lastChar = TextComposer characterForColumnBreak ifTrue: [^#columnBreak].
  ].
  ].
  ^false!

Item was changed:
  ----- Method: TextComposer>>fixupLastLineIfCR (in category 'as yet unclassified') -----
  fixupLastLineIfCR
  "This awful bit is to ensure that if we have scanned all the text and the last character is a CR that there is a null line at the end of lines. Sometimes this was not happening which caused anomalous selections when selecting all the text. This is implemented as a post-composition fixup because I couldn't figure out where to put it in the main logic."
 
+ (theText size > 0 and: [CharacterSet crlf includes: theText last]) ifFalse: [^self].
- (theText size > 1 and: [theText last = Character cr]) ifFalse: [^self].
  self addNullLineForIndex: theText size + 1.
  !