--- a/EditTextView.st Wed Apr 12 09:06:30 2017 +0200
+++ b/EditTextView.st Tue Apr 25 12:58:23 2017 +0200
@@ -4780,8 +4780,9 @@
leftPart isNil ifTrue:[
leftPart := ''.
autoIndent ifTrue:[
- (i := self leftIndentForLine:cursorLine) == 0 ifFalse:[
- leftPart := String new:i
+ "/ cg: only do this, if the second line has no indent
+ (i := self leftIndentOfLine:(lineNr+1)) == 0 ifTrue:[
+ leftPart := String new:(self leftIndentForLine:lineNr)
]
]
].
@@ -4804,8 +4805,8 @@
self deleteLine:nextLineNr
]
- "Created: 9.9.1997 / 09:27:38 / cg"
- "Modified: 9.9.1997 / 09:28:27 / cg"
+ "Created: / 09-09-1997 / 09:27:38 / cg"
+ "Modified: / 25-04-2017 / 12:41:20 / cg"
!
basicReplace:aCharacter atLine:lineNr col:colNr
@@ -5367,22 +5368,22 @@
"handle keyboard input"
<resource: #keyboard (#Paste #Insert #PasteFromHistory #Cut #Again #AgainForAll
- #Replace #Undo #Redo #Accept
- #Delete #BasicDelete #BackSpace #BasicBackspace
- #DeleteSpaces #Join
- #SearchMatchingParent #SelectMatchingParents
- #SelectWord #ExpandSelectionByWord
- #SelectToEnd #SelectFromBeginning
- #SelectLine #ExpandSelectionByLine
- #BeginOfLine #EndOfLine #NextWord #PreviousWord
- #CursorRight #CursorDown #CursorLeft #CursorUp
- #Return #Tab #BackTab #NonInsertingTab #Escape
- #GotoLine #BeginOfText #EndOfText
- #InsertLine #DeleteLine
- #SelectLineFromBeginning
- #LearnKeyboardMacro #ExecuteKeyboardMacro #ToggleInsertMode
- #OpenSpecialCharacterWindow #InsertUUID
- #'F*' #'f*')>
+ #Replace #Undo #Redo #Accept
+ #Delete #BasicDelete #BackSpace #BasicBackspace
+ #DeleteSpaces #Join
+ #SearchMatchingParent #SelectMatchingParents
+ #SelectWord #ExpandSelectionByWord
+ #SelectToEnd #SelectFromBeginning
+ #SelectLine #ExpandSelectionByLine
+ #BeginOfLine #EndOfLine #NextWord #PreviousWord
+ #CursorRight #CursorDown #CursorLeft #CursorUp
+ #Return #Tab #BackTab #NonInsertingTab #Escape
+ #GotoLine #BeginOfText #EndOfText
+ #InsertLine #DeleteLine
+ #SelectLineFromBeginning
+ #LearnKeyboardMacro #ExecuteKeyboardMacro #ToggleInsertMode
+ #OpenSpecialCharacterWindow #InsertUUID
+ #'F*' #'f*')>
|fKeyMacros shiftPressed ctrlPressed i event macroName
immediateCompletion currentUserPrefs rawKey|
@@ -5394,9 +5395,9 @@
(immediateCompletion
or:[currentUserPrefs codeCompletionOnControlKey
or:[currentUserPrefs codeCompletionOnTabKey]]) ifTrue:[
- completionSupport isNil ifTrue:[
- self initializeCompletionSupport.
- ].
+ completionSupport isNil ifTrue:[
+ self initializeCompletionSupport.
+ ].
].
"/ JV: why setting it to nil here?
@@ -5404,141 +5405,141 @@
"/ completionService := nil
"/ ].
completionSupport notNil ifTrue:[
- completionSupport stopCompletionProcess.
- (completionSupport handleKeyPress:key x:x y:y) ifTrue:["eaten" ^ self].
+ completionSupport stopCompletionProcess.
+ (completionSupport handleKeyPress:key x:x y:y) ifTrue:["eaten" ^ self].
].
key isSymbol ifTrue:[
- (device modifierKeys includes:key) ifFalse:[
- lastReplacementInfo stillCollectingInput:false.
- ]
+ (device modifierKeys includes:key) ifFalse:[
+ lastReplacementInfo stillCollectingInput:false.
+ ]
].
(key == #LearnKeyboardMacro) ifTrue:[
- lastReplacementInfo stillCollectingInput:false.
- self toggleLearnMode.
- ^ self
+ lastReplacementInfo stillCollectingInput:false.
+ self toggleLearnMode.
+ ^ self
].
(key == #ExecuteKeyboardMacro) ifTrue:[
- lastReplacementInfo stillCollectingInput:false.
- self executeLearnedKeyboardMacro.
- ^ self.
+ lastReplacementInfo stillCollectingInput:false.
+ self executeLearnedKeyboardMacro.
+ ^ self.
].
(key == #Undo) ifTrue:[self undo. ^self].
(key == #Redo) ifTrue:[self redo. ^self].
self learnMode ifTrue:[
- event := WindowGroup lastEventQuerySignal query.
- learnedMacro add:event.
+ event := WindowGroup lastEventQuerySignal query.
+ learnedMacro add:event.
].
(self executekeyboardMacroNamed:key) ifTrue:[
- "the macro named key exists"
- ^ self
+ "the macro named key exists"
+ ^ self
].
key isSymbol ifFalse:[
- "the usual case: key is a character, but maybe a string also (in X11)"
- self handleNonCommandKey:key.
- ^ self
+ "the usual case: key is a character, but maybe a string also (in X11)"
+ self handleNonCommandKey:key.
+ ^ self
].
event isNil ifTrue:[
- event := WindowGroup lastEventQuerySignal query.
+ event := WindowGroup lastEventQuerySignal query.
].
shiftPressed := event hasShift.
ctrlPressed := event hasCtrl and:[(event rawKey asString startsWith:'Ctrl') not].
rawKey := event rawKey.
key == #InsertUUID ifTrue:[
- self insertUUID.
- ^ self.
+ self insertUUID.
+ ^ self.
].
(key == #DeleteWordBeforeCursor) ifTrue:[
- self deleteWordBeforeCursor.
- ^ self.
+ self deleteWordBeforeCursor.
+ ^ self.
].
(rawKey == #BackSpace or:[key == #BasicBackspace]) ifTrue:[
- selectionStartLine notNil ifTrue:[
- ((key == #BasicBackspace)
- or:[ currentUserPrefs deleteSetsClipboardText not ])
- ifTrue:[
- self deleteSelection.
- ] ifFalse: [
- self copyAndDeleteSelection.
- ].
- ] ifFalse:[
- self makeCursorVisible.
+ selectionStartLine notNil ifTrue:[
+ ((key == #BasicBackspace)
+ or:[ currentUserPrefs deleteSetsClipboardText not ])
+ ifTrue:[
+ self deleteSelection.
+ ] ifFalse: [
+ self copyAndDeleteSelection.
+ ].
+ ] ifFalse:[
+ self makeCursorVisible.
"/ (shiftPressed and:[ ctrlPressed ]) ifTrue:[
"/ self deleteWordBeforeCursor.
"/ ] ifFalse:[
- self deleteCharBeforeCursor.
+ self deleteCharBeforeCursor.
"/ ].
- ].
- true "immediateCompletion" ifTrue:[
- completionSupport notNil ifTrue:[
- completionSupport postKeyPress:key
- ].
- ].
- ^ self
+ ].
+ true "immediateCompletion" ifTrue:[
+ completionSupport notNil ifTrue:[
+ completionSupport postKeyPress:key
+ ].
+ ].
+ ^ self
].
(key == #ToggleAutoIndent) ifTrue:[
- self autoIndent:(autoIndent not).
- ^ self.
+ self autoIndent:(autoIndent not).
+ ^ self.
].
key == #ToggleInsertMode ifTrue:[
- self insertMode:(editMode value == EditMode insertMode) not.
- ^ self.
+ self insertMode:(editMode value == EditMode insertMode) not.
+ ^ self.
].
key == #OpenSpecialCharacterWindow ifTrue:[
- CharacterSetView notNil ifTrue:[
- self specialCharacters.
- ^ self.
- ]
+ CharacterSetView notNil ifTrue:[
+ self specialCharacters.
+ ^ self.
+ ]
].
replacing := false.
"
Fn pastes a key-sequence (but only if not overlayed with
- another function in the keyboard map)
+ another function in the keyboard map)
see TextView>>:x:y
"
(key at:1) asLowercase == $f ifTrue:[
- (('[fF][0-9]' match:key)
- or:['[fF][0-9][0-9]' match:key]) ifTrue:[
- shiftPressed ifFalse:[
- fKeyMacros := currentUserPrefs functionKeySequences.
- fKeyMacros notNil ifTrue:[
- (fKeyMacros includesKey:key) ifTrue:[
- self pasteOrReplace:(fKeyMacros at:key) asStringCollection.
- ^ self
- ]
- ]
- ]
- ].
+ (('[fF][0-9]' match:key)
+ or:['[fF][0-9][0-9]' match:key]) ifTrue:[
+ shiftPressed ifFalse:[
+ fKeyMacros := currentUserPrefs functionKeySequences.
+ fKeyMacros notNil ifTrue:[
+ (fKeyMacros includesKey:key) ifTrue:[
+ self pasteOrReplace:(fKeyMacros at:key) asStringCollection.
+ ^ self
+ ]
+ ]
+ ]
+ ].
].
(key == #'Ctrl8' or:[key == #'Ctrl9']) ifTrue:[
- self parenthizeSelectionWith:$( and:$).
- ^ self.
+ self parenthizeSelectionWith:$( and:$).
+ ^ self.
].
(key == #'Ctrl2') ifTrue:[
- self parenthizeSelectionWith:$" and:$".
- ^ self.
+ self parenthizeSelectionWith:$" and:$".
+ ^ self.
].
(key == #'Ctrl#') ifTrue:[
- self parenthizeSelectionWith:$' and:$'.
- ^ self.
+ self parenthizeSelectionWith:$' and:$'.
+ ^ self.
].
(key == #'ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst') ifTrue:[
- self convertSelectionToLowercaseOrUppercaseOrUppercaseFirst.
- ^ self.
+ self convertSelectionToLowercaseOrUppercaseOrUppercaseFirst.
+ ^ self.
].
(key == #Accept) ifTrue:[^ self accept].
@@ -5551,14 +5552,14 @@
(key == #Join) ifTrue:[self joinLines. ^self].
(key == #Replace) ifTrue:[self replace. ^self].
(key == #ExpandSelectionByWord) ifTrue:[
- self makeCursorVisible.
- self findNextWordAfterSelectionAndAddToSelection.
- ^ self
+ self makeCursorVisible.
+ self findNextWordAfterSelectionAndAddToSelection.
+ ^ self
].
(key == #SelectWord) ifTrue:[
- self makeCursorVisible.
- self selectWordUnderCursor.
- ^ self
+ self makeCursorVisible.
+ self selectWordUnderCursor.
+ ^ self
].
(key == #SearchMatchingParent) ifTrue:[self searchForMatchingParenthesis. ^ self].
@@ -5576,60 +5577,60 @@
"
(key == #BeginOfLine) ifTrue:[
- "/ cg: this is complete rubbish - you have to define a mapping from
- "/ some shifted key to selectFromBeginOfLine
- "/ (otherwise, no shifted key could ever be mapped to BegnOfLine)
- "/ see code below.
- false "shiftPressed" ifTrue: [
- "/ "Original St/X code - now use Ctrl modifier"
- "/ self unselect.
- "/ self cursorHome.
- "Jan's modification"
- "/ self addToSelectionAfter:[ self cursorToBeginOfLine ].
- "/ Jan's modification modified by his own request ;-))
- self selectFromBeginOfLine.
- ] ifFalse: [
- self unselect.
- ctrlPressed ifTrue:[
- self cursorHome.
- ] ifFalse:[
- self cursorToBeginOfLine.
- ]
- ].
- ^ self
+ "/ cg: this is complete rubbish - you have to define a mapping from
+ "/ some shifted key to selectFromBeginOfLine
+ "/ (otherwise, no shifted key could ever be mapped to BegnOfLine)
+ "/ see code below.
+ false "shiftPressed" ifTrue: [
+ "/ "Original St/X code - now use Ctrl modifier"
+ "/ self unselect.
+ "/ self cursorHome.
+ "Jan's modification"
+ "/ self addToSelectionAfter:[ self cursorToBeginOfLine ].
+ "/ Jan's modification modified by his own request ;-))
+ self selectFromBeginOfLine.
+ ] ifFalse: [
+ self unselect.
+ ctrlPressed ifTrue:[
+ self cursorHome.
+ ] ifFalse:[
+ self cursorToBeginOfLine.
+ ]
+ ].
+ ^ self
].
(key == #BSelectFromeginOfLine) ifTrue:[
- self selectFromBeginOfLine.
- ^ self
+ self selectFromBeginOfLine.
+ ^ self
].
(key == #EndOfLine) ifTrue:[
- "/ cg: this is complete rubbish - you have to define a mapping from
- "/ some shifted key to selectFromBeginOfLine
- "/ (otherwise, no shifted key could ever be mapped to BegnOfLine)
- "/ see code below.
- false "shiftPressed" ifTrue:[
- "/ "Original St/X code - now use Ctrl modifier"
- "/ self unselect.
- "/ self cursorToBottom
- " Jan's modification"
- "/ self addToSelectionAfter:[ self cursorToEndOfLine ] .
- "/ Jan's modification modified by his own request ;-))
- self selectToEndOfLine.
- ] ifFalse:[
- self unselect.
- ctrlPressed ifTrue:[
- self cursorToBottom
- ] ifFalse:[
- self cursorToEndOfLine.
- ]
- ].
- ^ self
+ "/ cg: this is complete rubbish - you have to define a mapping from
+ "/ some shifted key to selectFromBeginOfLine
+ "/ (otherwise, no shifted key could ever be mapped to BegnOfLine)
+ "/ see code below.
+ false "shiftPressed" ifTrue:[
+ "/ "Original St/X code - now use Ctrl modifier"
+ "/ self unselect.
+ "/ self cursorToBottom
+ " Jan's modification"
+ "/ self addToSelectionAfter:[ self cursorToEndOfLine ] .
+ "/ Jan's modification modified by his own request ;-))
+ self selectToEndOfLine.
+ ] ifFalse:[
+ self unselect.
+ ctrlPressed ifTrue:[
+ self cursorToBottom
+ ] ifFalse:[
+ self cursorToEndOfLine.
+ ]
+ ].
+ ^ self
].
(key == #SelectToEndOfLine) ifTrue:[
- self selectToEndOfLine.
- ^ self
+ self selectToEndOfLine.
+ ^ self
].
(key == #NextWord) ifTrue:[self cursorToNextWord. ^self].
@@ -5641,189 +5642,189 @@
or:[rawKey == #CursorDown
or:[rawKey == #CursorLeft
or:[rawKey == #CursorUp]]]) ifTrue:[
- self cursorKeyPress:rawKey shifted:shiftPressed.
- ^ self.
+ self cursorKeyPress:rawKey shifted:shiftPressed.
+ ^ self.
].
(key == #ShiftReturn or:[key == #NonInsertingReturn]) ifTrue:[
- self unselect. self cursorReturn.
- ^ self
+ self unselect. self cursorReturn.
+ ^ self
].
(key == #Return) ifTrue:[
- shiftPressed ifTrue:[
- self unselect. self cursorReturn.
- ^ self
- ].
-
- self isReadOnly ifTrue:[
- self unselect; makeCursorVisible.
- self cursorReturn
- ] ifFalse:[
- self isInInsertMode ifFalse:[
- self cursorReturn:true.
- autoIndent == true ifTrue:[
- i := self leftIndentForLine:(cursorLine + 1).
- (self listAt:cursorLine) isEmptyOrNil ifTrue:[
- self cursorCol:(i+1 max:1)
- ]
- ]
- ] ifTrue:[
- |left right oldIndent|
-
- "/ old version just unselected ...
- "/ self unselect; makeCursorVisible.
-
- "/ new version deletes ...
- typeOfSelection == #paste ifTrue:[
- self unselect; makeCursorVisible.
- ] ifFalse:[
- self copyAndDeleteSelection.
- ].
- left := (self listAt:cursorLine to:cursorCol-1) ? ''.
- right := (self listAt:cursorLine from:cursorCol) ? ''.
- self insertCharAtCursor:(Character cr).
-
- autoIndent == true ifTrue:[
- (right isEmpty and:[cursorCol ~~ 1]) ifTrue:[
- "/ nothing to do.
- ] ifFalse:[
- ((self listAt:cursorLine) isEmptyOrNil
- or:[ false "cursorCol == 1" ]) ifTrue:[
- i := (self leftIndentForLine:cursorLine).
- left := left withoutSeparators.
- right := right withoutSeparators.
- (left endsWith:'[') ifTrue:[
+ shiftPressed ifTrue:[
+ self unselect. self cursorReturn.
+ ^ self
+ ].
+
+ self isReadOnly ifTrue:[
+ self unselect; makeCursorVisible.
+ self cursorReturn
+ ] ifFalse:[
+ self isInInsertMode ifFalse:[
+ self cursorReturn:true.
+ autoIndent == true ifTrue:[
+ i := self leftIndentForLine:(cursorLine + 1).
+ (self listAt:cursorLine) isEmptyOrNil ifTrue:[
+ self cursorCol:(i+1 max:1)
+ ]
+ ]
+ ] ifTrue:[
+ |left right oldIndent|
+
+ "/ old version just unselected ...
+ "/ self unselect; makeCursorVisible.
+
+ "/ new version deletes ...
+ typeOfSelection == #paste ifTrue:[
+ self unselect; makeCursorVisible.
+ ] ifFalse:[
+ self copyAndDeleteSelection.
+ ].
+ left := (self listAt:cursorLine to:cursorCol-1) ? ''.
+ right := (self listAt:cursorLine from:cursorCol) ? ''.
+ self insertCharAtCursor:(Character cr).
+
+ autoIndent == true ifTrue:[
+ (right isEmpty and:[cursorCol ~~ 1]) ifTrue:[
+ "/ nothing to do.
+ ] ifFalse:[
+ ((self listAt:cursorLine) isEmptyOrNil
+ or:[ false "cursorCol == 1" ]) ifTrue:[
+ i := (self leftIndentForLine:cursorLine).
+ left := left withoutSeparators.
+ right := right withoutSeparators.
+ (left endsWith:'[') ifTrue:[
"/ i := i + 4.
- ] ifFalse:[
- (false "(left endsWith:']')" or:[(right startsWith:']')]) ifTrue:[
- i := i - 4.
- ].
- ].
- oldIndent := self leftIndentOfLine:cursorLine.
- self indentFromLine:cursorLine toLine:cursorLine by:(i-oldIndent).
- self st80EditMode ifTrue:[
- (self listAt:cursorLine) size < i ifTrue:[
- self insertStringAtCursor:(String new:((i-oldIndent) max:0)).
- ].
- ].
- self cursorCol:(i+1 max:1)
- ].
- ]
- ].
- ].
- ].
- ^ self
+ ] ifFalse:[
+ (false "(left endsWith:']')" or:[(right startsWith:']')]) ifTrue:[
+ i := i - 4.
+ ].
+ ].
+ oldIndent := self leftIndentOfLine:cursorLine.
+ self indentFromLine:cursorLine toLine:cursorLine by:(i-oldIndent).
+ self st80EditMode ifTrue:[
+ (self listAt:cursorLine) size < i ifTrue:[
+ self insertStringAtCursor:(String new:((i-oldIndent) max:0)).
+ ].
+ ].
+ self cursorCol:(i+1 max:1)
+ ].
+ ]
+ ].
+ ].
+ ].
+ ^ self
].
(key == #NonInsertingTab) ifTrue:[
- self unselect. self cursorTab.
- ^ self
+ self unselect. self cursorTab.
+ ^ self
].
((key == #BackTab) or:[(key == #Tab)]) ifTrue:[
- self tabMeansNextField ifTrue:[^ super keyPress:key x:x y:y].
-
- self hasSelection ifTrue:[
- selectStyle == #line ifTrue:[
- ((key == #Tab) and:[shiftPressed not]) ifTrue:[
- macroName := #IndentBy4.
- ] ifFalse:[
- macroName := #UndentBy4.
- ].
- macroName notNil ifTrue:[
- self executekeyboardMacroNamed:macroName.
- ].
- ]
- ].
-
- self unselect.
- (key == #Tab) ifTrue:[
- (shiftPressed or:[self isInInsertMode not]) ifTrue:[
- self cursorTab.
- ^ self
- ].
- self insertTabAtCursor.
- ^ self
- ].
- self cursorBacktab.
- ^ self
+ self tabMeansNextField ifTrue:[^ super keyPress:key x:x y:y].
+
+ self hasSelection ifTrue:[
+ selectStyle == #line ifTrue:[
+ ((key == #Tab) and:[shiftPressed not]) ifTrue:[
+ macroName := #IndentBy4.
+ ] ifFalse:[
+ macroName := #UndentBy4.
+ ].
+ macroName notNil ifTrue:[
+ self executekeyboardMacroNamed:macroName.
+ ].
+ ]
+ ].
+
+ self unselect.
+ (key == #Tab) ifTrue:[
+ (shiftPressed or:[self isInInsertMode not]) ifTrue:[
+ self cursorTab.
+ ^ self
+ ].
+ self insertTabAtCursor.
+ ^ self
+ ].
+ self cursorBacktab.
+ ^ self
].
"/ key == #DeleteSpaces ifTrue:[
(rawKey == #Delete) ifTrue:[
- shiftPressed ifTrue:[
- [(cursorCol <= (self listAt:cursorLine) size)
- and:[self characterUnderCursor isSeparator]] whileTrue:[
- self makeCursorVisible.
- self deleteCharAtCursor.
- ].
- ^ self
- ]
+ shiftPressed ifTrue:[
+ [(cursorCol <= (self listAt:cursorLine) size)
+ and:[self characterUnderCursor isSeparator]] whileTrue:[
+ self makeCursorVisible.
+ self deleteCharAtCursor.
+ ].
+ ^ self
+ ]
].
(rawKey == #Delete
or:[key == #BasicDelete]) ifTrue:[
- selectionStartLine notNil ifTrue:[
+ selectionStartLine notNil ifTrue:[
"/ Again function is not supporting Delete action (on purpose, to avoid replacing the next search string)
"/ To remove text repetetively, use Cut instead.
"/ self setLastStringToReplace: self selection asStringWithoutFinalCR.
"/ lastReplacementInfo lastReplacement: nil.
- ((key == #BasicDelete)
- or:[currentUserPrefs deleteSetsClipboardText not]) ifTrue:[
- self deleteSelection.
- ] ifFalse:[
- self copyAndDeleteSelection.
- ].
- ^ self
- ].
- self makeCursorVisible.
- self deleteCharAtCursor.
- ^ self
+ ((key == #BasicDelete)
+ or:[currentUserPrefs deleteSetsClipboardText not]) ifTrue:[
+ self deleteSelection.
+ ] ifFalse:[
+ self copyAndDeleteSelection.
+ ].
+ ^ self
+ ].
+ self makeCursorVisible.
+ self deleteCharAtCursor.
+ ^ self
].
(key == #BeginOfText) ifTrue:[ "i.e. HOME"
- self unselect.
- cursorVisibleLine == 1 ifTrue:[
- self cursorHome.
- ] ifFalse:[
- self cursorToFirstVisibleLine
- ].
- ^ self
+ self unselect.
+ cursorVisibleLine == 1 ifTrue:[
+ self cursorHome.
+ ] ifFalse:[
+ self cursorToFirstVisibleLine
+ ].
+ ^ self
].
(key == #EndOfText) ifTrue:[ "i.e. END"
- self unselect.
- cursorVisibleLine == nFullLinesShown ifTrue:[
- self cursorToBottom.
- ] ifFalse:[
- self cursorToLastVisibleLine
- ].
- ^ self
+ self unselect.
+ cursorVisibleLine == nFullLinesShown ifTrue:[
+ self cursorToBottom.
+ ] ifFalse:[
+ self cursorToLastVisibleLine
+ ].
+ ^ self
].
((key == #Escape)
or:[key == #SelectLineFromBeginning]) ifTrue:[
- self makeCursorVisible.
- self unselect. self selectCursorLineFromBeginning.
- ^ self
+ self makeCursorVisible.
+ self unselect. self selectCursorLineFromBeginning.
+ ^ self
].
(key == #SelectLine) ifTrue:[
- self makeCursorVisible.
- self unselect. self selectCursorLine.
- ^ self
+ self makeCursorVisible.
+ self unselect. self selectCursorLine.
+ ^ self
].
(key == #ExpandSelectionByLine) ifTrue:[
- "/ self makeCursorVisible.
- self selectExpandCursorLine.
- ^ self
+ "/ self makeCursorVisible.
+ self selectExpandCursorLine.
+ ^ self
].
(key == #DeleteLine) ifTrue:[
- self makeCursorVisible.
- self unselect. self deleteCursorLine.
- ^ self
+ self makeCursorVisible.
+ self unselect. self deleteCursorLine.
+ ^ self
].
(key == #InsertLine) ifTrue:[
- self makeCursorVisible.
- self unselect. self insertLine:nil before:cursorLine.
- ^ self
+ self makeCursorVisible.
+ self unselect. self insertLine:nil before:cursorLine.
+ ^ self
].
super keyPress:key x:x y:y
@@ -6278,25 +6279,29 @@
|line lnr indent|
lnr := lineNr.
-
- "/ [lnr ~~ 1] whileTrue:[
- (lnr ~~ 1) ifTrue:[
- lnr := lnr - 1.
- line := self listAt:lnr.
-
- line notNil ifTrue:[
- indent := line indexOfNonSeparatorStartingAt:1.
- indent ~~ 0 ifTrue:[
- (line endsWith:$[) ifTrue:[
- ^ indent + 4 - 1
- ].
- ^ indent - 1
- ]
- ]
+ [lnr > 1] whileTrue:[
+ lnr := lnr - 1.
+ line := self listAt:lnr.
+
+ line notEmptyOrNil ifTrue:[
+ indent := (line indexOfNonSeparatorStartingAt:1) - 1.
+ indent >= 0 ifTrue:[
+ (self editedLanguage isNil or:[self editedLanguage isSmalltalk]) ifTrue:[
+ (line endsWith:$[) ifTrue:[
+ ^ indent + 4
+ ].
+ (line endsWith:']') ifTrue:[
+ ^ indent - 4
+ ].
+ ].
+ ^ indent
+ ]
+ ]
].
^ 0
- "Created: 5.3.1996 / 14:58:53 / cg"
+ "Created: / 05-03-1996 / 14:58:53 / cg"
+ "Modified (format): / 25-04-2017 / 12:57:44 / cg"
!
undentBy4