TextView.st
branchjv
changeset 5386 26b17b83a19b
parent 5333 59e84155ae45
parent 5378 d64277a079c1
child 5395 fc9336b15c5c
--- a/TextView.st	Mon Jun 22 18:16:14 2015 +0100
+++ b/TextView.st	Tue Jul 28 17:31:58 2015 +0100
@@ -2683,6 +2683,14 @@
     "Created: 22.5.1996 / 12:18:34 / cg"
 !
 
+highlightLineSpacing
+    "true if the spacing between lines is to be drawn with selected color,
+     false if it remains white.
+     false for selection in list views; true for edit/text views"
+
+    ^ true
+!
+
 isClosingParenthesis:ch
     ((parenthesisSpecification at:#close) includes:ch) ifTrue:[^ true].
     ^ ')]}' includes:ch
@@ -4938,6 +4946,37 @@
     ^ self
 
     "Modified: 29.4.1996 / 12:32:08 / cg"
+!
+
+withSelectionForeground:hilightFg background:hilightBg do:aBlock
+    "evaluate aBlock while the selection is shown highlighted with colors passed as args."
+
+    |oldFg oldBg|
+
+    "
+     change color of selection & hide cursor
+    "
+    oldFg := selectionFgColor.
+    oldBg := selectionBgColor.
+    selectionBgColor := hilightBg.
+    selectionFgColor := hilightFg.
+
+    expandingTop := true.       "/ hack to make the top of the selection visible
+    self makeSelectionVisible.
+    selectionStartLine notNil ifTrue:[
+        selectionEndLine notNil ifTrue:[
+            self redrawFromLine:selectionStartLine to:selectionEndLine.
+        ].
+    ].
+    self flush.
+
+    aBlock ensure:[
+        "
+         undo selection color change and show cursor again
+        "
+        selectionFgColor := oldFg.
+        selectionBgColor := oldBg.
+    ].
 ! !
 
 !TextView methodsFor:'testing'!
@@ -4951,11 +4990,11 @@
 !TextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.393 2015-03-25 19:19:48 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.393 2015-03-25 19:19:48 cg Exp $'
+    ^ '$Header$'
 !
 
 version_HG