#UI_ENHANCEMENT by exept
authorClaus Gittinger <cg@exept.de>
Tue, 30 Jul 2019 09:47:58 +0200
changeset 6652 2cb1a506f57d
parent 6651 226b0380aadf
child 6653 3519d5a67834
#UI_ENHANCEMENT by exept class: EditTextView changed: #handleReturnPressed no autoindent if cursor is at the very beginning of a line
EditTextView.st
--- a/EditTextView.st	Mon Jul 29 11:52:44 2019 +0200
+++ b/EditTextView.st	Tue Jul 30 09:47:58 2019 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
@@ -6077,13 +6075,15 @@
     "return key pressed - handle autoIndent"
     
     |i leftPart rightPart startIndent oldIndent newIndent language 
-     bracketStrings endsWithOpeningBracket startsWithClosingBracket|
+     bracketStrings endsWithOpeningBracket startsWithClosingBracket
+     cursorColBefore|
     
     self isReadOnly ifTrue:[
         self unselect; makeCursorVisible.
         self cursorReturn.
         ^ self.
     ].
+
     self isInInsertMode ifFalse:[
         self cursorReturn:true.
         self autoIndent ifTrue:[
@@ -6095,6 +6095,8 @@
         ^ self.
     ].
 
+    cursorColBefore := cursorCol.
+
     "/ old version just unselected ...
     "/ self unselect; makeCursorVisible.
 
@@ -6112,6 +6114,7 @@
     rightPart := ((self listAt:cursorLine from:cursorCol) ? '') string.
     self insertCharAtCursor:(Character cr).
     self autoIndent ifFalse:[^ self].
+    cursorColBefore == 1 ifTrue:[^ self].
 
     endsWithOpeningBracket := startsWithClosingBracket := [:line | false].