EditTextView.st
changeset 2207 80ca02ca0111
parent 2205 230cf9cef6c3
child 2210 94f6ffcb06ac
--- a/EditTextView.st	Wed Aug 09 13:09:57 2000 +0200
+++ b/EditTextView.st	Wed Aug 09 23:50:05 2000 +0200
@@ -2407,55 +2407,57 @@
     line := self listAt:lineNr.
 
     (self checkModificationsAllowed and:[line notNil]) ifTrue:[ 
-	lineSize := line size.
-
-	startCol == 0     ifFalse:[ start := startCol ]
-			   ifTrue:[ start := 1 ]. 
-
-	endCol > lineSize ifFalse:[ stop  := endCol ]
-			   ifTrue:[ stop  := lineSize ].
-
-	stop >= start ifTrue:[
-	    start ~~ 1 ifTrue:[ newLine := line copyFrom:1 to:(start-1) ]
-		      ifFalse:[ newLine := '' ].
-
-	    stop == lineSize ifFalse:[
-		line bitsPerCharacter > newLine bitsPerCharacter ifTrue:[
-		    newLine := line string species fromString:newLine.
-		].
-		newLine := newLine, (line copyFrom:(stop + 1) to:lineSize)
-	    ].
-
-	    (trimBlankLines and:[newLine isBlank]) ifTrue:[
-		newLine := nil
-	    ].
-
-	    prevWidth := self widthOfLine:lineNr.
-
-	    list at:lineNr put:newLine.
-
-	    (prevWidth = widthOfWidestLine) ifTrue:[
-		"/ remember old width of this line,
-		"/ only clear widthOfWidestLine, if this lines
-		"/ length was (one of) the longest.
-		"/ avoids slow delete with huge texts.
-		widthOfWidestLine := nil.   "i.e. unknown"
-
-		"/ scroll left if reqiured
-		viewOrigin x > 0 ifTrue:[
-		    newWidth := self widthOfLine:lineNr.
-		    newWidth < (viewOrigin x + width) ifTrue:[
-			self scrollHorizontalTo:(newWidth 
-						 - width 
-						 + margin + margin 
-						 + (font widthOf:'  '))
-		    ]
-		].
-	    ].
-	    self textChanged.
-	    self redrawLine:lineNr from:start.
-
-	]
+        lineSize := line size.
+
+        startCol == 0     ifFalse:[ start := startCol ]
+                           ifTrue:[ start := 1 ]. 
+
+        endCol > lineSize ifFalse:[ stop  := endCol ]
+                           ifTrue:[ stop  := lineSize ].
+
+        stop >= start ifTrue:[
+            start ~~ 1 ifTrue:[ newLine := line copyFrom:1 to:(start-1) ]
+                      ifFalse:[ newLine := '' ].
+
+            stop == lineSize ifFalse:[
+                line bitsPerCharacter > newLine bitsPerCharacter ifTrue:[
+                    newLine := line string species fromString:newLine.
+                ].
+                newLine := newLine, (line copyFrom:(stop + 1) to:lineSize)
+            ].
+
+            (trimBlankLines and:[newLine isBlank]) ifTrue:[
+                newLine := nil
+            ].
+
+            prevWidth := self widthOfLine:lineNr.
+
+            list at:lineNr put:newLine.
+
+            (prevWidth = widthOfWidestLine) ifTrue:[
+                "/ remember old width of this line,
+                "/ only clear widthOfWidestLine, if this lines
+                "/ length was (one of) the longest.
+                "/ avoids slow delete with huge texts.
+                widthOfWidestLine := nil.   "i.e. unknown"
+
+                "/ scroll left if reqiured
+                viewOrigin x > 0 ifTrue:[
+                    newWidth := self widthOfLine:lineNr.
+                    newWidth < (viewOrigin x + width) ifTrue:[
+                        self scrollHorizontalTo:(newWidth 
+                                                 - width 
+                                                 + margin + margin 
+                                                 + (font widthOf:'  '))
+                    ]
+                ].
+                self textChanged.
+            ] ifFalse:[
+                self textChangedButNoSizeChane
+            ].
+            self redrawLine:lineNr from:start.
+
+        ]
     ]
 
     "Modified: / 11.11.1998 / 00:01:09 / cg"
@@ -3190,7 +3192,7 @@
                           #LearnKeyboardMacro #ExecuteKeyboardMacro
                           #'F*' #'f*')>
 
-    |sensor n fKeyMacros shifted i wasOn
+    |sensor n fKeyMacros shifted i
      selStartLine selEndLine selStartCol selEndCol sel event|
 
     event := WindowGroup lastEventQuerySignal query.
@@ -3210,10 +3212,9 @@
         shifted ifTrue:[
             self deleteWordBeforeCursor.
         ] ifFalse:[
-            wasOn := self hideCursor.
             self deleteCharBeforeCursor. 
-            wasOn ifTrue:[ self showCursor ]
         ].
+
         ^ self
     ].
 
@@ -4278,6 +4279,18 @@
     contentsWasSaved := false
 
     "Modified: 14.2.1997 / 16:58:38 / cg"
+!
+
+textChangedButNoSizeChane
+    "my text was modified (internally).
+     Sent whenever text has been edited (not to confuse with
+     contentsChanged, which is triggered when the size has changed, and
+     is used to notify scrollers, other views etc.)"
+
+    self modified:true.
+    contentsWasSaved := false
+
+    "Modified: 14.2.1997 / 16:58:38 / cg"
 ! !
 
 !EditTextView methodsFor:'queries'!
@@ -4889,5 +4902,5 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.236 2000-08-09 11:09:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.237 2000-08-09 21:50:05 cg Exp $'
 ! !