--- a/Tools__CodeView2.st Mon Jun 03 18:43:00 2013 +0100
+++ b/Tools__CodeView2.st Tue Jun 04 16:21:31 2013 +0100
@@ -2921,18 +2921,22 @@
the fix should be there, but someone smarter should review it
before the patch will be pushed up"
- |soCol wasOn lineNrAboveCursor ln prevTab|
+ |soCol wasOn lineNrAboveCursor ln originalLine prevTab|
wasOn := self hideCursor.
+
"JV@2012-01-06: Do not play with autoindent iff cursor is at the very beginning of the line"
- (autoIndent and:[cursorCol ~~ 1]) ifTrue:[
+ (autoIndent
+ and:[cursorCol ~~ 1
+ and:[ (tabPositions includes:cursorCol)
+ ]]) ifTrue:[
prevTab := (self prevTabBefore:cursorCol) max:1.
"JV@2011-12-10: The list can be shorter than cursorLine,
trailing because empty lines are not physically in the list."
(list size >= cursorLine) ifTrue:[
- ln := (list at:cursorLine) ? ''.
+ ln := originalLine := (list at:cursorLine) ? ''.
] ifFalse:[
- ln := ''.
+ ln := originalLine := ''.
].
ln size < prevTab ifTrue:[
ln := ln , (String new:prevTab withAll:Character space).
@@ -2940,17 +2944,25 @@
(ln copyTo:prevTab) isBlank ifTrue:[
(ln copyFrom:prevTab+1) isBlank ifTrue:[
cursorCol > prevTab ifTrue:[
+ self st80EditMode ifTrue:[
+ "/ ensure that there is no conflict here: st80EditMode will
+ "/ not allow a cursor position beyond the end of line,
+ "/ so avoid that cursorLine:col: will force us to the beginning of the line
+ originalLine size < prevTab ifTrue:[
+ self at:cursorLine put:ln
+ ]
+ ].
self cursorLine:cursorLine col:prevTab.
wasOn ifTrue:[ self showCursor ].
^ self
].
] ifFalse:[
- (ln copyFrom:prevTab+1 to:cursorCol-1) isBlank ifTrue:[
+ "/ (ln copyFrom:prevTab+1 to:cursorCol-1) isBlank ifTrue:[
self deleteFromLine:cursorLine col:prevTab toLine:cursorLine col:cursorCol-1.
self cursorLine:cursorLine col:prevTab.
wasOn ifTrue:[ self showCursor ].
^ self.
- ]
+ "/ ]
]
].
].
@@ -3094,8 +3106,11 @@
wasAutoIndent := autoIndent.
autoIndent := false.
- super insertLines:someText from:start to:end before:lineNr.
- autoIndent := wasAutoIndent
+ [
+ super insertLines:someText from:start to:end before:lineNr.
+ ] ensure:[
+ autoIndent := wasAutoIndent
+ ]
"Created: / 20-12-2011 / 15:32:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
@@ -3216,7 +3231,6 @@
changedDiffText := true.
diffMode := false.
suppressNotifications := false.
- autoIndent := UserPreferences current codeView2AutoIndent.
reallyModifiedChannel := false asValue.
self enableMotionEvents.
@@ -3527,11 +3541,11 @@
!CodeView2 class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.72 2013-05-28 18:52:32 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.74 2013-05-29 17:26:31 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.72 2013-05-28 18:52:32 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeView2.st,v 1.74 2013-05-29 17:26:31 cg Exp $'
!
version_HG
@@ -3540,7 +3554,7 @@
!
version_SVN
- ^ '$Id: Tools__CodeView2.st,v 1.72 2013-05-28 18:52:32 cg Exp $'
+ ^ '$Id: Tools__CodeView2.st,v 1.74 2013-05-29 17:26:31 cg Exp $'
! !