Tools__CodeView2.st
branchjv
changeset 12807 ba8c5416aa28
parent 12678 d6e678a09423
parent 12783 b52f85ed724e
child 12819 0ce340e972c4
equal deleted inserted replaced
12806:d550d7de8e2d 12807:ba8c5416aa28
  1915             changedSource := textView contentsAsString asStringCollection.
  1915             changedSource := textView contentsAsString asStringCollection.
  1916         ].
  1916         ].
  1917     changedSource := changedSource collect:[:line | line string withoutTrailingSeparators withTabsExpanded].
  1917     changedSource := changedSource collect:[:line | line string withoutTrailingSeparators withTabsExpanded].
  1918     changedSource := changedSource collect:[:line | line isEmpty ifTrue:[nil] ifFalse:[line]].
  1918     changedSource := changedSource collect:[:line | line isEmpty ifTrue:[nil] ifFalse:[line]].
  1919     [changedSource size > 0 and:[changedSource last isNil]] whileTrue:[
  1919     [changedSource size > 0 and:[changedSource last isNil]] whileTrue:[
  1920         changedSource := changedSource copyWithoutLast:1
  1920         changedSource := changedSource copyButLast:1
  1921     ].
  1921     ].
  1922     changedSource := changedSource asString.
  1922     changedSource := changedSource asString.
  1923 
  1923 
  1924         originalSource := textView model value ? ''.
  1924         originalSource := textView model value ? ''.
  1925 
  1925 
  1926         originalSource := originalSource asStringCollection.
  1926         originalSource := originalSource asStringCollection.
  1927         originalSource := originalSource collect:[:line | line string withoutTrailingSeparators withTabsExpanded].
  1927         originalSource := originalSource collect:[:line | line string withoutTrailingSeparators withTabsExpanded].
  1928         originalSource := originalSource collect:[:line | line isEmpty ifTrue:[nil] ifFalse:[line]].
  1928         originalSource := originalSource collect:[:line | line isEmpty ifTrue:[nil] ifFalse:[line]].
  1929         [originalSource size > 0 and:[originalSource last isNil]] whileTrue:[
  1929         [originalSource size > 0 and:[originalSource last isNil]] whileTrue:[
  1930             originalSource := originalSource copyWithoutLast:1
  1930             originalSource := originalSource copyButLast:1
  1931         ].
  1931         ].
  1932 
  1932 
  1933         s1 := originalSource asString.
  1933         s1 := originalSource asString.
  1934         s2 := changedSource asString.
  1934         s2 := changedSource asString.
  1935         modified := (s1 ~= s2).
  1935         modified := (s1 ~= s2).
  2922     before the patch will be pushed up"
  2922     before the patch will be pushed up"
  2923 
  2923 
  2924     |soCol wasOn lineNrAboveCursor ln prevTab|
  2924     |soCol wasOn lineNrAboveCursor ln prevTab|
  2925 
  2925 
  2926     wasOn := self hideCursor.
  2926     wasOn := self hideCursor.
  2927     "JV@2012-01-06: Do not play with autoindent iff cursor is at the very beggining of the line"
  2927     "JV@2012-01-06: Do not play with autoindent iff cursor is at the very beginning of the line"
  2928     (autoIndent and:[cursorCol ~~ 1]) ifTrue:[
  2928     (autoIndent and:[cursorCol ~~ 1]) ifTrue:[
  2929         prevTab := (self prevTabBefore:cursorCol) max:1.
  2929         prevTab := (self prevTabBefore:cursorCol) max:1.
  2930         "JV@2011-12-10: The list can be shorter that cursorLine,
  2930         "JV@2011-12-10: The list can be shorter than cursorLine,
  2931          trailing because empty lines are not physically in the list."
  2931          trailing because empty lines are not physically in the list."
  2932         (list size >= cursorLine) ifTrue:[
  2932         (list size >= cursorLine) ifTrue:[
  2933             ln := (list at:cursorLine) ? ''.
  2933             ln := (list at:cursorLine) ? ''.
  2934         ] ifFalse:[        
  2934         ] ifFalse:[        
  2935             ln := ''.
  2935             ln := ''.
  2943                     self cursorLine:cursorLine col:prevTab.
  2943                     self cursorLine:cursorLine col:prevTab.
  2944                     wasOn ifTrue:[ self showCursor ].
  2944                     wasOn ifTrue:[ self showCursor ].
  2945                     ^  self
  2945                     ^  self
  2946                 ].
  2946                 ].
  2947             ] ifFalse:[
  2947             ] ifFalse:[
  2948                 self deleteFromLine:cursorLine col:prevTab toLine:cursorLine col:cursorCol-1.
  2948                 (ln copyFrom:prevTab+1 to:cursorCol-1) isBlank ifTrue:[
  2949                 self cursorLine:cursorLine col:prevTab.
  2949                     self deleteFromLine:cursorLine col:prevTab toLine:cursorLine col:cursorCol-1.
  2950                 wasOn ifTrue:[ self showCursor ].
  2950                     self cursorLine:cursorLine col:prevTab.
  2951                 ^  self.
  2951                     wasOn ifTrue:[ self showCursor ].
       
  2952                     ^  self.
       
  2953                 ]
  2952             ]
  2954             ]
  2953         ].
  2955         ].
  2954     ].
  2956     ].
  2955 
  2957 
  2956 "/        (autoIndent
  2958 "/        (autoIndent
  3523 ! !
  3525 ! !
  3524 
  3526 
  3525 !CodeView2 class methodsFor:'documentation'!
  3527 !CodeView2 class methodsFor:'documentation'!
  3526 
  3528 
  3527 version
  3529 version
  3528     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.69 2013-01-30 17:54:06 cg Exp $'
  3530     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.72 2013-05-28 18:52:32 cg Exp $'
  3529 !
  3531 !
  3530 
  3532 
  3531 version_CVS
  3533 version_CVS
  3532     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.69 2013-01-30 17:54:06 cg Exp $'
  3534     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.72 2013-05-28 18:52:32 cg Exp $'
  3533 !
  3535 !
  3534 
  3536 
  3535 version_HG
  3537 version_HG
  3536 
  3538 
  3537     ^ '$Changeset: <not expanded> $'
  3539     ^ '$Changeset: <not expanded> $'
  3538 !
  3540 !
  3539 
  3541 
  3540 version_SVN
  3542 version_SVN
  3541     ^ '§Id: Tools__CodeView2.st 7797 2011-06-28 07:45:06Z vranyj1 §'
  3543     ^ '$Id: Tools__CodeView2.st,v 1.72 2013-05-28 18:52:32 cg Exp $'
  3542 ! !
  3544 ! !
  3543 
  3545 
  3544 
  3546 
  3545 CodeView2 initialize!
  3547 CodeView2 initialize!