class: EditTextView
authorClaus Gittinger <cg@exept.de>
Tue, 30 Apr 2013 20:19:17 +0200
changeset 4585 7b31719bf07a
parent 4584 ba63ceaa4916
child 4586 0678021a7151
class: EditTextView added: #hasSelectionOrTextInCursorLine #selectionOrTextOfCursorLine: code move
EditTextView.st
--- a/EditTextView.st	Tue Apr 30 20:19:01 2013 +0200
+++ b/EditTextView.st	Tue Apr 30 20:19:17 2013 +0200
@@ -820,6 +820,30 @@
     "Created: / 5.2.2000 / 17:07:59 / cg"
 ! !
 
+!EditTextView methodsFor:'accessing'!
+
+hasSelectionOrTextInCursorLine
+    ^ (self selectionOrTextOfCursorLine:false) notNil
+!
+
+selectionOrTextOfCursorLine:doSelect
+    |sel lNr line|
+
+    sel := self selectionAsString.
+    sel notNil ifTrue:[^ sel].
+
+    lNr := self cursorLine.
+    line := self listAt:lNr.
+    line notEmptyOrNil ifTrue:[
+        doSelect ifTrue:[
+            self selectLine:lNr.
+        ].
+        ^ line
+    ].
+
+    ^ nil
+! !
+
 !EditTextView methodsFor:'accessing-behavior'!
 
 acceptAction
@@ -1243,7 +1267,6 @@
     "Created: / 31.3.1998 / 23:35:06 / cg"
 ! !
 
-
 !EditTextView methodsFor:'accessing-look'!
 
 cursorForegroundColor:color1 backgroundColor:color2
@@ -8014,10 +8037,10 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.547 2013-04-26 13:57:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.548 2013-04-30 18:19:17 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.547 2013-04-26 13:57:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.548 2013-04-30 18:19:17 cg Exp $'
 ! !