EditTextView.st
changeset 3400 c3fd4330f9ea
parent 3326 4740a22e21c5
child 3402 d6545009a22b
--- a/EditTextView.st	Thu Sep 21 16:53:38 2006 +0200
+++ b/EditTextView.st	Mon Sep 25 17:24:50 2006 +0200
@@ -79,13 +79,6 @@
 	privateIn:EditTextView::EditMode
 !
 
-EditTextView::EditAction subclass:#InsertCharacter
-	instanceVariableNames:'line col character'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:EditTextView
-!
-
 EditTextView::EditAction subclass:#PasteString
 	instanceVariableNames:'line col string selected'
 	classVariableNames:''
@@ -6205,6 +6198,14 @@
     userFriendlyInfo := aString
 ! !
 
+!EditTextView::EditAction methodsFor:'combining'!
+
+canCombineWithPreviousPasteStringAction: aPasteStringAction
+    ^ false.
+
+    "Created: / 25-09-2006 / 12:16:25 / cg"
+! !
+
 !EditTextView::EditAction methodsFor:'queries'!
 
 canCombineWithNext:nextAction
@@ -6376,28 +6377,26 @@
     ^ 'O'
 ! !
 
-!EditTextView::InsertCharacter methodsFor:'accessing'!
-
-line:lineArg col:colArg character:characterArg
-    "set instance variables (automatically generated)"
-
-    line := lineArg.
-    col := colArg.
-    character := characterArg.
-! !
-
-!EditTextView::InsertCharacter methodsFor:'execution'!
-
-executeIn:editor
-    editor
-	replace:character
-	atLine:line
-	col:col.
-    editor cursorLine:line col:col.
-! !
-
 !EditTextView::PasteString methodsFor:'accessing'!
 
+col
+    ^ col
+
+    "Created: / 25-09-2006 / 12:19:59 / cg"
+!
+
+col2
+    ^ col + string size - 1
+
+    "Created: / 25-09-2006 / 12:20:18 / cg"
+!
+
+line
+    ^ line
+
+    "Created: / 25-09-2006 / 12:21:08 / cg"
+!
+
 line:lineArg col:colArg string:stringArg
     self assert:(lineArg notNil).
     self assert:(colArg notNil).
@@ -6417,6 +6416,54 @@
     col := colArg.
     string := stringArg.
     selected := selectedArg.
+!
+
+string
+    ^ string
+
+    "Created: / 25-09-2006 / 12:25:59 / cg"
+! !
+
+!EditTextView::PasteString methodsFor:'combining'!
+
+canCombineWithNext:anotherAction
+    ^ anotherAction canCombineWithPreviousPasteStringAction:self
+
+    "Created: / 25-09-2006 / 12:15:59 / cg"
+!
+
+canCombineWithPreviousPasteStringAction: previousPasteAction
+    "I will combine only if we both are single character inserts,
+     and my col-to-insert is the next after anotherInsertActions end-col.
+     (i.e. single-character deletes)"
+
+    previousPasteAction line == line ifTrue:[
+        previousPasteAction col == (self col2+1) ifTrue:[
+            ^ true
+        ].
+    ].
+
+    ^ false
+
+    "Modified: / 25-09-2006 / 12:22:21 / cg"
+!
+
+combineWithNext:nextPasteAction
+    |s1 s2|
+
+    self assert:(line == nextPasteAction line).
+    self assert:((col - 1) == (nextPasteAction col2)).
+
+    s1 := nextPasteAction string.
+    s1 isString ifFalse:[s1 := s1 asStringWith:nil].
+    s2 := string.
+    s2 isString ifFalse:[s2 := s2 asStringWith:nil].
+
+    string := s1, s2. 
+    col := nextPasteAction col.
+    userFriendlyInfo := 'delete ' , string size printString
+
+    "Created: / 25-09-2006 / 12:24:10 / cg"
 ! !
 
 !EditTextView::PasteString methodsFor:'execution'!
@@ -6562,5 +6609,5 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.398 2006-08-09 19:26:15 fm Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.399 2006-09-25 15:24:50 cg Exp $'
 ! !