EditTextView.st
changeset 1495 3b79070e35e4
parent 1480 eabb1848e2fa
child 1515 9e9b65bd6efb
--- a/EditTextView.st	Wed Apr 22 09:15:52 1998 +0200
+++ b/EditTextView.st	Wed Apr 22 09:17:55 1998 +0200
@@ -1421,42 +1421,61 @@
 undrawCursor
     "undraw the cursor (i.e. redraw the character(s) under the cursor)"
 
-    |prevCol|
+    |prevCol line oldClip x y|
 
     cursorVisibleLine notNil ifTrue:[
-	prevCol := cursorCol - 1.
-
-	((cursorType == #caret)
-	 or:[cursorType == #solidCaret
-	 or:[cursorType == #bigSolidCaret
-	 or:[cursorType == #bigCaret]]]) ifTrue:[
-	    "caret-cursor touches 4 characters"
-	    ((cursorCol > 1) and:[fontIsFixedWidth]) ifTrue:[
-		super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol.
-		super redrawVisibleLine:cursorVisibleLine+1 from:prevCol to:cursorCol.
-	    ] ifFalse:[
-		"care for left margin"
-		super redrawVisibleLine:cursorVisibleLine; redrawVisibleLine:cursorVisibleLine+1.
-	    ].
-	    ^ self
-	].
-
-	cursorType == #ibeam ifTrue:[
-	    "ibeam-cursor touches 2 characters"
-	    cursorCol > 1 ifTrue:[
-		super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol.
-	    ] ifFalse:[
-		"care for left margin"
-		super redrawVisibleLine:cursorVisibleLine.
-	    ].
-	    ^ self
-	].
-
-	"block is simple - just one character under cursor"
-	super redrawVisibleLine:cursorVisibleLine col:cursorCol
+        prevCol := cursorCol - 1.
+
+        ((cursorType == #caret)
+         or:[cursorType == #solidCaret
+         or:[cursorType == #bigSolidCaret
+         or:[cursorType == #bigCaret]]]) ifTrue:[
+            "caret-cursor touches 4 characters"
+            ((cursorCol > 1) and:[fontIsFixedWidth]) ifTrue:[
+                super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol.
+                super redrawVisibleLine:cursorVisibleLine+1 from:prevCol to:cursorCol.
+            ] ifFalse:[
+                "care for left margin"
+                super redrawVisibleLine:cursorVisibleLine; redrawVisibleLine:cursorVisibleLine+1.
+            ].
+            ^ self
+        ].
+
+        cursorType == #ibeam ifTrue:[
+            "ibeam-cursor touches 2 characters"
+            cursorCol > 1 ifTrue:[
+                super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol.
+            ] ifFalse:[
+                "care for left margin"
+                super redrawVisibleLine:cursorVisibleLine.
+            ].
+            ^ self
+        ].
+
+        "block cursor is simple - just one character under cursor"
+
+        "/ however, if italic characters are involved, we must care
+        "/ for the chars before/after the cursor.
+        "/ We redraw the part of the previous character which got
+        "/ detroyed by the block cursor.
+        "/ (must change the clip, to avoid destroying the prev-prev character) 
+
+        line := self visibleAt:cursorVisibleLine.
+        (line notNil and:[line isText]) ifTrue:[
+            cursorCol > 1 ifTrue:[
+                oldClip := self clippingRectangleOrNil.
+                x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - leftOffset.
+                y := self yOfVisibleLine:cursorVisibleLine.
+                self clippingRectangle:(x@y extent:((font width) @ fontHeight)).
+                super redrawVisibleLine:cursorVisibleLine from:cursorCol-1 to:cursorCol.
+                self clippingRectangle:oldClip.
+                ^ self.
+            ].
+        ].
+        super redrawVisibleLine:cursorVisibleLine col:cursorCol
     ]
 
-    "Modified: 22.9.1997 / 00:16:50 / cg"
+    "Modified: / 22.4.1998 / 09:13:07 / cg"
 !
 
 validateCursorCol:col inLine:line
@@ -4205,5 +4224,5 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.150 1998-04-06 10:43:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.151 1998-04-22 07:17:55 cg Exp $'
 ! !