shift-paste: select pasted string from copyBuffer history
authorClaus Gittinger <cg@exept.de>
Tue, 09 Jul 2002 14:14:55 +0200
changeset 2544 48ab4ed67816
parent 2543 ef26b41d6e06
child 2545 a546fabd3f05
shift-paste: select pasted string from copyBuffer history
EditTextView.st
--- a/EditTextView.st	Tue Jul 09 14:04:52 2002 +0200
+++ b/EditTextView.st	Tue Jul 09 14:14:55 2002 +0200
@@ -4221,6 +4221,29 @@
     "Modified: / 13.11.2001 / 10:39:16 / cg"
 !
 
+getTextSelectionFromHistory
+    |sel list box history|
+
+    history := device getCopyBufferHistory copy.
+    list := history collect:[:entry | entry asString string asCollectionOfLines first].
+    box := ListSelectionBox
+                title:'CopyBuffer History' 
+                okText:'Paste'
+                abortText:'Cancel'
+                list:list 
+                action:[:idx | idx notNil ifTrue:[ sel := history at:idx]].
+    box useIndex:true.
+    box show.
+    ^ sel.
+!
+
+getTextSelectionOrTextSelectionFromHistory
+    device shiftDown ifTrue:[
+        ^ self getTextSelectionFromHistory
+    ].
+    ^ self getTextSelection
+!
+
 paste
     "paste the copybuffer; if there is a selection, unselect first.
      Then paste at cursor position."
@@ -4232,7 +4255,7 @@
         ^ self
     ].
 
-    sel := self getTextSelection.
+    sel := self getTextSelectionOrTextSelectionFromHistory.
     self unselect.  
     sel notNil ifTrue:[
         self paste:sel.
@@ -4295,7 +4318,7 @@
         ^ self
     ].
 
-    sel := self getTextSelection.
+    sel := self getTextSelectionOrTextSelectionFromHistory.
     sel notNil ifTrue:[
         self pasteOrReplace:sel.
     ].
@@ -4325,7 +4348,7 @@
 
     self checkModificationsAllowed ifFalse:[^ self].
 
-    sel := self getTextSelection.
+    sel := self getTextSelectionOrTextSelectionFromHistory.
     sel notNil ifTrue:[
         self replace:sel
     ]
@@ -5111,5 +5134,5 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.268 2002-07-05 13:40:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.269 2002-07-09 12:14:55 cg Exp $'
 ! !