#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Wed, 17 Jul 2019 12:05:25 +0200
changeset 6641 fd2baccc909a
parent 6640 dc52a6475d7b
child 6642 247cf22c288c
#REFACTORING by cg class: EditTextView comment/format in: #deleteCopyToClipboard: changed: #deleteCharsAtLine:fromCol:toCol: #insert:atLine:col: #keyPress:x:y: #replaceContentsWith: #withoutRedrawAt:put: #withoutRedrawInsertLines:from:to:before:
EditTextView.st
--- a/EditTextView.st	Wed Jul 17 11:25:32 2019 +0200
+++ b/EditTextView.st	Wed Jul 17 12:05:25 2019 +0200
@@ -3529,9 +3529,15 @@
 
     |deleted|
 
-    deleted := self textFromLine:lineNr col:startCol toLine:lineNr col:endCol.
-    self basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol.
-    self addUndo:(PasteString line:lineNr col:startCol string:deleted info:'delete').
+    undoSupport isInTransaction ifFalse:[
+        self basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol.
+    ] ifTrue:[
+        deleted := self textFromLine:lineNr col:startCol toLine:lineNr col:endCol.
+        self basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol.
+        self addUndo:(PasteString line:lineNr col:startCol string:deleted info:'delete').
+    ].
+
+    "Modified: / 17-07-2019 / 07:30:14 / Claus Gittinger"
 !
 
 deleteCharsAtLine:lineNr toCol:colNr
@@ -3758,9 +3764,13 @@
      set emphasis to character at current position"
 
     self basicInsert:aCharacter atLine:lineNr col:colNr.
-    aCharacter ~~ Character cr ifTrue:[
-        self addUndo:(DeleteCharacters line:lineNr col:colNr info:'insert').
-    ]
+    undoSupport isInTransaction ifTrue:[
+        aCharacter ~~ Character cr ifTrue:[
+            self addUndo:(DeleteCharacters line:lineNr col:colNr info:'insert').
+        ]
+    ].
+
+    "Modified: / 17-07-2019 / 07:30:46 / Claus Gittinger"
 !
 
 insertCharAtCursor:aCharacter
@@ -4273,9 +4283,15 @@
 
     |originalContents|
 
-    originalContents := self contents.
-    self contents:newContents keepUndoHistory:true.
-    self addUndo:(ReplaceContents text:originalContents info:'replace').
+    undoSupport isInTransaction ifFalse:[
+        self contents:newContents keepUndoHistory:true.
+    ] ifTrue:[
+        originalContents := self contents.
+        self contents:newContents keepUndoHistory:true.
+        self addUndo:(ReplaceContents text:originalContents info:'replace').
+    ].
+
+    "Modified: / 17-07-2019 / 08:02:15 / Claus Gittinger"
 !
 
 replaceFromCharacterPosition:charPos1 to:charPos2 with:newString
@@ -4564,9 +4580,13 @@
 
     |originalLine|
 
-    originalLine := self listAt:lineNr.
-    self addUndo:(ReplaceLine line:lineNr string:originalLine info:'replace').
+    undoSupport isInTransaction ifTrue:[
+        originalLine := self listAt:lineNr.
+        self addUndo:(ReplaceLine line:lineNr string:originalLine info:'replace').
+    ].
     super withoutRedrawAt:lineNr put:aString.
+
+    "Modified: / 17-07-2019 / 07:29:18 / Claus Gittinger"
 !
 
 withoutRedrawInsertLine:aString before:lineNr
@@ -4583,8 +4603,12 @@
 
     self basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr.
     self isReadOnly ifFalse:[
-        self addUndo:(DeleteRange line1:lineNr col1:1 line2:lineNr+end-start+1 col2:0 info:'insert').
-    ].
+        undoSupport isInTransaction ifTrue:[
+            self addUndo:(DeleteRange line1:lineNr col1:1 line2:lineNr+end-start+1 col2:0 info:'insert').
+        ].
+    ].
+
+    "Modified: / 17-07-2019 / 07:27:40 / Claus Gittinger"
 !
 
 withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr
@@ -6157,6 +6181,11 @@
 
     |wasOn|
 
+    ( #( #Control_L #Control_R #Control ) includes:key) ifTrue:[
+        super keyPress:key x:x y:y.
+        ^ self.
+    ].
+    
     wasOn := cursorShown.
 
     NoModificationError
@@ -6176,6 +6205,7 @@
 
     "Modified: / 18-04-2011 / 21:35:27 / cg"
     "Modified (format): / 30-04-2016 / 20:45:52 / cg"
+    "Modified: / 17-07-2019 / 07:23:42 / Claus Gittinger"
 !
 
 mapped
@@ -6851,9 +6881,7 @@
         "
          now, delete it
         "
-        self
-            undoableDo:[self deleteSelection]
-            info:'Delete'.
+        self undoableDo:[self deleteSelection] info:'Delete'.
         lastReplacementInfo lastReplacement: nil
     ] ifFalse:[
         "
@@ -6865,6 +6893,7 @@
     ]
 
     "Modified: / 11-11-2017 / 12:53:45 / cg"
+    "Modified (format): / 17-07-2019 / 07:35:03 / Claus Gittinger"
 !
 
 editMenu