--- a/EditTextView.st Fri Apr 26 15:28:29 2013 +0200
+++ b/EditTextView.st Fri Apr 26 15:57:13 2013 +0200
@@ -1927,87 +1927,87 @@
"draw a cursor; the argument cursorType specifies what type
of cursor should be drawn.
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret
- #bigCaret and #bigSolidCaret"
+ #bigCaret and #bigSolidCaret"
|x y w char y2 x1 x2 oldPaint oldClip|
self hasSelection ifTrue:[
- "
- hide cursor, if there is a selection
- "
- ^ super redrawVisibleLine:cursorVisibleLine col:cursorCol.
+ "
+ hide cursor, if there is a selection
+ "
+ ^ super redrawVisibleLine:cursorVisibleLine col:cursorCol.
].
cursorType == #none ifTrue:[
- ^ self
+ ^ self
].
cursorType == #block ifTrue:[
- super drawVisibleLine:cursorVisibleLine
- col:cursorCol
- with:fgColor
- and:bgColor.
- ^ self
+ super drawVisibleLine:cursorVisibleLine
+ col:cursorCol
+ with:fgColor
+ and:bgColor.
+ ^ self
].
x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x.
y := self yOfVisibleLine:cursorVisibleLine.
oldPaint := self paint. "/ do not clobber GC
cursorType == #frame ifTrue:[
- super redrawVisibleLine:cursorVisibleLine col:cursorCol.
-
- char := self characterUnderCursor asString.
- self paint:bgColor.
- self displayRectangleX:x y:y
- width:(font widthOf:char) height:fontHeight.
+ super redrawVisibleLine:cursorVisibleLine col:cursorCol.
+
+ char := self characterUnderCursor asString.
+ self paint:bgColor.
+ self displayRectangleX:x y:y
+ width:(font widthOf:char) height:fontHeight.
] ifFalse:[
- self paint:bgColor.
- cursorType == #ibeam ifTrue:[
- x1 := x - 1.
- y2 := y + fontHeight - 1.
- self displayLineFromX:x1 y:y toX:x1 y:y2.
- self displayLineFromX:x y:y toX:x y:y2.
- ^ self
- ].
-
- cursorType == #Ibeam ifTrue:[
- x1 := x - 1.
- y := y + 1.
- y2 := y + fontHeight - 1.
- self displayLineFromX:x1 y:y toX:x1 y:y2.
- self displayLineFromX:x y:y toX:x y:y2.
- self displayLineFromX:x1-2 y:y toX:x+2 y:y.
- self displayLineFromX:x1-2 y:y2 toX:x+2 y:y2.
- ^ self
- ].
-
- y := y + fontHeight - 3.
- ((cursorType == #bigCaret) or:[cursorType == #bigSolidCaret]) ifTrue:[
- w := (fontWidth * 2 // 3) max:4.
- y2 := y + w + (w//2).
- ] ifFalse:[
- w := (fontWidth // 2) max:4.
- y2 := y + w.
- ].
- x1 := x - w.
- x2 := x + w.
-
- oldClip := self clippingRectangleOrNil.
- self clippingRectangle:(margin@margin extent:(width-margin) @ (height-margin)).
-
- cursorType == #caret ifTrue:[
- self lineWidth:2.
- self displayLineFromX:x1 y:y2 toX:x y:y.
- self displayLineFromX:x y:y toX:x2 y:y2.
- ] ifFalse:[
- "anything else: solidCaret"
-
- self fillPolygon:(Array with:(x1 @ y2)
- with:(x @ y)
- with:(x2 @ y2))
- ].
-
- self clippingRectangle:oldClip
+ self paint:bgColor.
+ cursorType == #ibeam ifTrue:[
+ x1 := x - 1.
+ y2 := y + fontHeight - lineSpacing.
+ self displayLineFromX:x1 y:y toX:x1 y:y2.
+ self displayLineFromX:x y:y toX:x y:y2.
+ ^ self
+ ].
+
+ cursorType == #Ibeam ifTrue:[
+ x1 := x - 1.
+ y := y + 1.
+ y2 := y + fontHeight - lineSpacing.
+ self displayLineFromX:x1 y:y toX:x1 y:y2.
+ self displayLineFromX:x y:y toX:x y:y2.
+ self displayLineFromX:x1-2 y:y toX:x+2 y:y.
+ self displayLineFromX:x1-2 y:y2 toX:x+2 y:y2.
+ ^ self
+ ].
+
+ y := y + fontHeight - 3.
+ ((cursorType == #bigCaret) or:[cursorType == #bigSolidCaret]) ifTrue:[
+ w := (fontWidth * 2 // 3) max:4.
+ y2 := y + w + (w//2).
+ ] ifFalse:[
+ w := (fontWidth // 2) max:4.
+ y2 := y + w.
+ ].
+ x1 := x - w.
+ x2 := x + w.
+
+ oldClip := self clippingRectangleOrNil.
+ self clippingRectangle:(margin@margin extent:(width-margin) @ (height-margin)).
+
+ cursorType == #caret ifTrue:[
+ self lineWidth:2.
+ self displayLineFromX:x1 y:y2 toX:x y:y.
+ self displayLineFromX:x y:y toX:x2 y:y2.
+ ] ifFalse:[
+ "anything else: solidCaret"
+
+ self fillPolygon:(Array with:(x1 @ y2)
+ with:(x @ y)
+ with:(x2 @ y2))
+ ].
+
+ self clippingRectangle:oldClip
].
self paint:oldPaint.
@@ -8014,10 +8014,10 @@
!EditTextView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.546 2013-04-26 13:28:01 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.547 2013-04-26 13:57:13 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.546 2013-04-26 13:28:01 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.547 2013-04-26 13:57:13 cg Exp $'
! !