EditTextView.st
changeset 4271 3ce604308987
parent 4258 b70835a4f0b2
child 4275 16c80f32c06c
--- a/EditTextView.st	Wed Jun 29 16:42:08 2011 +0200
+++ b/EditTextView.st	Wed Jun 29 19:32:26 2011 +0200
@@ -1267,6 +1267,7 @@
     "Created: / 31.3.1998 / 23:35:06 / cg"
 ! !
 
+
 !EditTextView methodsFor:'accessing-look'!
 
 cursorForegroundColor:color1 backgroundColor:color2
@@ -7098,17 +7099,21 @@
 selectFromBeginOfLine
     "select the text from the beginning of the current line to the current cursor position."
 
+    | newCursorCol |
+
     list isNil ifTrue:[
         self unselect
     ] ifFalse:[
         cursorCol > 1 ifTrue:[
-            self selectFromLine:cursorLine col:1 toLine:cursorLine col:cursorCol-1.
-            cursorCol := 1.
+            newCursorCol := (list at: cursorLine) indexOfNonSeparator.
+            self selectFromLine:cursorLine col:newCursorCol toLine:cursorLine col:cursorCol-1.
+            cursorCol := newCursorCol.
             typeOfSelection := nil
         ]
     ]
 
     "Created: / 28-06-2011 / 22:47:04 / cg"
+    "Modified: / 29-06-2011 / 19:20:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 selectFromBeginning
@@ -7143,18 +7148,25 @@
 selectToEndOfLine
     "select the text from the current cursor position to the end of the current line"
 
+    | newCursorCol line |
+
     list isNil ifTrue:[
         self unselect
     ] ifFalse:[
         cursorCol > 1 ifTrue:[
-            self selectFromLine:cursorLine col:cursorCol toLine:cursorLine+1 col:0.
-            cursorLine := cursorLine + 1.
-            cursorCol := 0.
+            line := list at: cursorLine.
+            newCursorCol := line size.
+            [ newCursorCol > 1 and:[(line at:newCursorCol) isSeparator] ]      
+                whileTrue:[newCursorCol := newCursorCol - 1].
+
+            self selectFromLine:cursorLine col:cursorCol toLine:cursorLine col: newCursorCol.
+            cursorCol := newCursorCol.
             typeOfSelection := nil
         ]
     ]
 
     "Created: / 28-06-2011 / 23:07:07 / cg"
+    "Modified: / 29-06-2011 / 19:25:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 selectUpToEnd
@@ -7861,9 +7873,9 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.511 2011-06-28 21:16:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.512 2011-06-29 17:32:26 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.511 2011-06-28 21:16:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.512 2011-06-29 17:32:26 vrany Exp $'
 ! !