delete does not (by default) update the clipboard
authorClaus Gittinger <cg@exept.de>
Wed, 09 Aug 2006 13:53:50 +0200
changeset 3324 1297aecf6699
parent 3323 ce80842d41e0
child 3325 b7e01a88b167
delete does not (by default) update the clipboard (configurable in the userprefs now)
EditTextView.st
--- a/EditTextView.st	Tue Aug 08 15:59:59 2006 +0200
+++ b/EditTextView.st	Wed Aug 09 13:53:50 2006 +0200
@@ -3929,9 +3929,9 @@
                           #BeginOfLine #EndOfLine #NextWord #PreviousWord
                           #CursorRight #CursorDown #CursorLeft #CursorUp
                           #Return #Tab #BackTab #NonInsertingTab #Escape
-                          #GotoLine #Delete #BeginOfText #EndOfText
-                          #SelectLine #ExpandSelectionByLine #DeleteLine
-                          #InsertLine
+                          #GotoLine #BeginOfText #EndOfText
+                          #SelectLine #ExpandSelectionByLine
+                          #InsertLine #DeleteLine
                           #SelectLineFromBeginning
                           #LearnKeyboardMacro #ExecuteKeyboardMacro #ToggleInsertMode
                           #'F*' #'f*')>
@@ -4183,7 +4183,7 @@
         shiftPressed ifTrue:[
             [(cursorCol <= (self listAt:cursorLine) size)
              and:[self characterUnderCursor isSeparator]] whileTrue:[
-                self makeCursorVisible.
+             self makeCursorVisible.
                 self deleteCharAtCursor.
             ].
             ^ self
@@ -4193,7 +4193,8 @@
     (key == #Delete
      or:[key == #BasicDelete]) ifTrue:[
         selectionStartLine notNil ifTrue:[
-            (key == #BasicDelete) ifTrue:[
+            ((key == #BasicDelete) 
+            or:[UserPreferences current deleteSetsClipboardText not]) ifTrue:[
                 self deleteSelection.
             ] ifFalse:[
                 self copyAndDeleteSelection.
@@ -4718,52 +4719,7 @@
 cut
     "cut selection into copybuffer"
 
-    |line col history sel s|
-
-    (self checkModificationsAllowed) ifFalse:[
-	self flash.
-	^ self
-    ].
-
-    sel := self selection.
-    sel notNil ifTrue:[
-	lastString := s := sel asStringWithCRs.
-	line := selectionStartLine.
-	col := selectionStartCol.
-
-	"
-	 remember in CopyBuffer
-	"
-	self setClipboardText:sel. "/ lastString.
-
-	"
-	 append to DeleteHistory (if there is one)
-	"
-	history := Smalltalk at:#DeleteHistory.
-	history notNil ifTrue:[
-	    history addAll:(sel asStringCollection).
-	    history size > 1000 ifTrue:[
-		history := history copyFrom:(history size - 1000)
-	    ].
-	].
-
-	"
-	 now, delete it
-	"
-	self undoableDo:[
-	    self deleteSelection.
-	].
-	lastReplacement := nil
-    ] ifFalse:[
-	"
-	 a cut without selection will search&cut again
-	"
-	self undoableDo:[
-	    self again
-	]
-    ]
-
-    "Modified: / 5.4.1998 / 16:51:53 / cg"
+    self deleteCopyToClipboard:true
 !
 
 defaultForGotoLine
@@ -4775,6 +4731,59 @@
     ^ super defaultForGotoLine
 !
 
+deleteCopyToClipboard:toClipboard
+    "cut selection into copybuffer"
+
+    |line col history sel s|
+
+    (self checkModificationsAllowed) ifFalse:[
+        self flash.
+        ^ self
+    ].
+
+    sel := self selection.
+    sel notNil ifTrue:[
+        lastString := s := sel asStringWithCRs.
+        line := selectionStartLine.
+        col := selectionStartCol.
+
+        toClipboard ifTrue:[
+            "
+             remember in CopyBuffer
+            "
+            self setClipboardText:sel. "/ lastString.
+        ].
+
+        "
+         append to DeleteHistory (if there is one)
+        "
+        history := Smalltalk at:#DeleteHistory.
+        history notNil ifTrue:[
+            history addAll:(sel asStringCollection).
+            history size > 1000 ifTrue:[
+                history := history copyFrom:(history size - 1000)
+            ].
+        ].
+
+        "
+         now, delete it
+        "
+        self undoableDo:[
+            self deleteSelection.
+        ].
+        lastReplacement := nil
+    ] ifFalse:[
+        "
+         a cut without selection will search&cut again
+        "
+        self undoableDo:[
+            self again
+        ]
+    ]
+
+    "Modified: / 5.4.1998 / 16:51:53 / cg"
+!
+
 editMenu
     "return the views middleButtonMenu"
 
@@ -6551,5 +6560,5 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.396 2006-07-05 07:41:40 fm Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.397 2006-08-09 11:53:50 cg Exp $'
 ! !