EditTextView.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 27 Sep 2013 23:01:16 +0100
branchtext-view-selection-refactoring
changeset 4851 6cebb40eb268
parent 4850 78099a0b25d2
parent 4801 69a5bff7b5cd
child 4852 04fe7fca9320
permissions -rw-r--r--
Merged 78099a0b25d2 and 69a5bff7b5cd (branch default - CVS HEAD)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
2184
fb634dc3e606 learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
    12
"{ Package: 'stx:libwidg' }"
fb634dc3e606 learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
    13
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    14
TextView subclass:#EditTextView
2724
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
    15
	instanceVariableNames:'cursorLine cursorVisibleLine cursorCol cursorShown
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
    16
		prevCursorState readOnly modifiedChannel fixedSize exceptionBlock
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
    17
		cursorFgColor cursorBgColor cursorNoFocusFgColor cursorType
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
    18
		cursorTypeNoFocus typeOfSelection lastAction replacing
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
    19
		showMatchingParenthesis hasKeyboardFocus acceptAction lockUpdates
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
    20
		tabMeansNextField autoIndent insertMode editMode trimBlankLines
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
    21
		wordWrap replacementWordSelectStyle acceptChannel acceptEnabled
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
    22
		st80Mode disableIfInvisible cursorMovementWhenUpdating learnMode
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
    23
		learnedMacro cursorLineHolder cursorColHolder tabRequiresControl
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
    24
		undoSupport lastStringFromReplaceForNextSearch
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
    25
		lastReplacementInfo completionSupport'
2724
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
    26
	classVariableNames:'DefaultCursorForegroundColor DefaultCursorBackgroundColor
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
    27
		DefaultCursorType DefaultCursorNoFocusForegroundColor
4673
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
    28
		DefaultCursorTypeNoFocus LastColumnNumberForSort Macros'
2724
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
    29
	poolDictionaries:''
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
    30
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    31
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    32
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    33
Object subclass:#EditAction
3115
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
    34
	instanceVariableNames:'userFriendlyInfo'
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    35
	classVariableNames:''
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    36
	poolDictionaries:''
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    37
	privateIn:EditTextView
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    38
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    39
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    40
EditTextView::EditAction subclass:#DeleteRange
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    41
	instanceVariableNames:'line1 col1 line2 col2'
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    42
	classVariableNames:''
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    43
	poolDictionaries:''
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    44
	privateIn:EditTextView
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    45
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    46
3156
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
    47
EditTextView::EditAction subclass:#DeleteCharacters
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
    48
	instanceVariableNames:'line col1 col2'
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
    49
	classVariableNames:''
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
    50
	poolDictionaries:''
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
    51
	privateIn:EditTextView
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
    52
!
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
    53
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    54
Object subclass:#EditMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    55
	instanceVariableNames:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    56
	classVariableNames:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    57
	poolDictionaries:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    58
	privateIn:EditTextView
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    59
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    60
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    61
EditTextView::EditMode subclass:#InsertAndSelectMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    62
	instanceVariableNames:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    63
	classVariableNames:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    64
	poolDictionaries:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    65
	privateIn:EditTextView::EditMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    66
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    67
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    68
EditTextView::EditMode subclass:#InsertMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    69
	instanceVariableNames:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    70
	classVariableNames:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    71
	poolDictionaries:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    72
	privateIn:EditTextView::EditMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    73
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    74
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    75
EditTextView::EditMode subclass:#OverwriteMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    76
	instanceVariableNames:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    77
	classVariableNames:'InsertMode OverwriteMode InsertAndSelectMode'
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    78
	poolDictionaries:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    79
	privateIn:EditTextView::EditMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    80
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
    81
3813
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
    82
Query subclass:#ExecutingMacroQuery
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
    83
	instanceVariableNames:''
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
    84
	classVariableNames:''
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
    85
	poolDictionaries:''
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
    86
	privateIn:EditTextView
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
    87
!
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
    88
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
    89
Object subclass:#LastReplacementInfo
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
    90
	instanceVariableNames:'lastReplacement lastStringToReplace lastReplaceWasMatch
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
    91
		lastReplaceIgnoredCase'
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
    92
	classVariableNames:''
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
    93
	poolDictionaries:''
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
    94
	privateIn:EditTextView
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
    95
!
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
    96
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    97
EditTextView::EditAction subclass:#PasteString
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    98
	instanceVariableNames:'line col string selected'
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
    99
	classVariableNames:''
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   100
	poolDictionaries:''
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   101
	privateIn:EditTextView
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   102
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   103
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   104
EditTextView::EditAction subclass:#ReplaceCharacter
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   105
	instanceVariableNames:'line col character'
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   106
	classVariableNames:''
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   107
	poolDictionaries:''
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   108
	privateIn:EditTextView
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   109
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
   110
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
   111
EditTextView::EditAction subclass:#ReplaceCharacters
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
   112
	instanceVariableNames:'line col1 col2 characters'
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
   113
	classVariableNames:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
   114
	poolDictionaries:''
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
   115
	privateIn:EditTextView
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
   116
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
   117
3131
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
   118
EditTextView::EditAction subclass:#ReplaceContents
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
   119
	instanceVariableNames:'text'
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
   120
	classVariableNames:''
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
   121
	poolDictionaries:''
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
   122
	privateIn:EditTextView
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
   123
!
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
   124
3130
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
   125
EditTextView::EditAction subclass:#ReplaceLine
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
   126
	instanceVariableNames:'line text'
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
   127
	classVariableNames:''
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
   128
	poolDictionaries:''
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
   129
	privateIn:EditTextView
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
   130
!
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
   131
3402
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
   132
EditTextView::EditAction subclass:#ReplaceLines
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
   133
	instanceVariableNames:'line text'
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
   134
	classVariableNames:''
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
   135
	poolDictionaries:''
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
   136
	privateIn:EditTextView
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
   137
!
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
   138
865
d42c7c99e67d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 840
diff changeset
   139
!EditTextView class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   140
33
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   141
copyright
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   142
"
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   143
 COPYRIGHT (c) 1989 by Claus Gittinger
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   144
	      All Rights Reserved
33
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   145
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   146
 This software is furnished under a license and may be used
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   147
 only in accordance with the terms of that license and with the
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   148
 inclusion of the above copyright notice.   This software may not
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   149
 be provided or otherwise made available to, or used by, any
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   150
 other person.  No title to or ownership of the software is
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   151
 hereby transferred.
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   152
"
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   153
!
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   154
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   155
documentation
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   156
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   157
    a view for editable text - adds editing functionality to TextView
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   158
    Also, it adds accept functionality, and defines a new actionBlock:
297
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   159
    acceptAction to be performed for accept
125
claus
parents: 123
diff changeset
   160
claus
parents: 123
diff changeset
   161
    If used with a model, this is informed by sending it a changeMsg with
claus
parents: 123
diff changeset
   162
    the current contents as argument.
297
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   163
    (however, it is possible to define both changeMsg and acceptAction)
125
claus
parents: 123
diff changeset
   164
309
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   165
    Please read the historic notice in the ListView class.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   166
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   167
    [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   168
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   169
        cursorLine              <Number>        line where cursor sits (1..)
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   170
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   171
        cursorVisibleLine       <Number>        visible line where cursor sits (1..nLinesShown)
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   172
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   173
        cursorCol               <Number>        col where cursor sits (1..)
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   174
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   175
        cursorShown             <Boolean>       true, if cursor is currently shown
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   176
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   177
        readOnly                <Boolean>       true, if text may not be edited
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   178
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   179
        modifiedChannel         <ValueHolder>   holding true, if text has been modified.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   180
                                                cleared on accept.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   181
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   182
        acceptChannel           <ValueHolder>   holding true, if text has been accepted.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   183
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   184
        fixedSize               <Boolean>       true, if no lines may be added/removed
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   185
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   186
        exceptionBlock          <Block>         block to be evaluated when readonly text is about to be modified
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   187
                                                if it returns true, the modification will be done anyway.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   188
                                                if it returns anything else, the modification is not done.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   189
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   190
        cursorFgColor           <Color>         color used for cursor drawing
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   191
        cursorBgColor           <Color>         color used for cursor drawing
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   192
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   193
        cursorType              <Symbol>        how the cursor is drawn; currently implemented
4721
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
   194
                                                are #none, #block (solid-block cursor), #ibeam
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   195
                                                (vertical bar at insertion point)
4721
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
   196
                                                and #caret (caret below insertion-point).
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
   197
                                                see cursorType: for an up-to-date list.
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   198
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   199
        cursorTypeNoFocus       <Symbol>        like above, if view has no focus
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   200
                                                nil means: hide the cursor.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   201
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   202
        undoAction              <Block>         block which undoes last cut, paste or replace
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   203
                                                (not yet fully implemented)
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   204
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   205
        typeOfSelection         <Symbol>        #paste, if selection created by paste, nil otherwise
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   206
                                                this affects the next keyPress: if #paste it does not
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   207
                                                replace; otherwise it replaces the selection.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   208
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   209
        lastCut                 <String>        last cut or replaced string
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   210
4053
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
   211
        lastReplacementInfo     <LastReplacementInfo>        holds the information about the last replace action
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
   212
                                                             lastStringToReplace is the string to be replaced by lastReplacement
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
   213
                                                             lastReplacement is the string to replace lastStringToReplace
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
   214
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
   215
        lastStringFromReplaceForNextSearch   <String>        string to be taken be the next search action 
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
   216
                                                             (cleared after a new selection)
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   217
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   218
        replacing               <Boolean>       true if entered characters replace last selection
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   219
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   220
        showMatchingParenthesis <Boolean>       if true, shows matching parenthesis
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   221
                                                when entering one; this is the default.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   222
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   223
        hasKeyboardFocus        <Boolean>       true if this view has the focus
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   224
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   225
        acceptAction            <Block>         accept action - evaluated passing the contents as
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   226
                                                argument
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   227
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   228
        tabMeansNextField       <Boolean>       if true, Tab is ignored as input and shifts keyboard
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   229
                                                focus to the next field. For editTextViews, this is false
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   230
                                                by default (i.e. tabs can be entered into the text).
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   231
                                                For some subclasses (inputFields), this may be true.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   232
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   233
        trimBlankLines          <Boolean>       if true, trailing blanks are
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   234
                                                removed when editing.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   235
                                                Default is true.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   236
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   237
        wordWrap                <Boolean>       Currently not used.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   238
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   239
        lockUpdates             <Boolean>       internal, private
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   240
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   241
        prevCursorState         <Boolean>       temporary, private
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   242
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   243
        cursorMovementWhenUpdating
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   244
                                <Symbol>        defines where the cursor is to be positioned if the
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   245
                                                model changes its value by some outside activity
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   246
                                                (i.e. not by user input into the field).
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   247
                                                Can be one of:
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   248
                                                    #keep / nil     -> stay where it was
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   249
                                                    #endOfText      -> cursor to the end
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   250
                                                    #endOfLine      -> stay in the line, but move to end
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   251
                                                    #beginOfText    -> cursor to the beginning
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   252
                                                    #beginOfLine    -> stay in the line, but move to begin
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   253
                                                The default is #beginOfText
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   254
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   255
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   256
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   257
        dropTarget              <DropTarget|nil> drop operation descriptor or nil (drop disabled)
2589
62794ae04446 support drop
ca
parents: 2580
diff changeset
   258
62794ae04446 support drop
ca
parents: 2580
diff changeset
   259
2712
e83d71c9bdec ST80Mode classVariables is now UserPreferences.st80EditMode
Claus Gittinger <cg@exept.de>
parents: 2707
diff changeset
   260
    userPreference values:
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   261
        userPreferences.st80EditMode
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   262
                                <Boolean>       if true, cursor positioning is
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   263
                                                done as in vi or ST80; i.e.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   264
                                                wysiwyg mode is somewhat relaxed,
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   265
                                                in that the cursor cannot be
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   266
                                                positioned behind a lines end.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   267
                                                This is not yet completely implemented.
33
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   268
    used globals:
5eeef3ea8ebd added access methods for cursorLine & cursorCol
claus
parents: 25
diff changeset
   269
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   270
        DeleteHistory           <Text>          last 1000 lines of deleted text
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   271
                                                (but only if this variable exists already)
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   272
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   273
    [styleSheet parameters:]
121
claus
parents: 118
diff changeset
   274
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   275
        textCursorForegroundColor <Color>          cursor fg color; default: text background
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   276
        textCursorBackgroundColor <Color>          cursor bg color; default: text foreground
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   277
        textCursorNoFocusForegroundColor
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   278
                                  <Color>          cursor fg color if no focus; default: cursor fg color
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   279
        textCursorType            <Symbol>         cursor type; default:  #block
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   280
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   281
    [author:]
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   282
        Claus Gittinger
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   283
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   284
    [see also:]
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   285
        CodeView Workspace TextView ListView
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
   286
        EditField
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   287
"
297
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   288
!
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   289
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   290
examples
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   291
"
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   292
  non MVC operation:
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   293
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   294
    basic setup:
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   295
									[exBegin]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   296
	|top textView|
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   297
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   298
	top := StandardSystemView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   299
	top extent:300@200.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   300
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   301
	textView := EditTextView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   302
	textView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   303
	top addSubView:textView.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   304
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   305
	textView contents:('/etc/hosts' asFilename contentsOfEntireFile).
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   306
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   307
	top open.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   308
									[exEnd]
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   309
297
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   310
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   311
    with vertical scrollbar:
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   312
									[exBegin]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   313
	|top scrollView textView|
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   314
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   315
	top := StandardSystemView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   316
	top extent:300@200.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   317
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   318
	scrollView := ScrollableView for:EditTextView.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   319
	textView := scrollView scrolledView.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   320
	scrollView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   321
	top addSubView:scrollView.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   322
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   323
	textView contents:('/etc/hosts' asFilename contentsOfEntireFile).
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   324
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   325
	top open.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   326
									[exEnd]
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   327
297
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   328
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   329
    with horizontal & vertical scrollbars:
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   330
									[exBegin]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   331
	|top scrollView textView|
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   332
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   333
	top := StandardSystemView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   334
	top extent:300@200.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   335
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   336
	scrollView := HVScrollableView for:EditTextView.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   337
	textView := scrollView scrolledView.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   338
	scrollView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   339
	top addSubView:scrollView.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   340
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   341
	textView contents:('/etc/hosts' asFilename contentsOfEntireFile).
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   342
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   343
	top open.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   344
									[exEnd]
297
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   345
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   346
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   347
    set the action for accept:
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   348
									[exBegin]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   349
	|top textView|
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   350
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   351
	top := StandardSystemView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   352
	top extent:300@200.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   353
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   354
	textView := EditTextView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   355
	textView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   356
	top addSubView:textView.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   357
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   358
	textView contents:('/etc/hosts' asFilename contentsOfEntireFile).
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   359
	textView acceptAction:[:contents |
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   360
				Transcript showCR:'will not overwrite the file with:'.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   361
				Transcript showCR:contents asString
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   362
			      ].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   363
	top open.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   364
									[exEnd]
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   365
297
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   366
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   367
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
   368
    non-string (text) items:
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   369
									[exBegin]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   370
	|top textView list|
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   371
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   372
	list := '/etc/hosts' asFilename contentsOfEntireFile asStringCollection.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   373
	1 to:list size by:2 do:[:nr |
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   374
	    list at:nr put:(Text string:(list at:nr)
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   375
				 emphasis:(Array with:#bold with:(#color->Color red)))
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   376
	].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   377
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   378
	top := StandardSystemView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   379
	top extent:300@200.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   380
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   381
	textView := EditTextView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   382
	textView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   383
	top addSubView:textView.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   384
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   385
	textView contents:list.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   386
	top open.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   387
									[exEnd]
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
   388
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
   389
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
   390
297
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   391
  MVC operation:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   392
    (the examples model here is a plug simulating a real model;
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   393
     real world applications would not use a plug ..)
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   394
									[exBegin]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   395
	|top textView model|
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   396
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   397
	model := Plug new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   398
	model respondTo:#accepted:
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   399
		   with:[:newContents |
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   400
				Transcript showCR:'will not overwrite the file with:'.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   401
				Transcript showCR:newContents asString
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   402
			].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   403
	model respondTo:#getList
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   404
		   with:['/etc/hosts' asFilename contentsOfEntireFile].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   405
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   406
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   407
	top := StandardSystemView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   408
	top extent:300@200.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   409
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   410
	textView := EditTextView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   411
	textView origin:0.0 @ 0.0 corner:1.0 @ 1.0.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   412
	top addSubView:textView.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   413
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   414
	textView listMessage:#getList;
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   415
		 model:model;
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   416
		 changeMessage:#accepted:;
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   417
		 aspect:#list.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   418
	top open.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   419
									[exEnd]
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   420
297
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   421
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   422
    two textViews on the same model:
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   423
									[exBegin]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   424
	|top1 textView1 top2 textView2 model currentContents|
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   425
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   426
	model := Plug new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   427
	model respondTo:#accepted:
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   428
		   with:[:newContents |
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   429
				Transcript showCR:'accepted:'.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   430
				Transcript showCR:newContents asString.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   431
				currentContents := newContents.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   432
				model changed:#contents
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   433
			].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   434
	model respondTo:#getList
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   435
		   with:[Transcript showCR:'query'.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   436
			 currentContents].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   437
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   438
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   439
	top1 := StandardSystemView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   440
	top1 extent:300@200.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   441
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   442
	textView1 := EditTextView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   443
	textView1 origin:0.0 @ 0.0 corner:1.0 @ 1.0.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   444
	top1 addSubView:textView1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   445
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   446
	textView1 listMessage:#getList;
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   447
		  model:model;
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   448
		  aspect:#contents;
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   449
		  changeMessage:#accepted:.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   450
	top1 open.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   451
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   452
	top2 := StandardSystemView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   453
	top2 extent:300@200.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   454
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   455
	textView2 := EditTextView new.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   456
	textView2 origin:0.0 @ 0.0 corner:1.0 @ 1.0.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   457
	top2 addSubView:textView2.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   458
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   459
	textView2 listMessage:#getList;
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   460
		  model:model;
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   461
		  aspect:#contents;
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   462
		  changeMessage:#accepted:.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   463
	top2 open.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   464
									[exEnd]
297
08eec8838a4c beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   465
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   466
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   467
865
d42c7c99e67d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 840
diff changeset
   468
!EditTextView class methodsFor:'defaults'!
59
450ce95a72a4 *** empty log message ***
claus
parents: 46
diff changeset
   469
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   470
defaultCompletionSupportClass
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   471
    ^ nil
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   472
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   473
    "Created: / 26-09-2013 / 17:59:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4696
428c8bc44cfb refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4694
diff changeset
   474
!
428c8bc44cfb refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4694
diff changeset
   475
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   476
st80Mode
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   477
    "return true, if the st80 editing mode is turned on.
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   478
     This setting affects the behavior of the cursor, when positioned
3023
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
   479
     beyond the end of a line or the end of the text."
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   480
2647
23dca8f032c3 changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
   481
    ^ UserPreferences current st80EditMode
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   482
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   483
   "
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   484
    EditTextView st80Mode:true
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   485
    EditTextView st80Mode:false
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   486
   "
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   487
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   488
    "Modified: / 16.1.1998 / 22:54:57 / cg"
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   489
!
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   490
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   491
st80Mode:aBoolean
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   492
    "turns on/off st80 behavior, where the cursor cannot be positioned
2707
810c994db0b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
   493
     beyond the end of a line or the last line"
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   494
2647
23dca8f032c3 changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
   495
    UserPreferences current st80EditMode:aBoolean.
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   496
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   497
   "
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   498
    EditTextView st80Mode:true
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   499
    EditTextView st80Mode:false
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   500
   "
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   501
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   502
    "Modified: / 16.1.1998 / 22:55:19 / cg"
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   503
!
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   504
59
450ce95a72a4 *** empty log message ***
claus
parents: 46
diff changeset
   505
updateStyleCache
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   506
    "extract values from the styleSheet and cache them in class variables"
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   507
1390
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   508
    <resource: #style (#'textCursor.foregroundColor' #'textCursor.backgroundColor'
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   509
		       #'textCursor.noFocusForegroundColor'
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   510
		       #'textCursor.type'
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   511
		       #'textCursor.typeNoFocus'
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   512
		       #'editText.st80Mode')>
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   513
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   514
    DefaultCursorForegroundColor := StyleSheet colorAt:'textCursor.foregroundColor'.
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   515
    DefaultCursorBackgroundColor := StyleSheet colorAt:'textCursor.backgroundColor'.
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   516
    DefaultCursorNoFocusForegroundColor := StyleSheet colorAt:'textCursor.noFocusForegroundColor'.
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   517
    DefaultCursorType := StyleSheet at:'textCursor.type' default:#block.
1534
bcb211e1b41a read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
   518
    DefaultCursorTypeNoFocus := StyleSheet at:'textCursor.typeNoFocus'.
bcb211e1b41a read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
   519
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   520
    "
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   521
     self updateStyleCache
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   522
    "
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
   523
1534
bcb211e1b41a read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
   524
    "Modified: / 20.5.1998 / 04:27:41 / cg"
59
450ce95a72a4 *** empty log message ***
claus
parents: 46
diff changeset
   525
! !
450ce95a72a4 *** empty log message ***
claus
parents: 46
diff changeset
   526
3431
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   527
!EditTextView class methodsFor:'specs'!
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   528
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   529
searchReplaceDialogSpec
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   530
    "This resource specification was automatically generated
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   531
     by the UIPainter of ST/X."
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   532
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   533
    "Do not manually edit this!! If it is corrupted,
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   534
     the UIPainter may not be able to read the specification."
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   535
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   536
    "
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   537
     UIPainter new openOnClass:DAPASX::ProjectEditorTextView andSelector:#searchReplaceDialogSpec
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   538
    "
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   539
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   540
    <resource: #canvas>
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   541
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   542
    ^
3431
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   543
     #(FullSpec
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   544
	name: searchReplaceDialogSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   545
	window:
3431
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   546
       (WindowSpec
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   547
	  label: 'String Search and Replace'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   548
	  name: 'String Search and Replace'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   549
	  min: (Point 283 196)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   550
	  max: (Point 283 196)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   551
	  bounds: (Rectangle 0 0 279 192)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   552
	)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   553
	component:
3431
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   554
       (SpecCollection
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   555
	  collection: (
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   556
	   (LabelSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   557
	      label: 'Search Pattern:'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   558
	      name: 'label'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   559
	      layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   560
	      level: 0
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   561
	      translateLabel: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   562
	      adjust: left
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   563
	    )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   564
	   (ComboBoxSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   565
	      name: 'patternComboBox'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   566
	      layout: (LayoutFrame 3 0.0 26 0 -3 1.0 48 0)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   567
	      tabable: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   568
	      model: searchPattern
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   569
	      immediateAccept: false
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   570
	      acceptOnLeave: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   571
	      acceptOnReturn: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   572
	      acceptOnTab: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   573
	      acceptOnLostFocus: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   574
	      acceptOnPointerLeave: false
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   575
	      autoSelectInitialText: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   576
	      comboList: patternList
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   577
	    )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   578
	   (ComboBoxSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   579
	      name: 'replaceComboBox'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   580
	      layout: (LayoutFrame 3 0.0 76 0 -3 1.0 98 0)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   581
	      tabable: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   582
	      model: replacePattern
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   583
	      immediateAccept: false
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   584
	      acceptOnLeave: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   585
	      acceptOnReturn: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   586
	      acceptOnTab: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   587
	      acceptOnLostFocus: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   588
	      acceptOnPointerLeave: false
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   589
	      autoSelectInitialText: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   590
	      comboList: patternList
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   591
	    )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   592
	   (CheckBoxSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   593
	      label: 'Ignore Case'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   594
	      name: 'ignoreCaseCheckBox'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   595
	      layout: (LayoutFrame 3 0.0 107 0 -3 1.0 130 0)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   596
	      level: 0
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   597
	      tabable: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   598
	      model: ignoreCase
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   599
	      translateLabel: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   600
	    )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   601
	   (VariableVerticalPanelSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   602
	      name: 'VariableVerticalPanel1'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   603
	      layout: (LayoutFrame 0 0 -64 1 0 1 -4 1)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   604
	      component:
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   605
	     (SpecCollection
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   606
		collection: (
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   607
		 (HorizontalPanelViewSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   608
		    name: 'HorizontalPanel1'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   609
		    level: 0
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   610
		    horizontalLayout: fitSpace
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   611
		    verticalLayout: center
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   612
		    horizontalSpace: 3
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   613
		    verticalSpace: 3
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   614
		    ignoreInvisibleComponents: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   615
		    reverseOrderIfOKAtLeft: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   616
		    component:
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   617
		   (SpecCollection
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   618
		      collection: (
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   619
		       (ActionButtonSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   620
			  label: 'Replace'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   621
			  name: 'replaceButton'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   622
			  level: 2
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   623
			  translateLabel: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   624
			  tabable: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   625
			  model: replaceAction
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   626
			  extent: (Point 134 21)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   627
			)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   628
		       (ActionButtonSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   629
			  label: 'Replace All'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   630
			  name: 'replaceAllButton'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   631
			  level: 2
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   632
			  borderWidth: 1
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   633
			  translateLabel: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   634
			  tabable: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   635
			  model: replaceAllAction
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   636
			  extent: (Point 134 21)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   637
			)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   638
		       )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   639
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   640
		    )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   641
		  )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   642
		 (HorizontalPanelViewSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   643
		    name: 'horizontalPanelView'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   644
		    level: 0
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   645
		    horizontalLayout: fitSpace
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   646
		    verticalLayout: center
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   647
		    horizontalSpace: 3
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   648
		    verticalSpace: 3
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   649
		    ignoreInvisibleComponents: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   650
		    reverseOrderIfOKAtLeft: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   651
		    component:
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   652
		   (SpecCollection
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   653
		      collection: (
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   654
		       (ActionButtonSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   655
			  label: 'Cancel'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   656
			  name: 'cancelButton'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   657
			  level: 2
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   658
			  translateLabel: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   659
			  tabable: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   660
			  model: cancel
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   661
			  extent: (Point 88 21)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   662
			)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   663
		       (ActionButtonSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   664
			  label: 'Prev'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   665
			  name: 'prevButton'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   666
			  level: 2
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   667
			  translateLabel: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   668
			  tabable: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   669
			  model: prevAction
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   670
			  extent: (Point 89 21)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   671
			)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   672
		       (ActionButtonSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   673
			  label: 'Next'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   674
			  name: 'nextButton'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   675
			  level: 2
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   676
			  borderWidth: 1
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   677
			  translateLabel: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   678
			  tabable: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   679
			  model: nextAction
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   680
			  isDefault: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   681
			  extent: (Point 88 21)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   682
			)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   683
		       )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   684
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   685
		    )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   686
		  )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   687
		 )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   688
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   689
	      )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   690
	      handles: (Any 0.5 1.0)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   691
	    )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   692
	   (LabelSpec
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   693
	      label: 'Replace By:'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   694
	      name: 'ReplaceLabel'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   695
	      layout: (LayoutFrame 1 0.0 53 0 -1 1.0 70 0)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   696
	      level: 0
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   697
	      translateLabel: true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   698
	      adjust: left
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   699
	    )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   700
	   )
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   701
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   702
	)
3431
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   703
      )
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   704
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   705
    "Modified: / 11-10-2006 / 21:05:09 / cg"
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   706
! !
6bf93f206587 searchReplace spec
fm
parents: 3430
diff changeset
   707
2744
cb920467a4b4 method category rename
Claus Gittinger <cg@exept.de>
parents: 2730
diff changeset
   708
!EditTextView methodsFor:'Compatibility-ST80'!
1552
d3d4afaf4c68 dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents: 1548
diff changeset
   709
d3d4afaf4c68 dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents: 1548
diff changeset
   710
autoAccept:aBoolean
d3d4afaf4c68 dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents: 1548
diff changeset
   711
    "ignored for now"
d3d4afaf4c68 dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents: 1548
diff changeset
   712
2019
b6b078ea3bbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
   713
    "Created: / 5.6.1998 / 15:30:32 / cg "
1585
9bf6cf249376 two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents: 1580
diff changeset
   714
!
9bf6cf249376 two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents: 1580
diff changeset
   715
9bf6cf249376 two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents: 1580
diff changeset
   716
continuousAccept:aBoolean
9bf6cf249376 two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents: 1580
diff changeset
   717
    "ignored for now"
9bf6cf249376 two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents: 1580
diff changeset
   718
9bf6cf249376 two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents: 1580
diff changeset
   719
    "Created: / 19.6.1998 / 00:03:49 / cg"
9bf6cf249376 two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents: 1580
diff changeset
   720
!
9bf6cf249376 two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents: 1580
diff changeset
   721
1390
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   722
cutSelection
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   723
    self cut
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   724
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   725
    "Created: / 31.10.1997 / 03:29:50 / cg"
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   726
!
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   727
1590
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   728
deselect
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   729
    "remove the selection"
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   730
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   731
    ^ self unselect
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   732
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   733
    "Created: / 19.6.1998 / 02:41:54 / cg"
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   734
!
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   735
2101
8f2fab818f71 category renamining
Claus Gittinger <cg@exept.de>
parents: 2088
diff changeset
   736
enabled:aBoolean
8f2fab818f71 category renamining
Claus Gittinger <cg@exept.de>
parents: 2088
diff changeset
   737
8f2fab818f71 category renamining
Claus Gittinger <cg@exept.de>
parents: 2088
diff changeset
   738
    self readOnly:aBoolean not
8f2fab818f71 category renamining
Claus Gittinger <cg@exept.de>
parents: 2088
diff changeset
   739
8f2fab818f71 category renamining
Claus Gittinger <cg@exept.de>
parents: 2088
diff changeset
   740
    "Created: / 30.3.1999 / 15:10:23 / stefan"
8f2fab818f71 category renamining
Claus Gittinger <cg@exept.de>
parents: 2088
diff changeset
   741
    "Modified: / 30.3.1999 / 15:10:53 / stefan"
8f2fab818f71 category renamining
Claus Gittinger <cg@exept.de>
parents: 2088
diff changeset
   742
!
8f2fab818f71 category renamining
Claus Gittinger <cg@exept.de>
parents: 2088
diff changeset
   743
1732
2d433e114bbc added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1717
diff changeset
   744
find:pattern
2d433e114bbc added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1717
diff changeset
   745
    self searchFwd:pattern ifAbsent:nil
2d433e114bbc added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1717
diff changeset
   746
2d433e114bbc added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1717
diff changeset
   747
    "Created: / 29.1.1999 / 19:09:42 / cg"
2d433e114bbc added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1717
diff changeset
   748
    "Modified: / 29.1.1999 / 19:10:12 / cg"
2d433e114bbc added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1717
diff changeset
   749
!
2d433e114bbc added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1717
diff changeset
   750
1294
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   751
insert:aString at:aCharacterPosition
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   752
    "insert a string at aCharacterPosition."
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   753
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   754
    |line col|
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   755
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   756
    line := self lineOfCharacterPosition:aCharacterPosition.
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   757
    col := aCharacterPosition - (self characterPositionOfLine:line col:1) + 1.
1480
eabb1848e2fa fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   758
    col < 1 ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   759
	col := 1
1480
eabb1848e2fa fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   760
    ].
1294
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   761
    self insertString:aString atLine:line col:col.
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   762
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   763
    "
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   764
     |top v|
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   765
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   766
     top := StandardSystemView new.
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   767
     top extent:300@300.
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   768
     v := EditTextView origin:0.0@0.0 corner:1.0@1.0 in:top.
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   769
     top openAndWait.
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   770
     v contents:'1234567890\1234567890\1234567890\' withCRs.
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   771
     v insert:'<- hello there' at:5.
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   772
    "
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   773
1480
eabb1848e2fa fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
   774
    "Modified: / 5.4.1998 / 17:20:08 / cg"
1294
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   775
!
dac755d4acd3 added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
   776
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   777
insertAndSelect:aString at:aCharacterPosition
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   778
    "insert a selected string at aCharacterPosition."
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   779
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   780
    |line col|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   781
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   782
    line := self lineOfCharacterPosition:aCharacterPosition.
2310
861ab02b13b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2225
diff changeset
   783
    col := (aCharacterPosition - (self characterPositionOfLine:line col:1) + 1) max:1.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   784
    self insertString:aString atLine:line col:col.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   785
    self selectFromLine:line col:col toLine:line col:col + aString size - 1
125
claus
parents: 123
diff changeset
   786
    "
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   787
     |v|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   788
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   789
     v := EditTextView new openAndWait.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   790
     v contents:'1234567890\1234567890\1234567890\' withCRs.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   791
     v insertAndSelect:'<- hello there' at:5.
125
claus
parents: 123
diff changeset
   792
    "
1390
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   793
!
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   794
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   795
pasteSelection
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   796
    self paste
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   797
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
   798
    "Created: / 31.10.1997 / 03:28:53 / cg"
1590
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   799
!
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   800
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   801
replaceSelectionWith:aString
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   802
    ^ self replaceSelectionBy:aString
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   803
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   804
    "Created: / 19.6.1998 / 02:42:32 / cg"
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   805
!
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   806
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   807
selectAt:pos
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   808
    "move the cursor before cursorPosition."
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   809
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   810
    self cursorToCharacterPosition:pos
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   811
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   812
    "Modified: / 19.6.1998 / 02:41:28 / cg"
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   813
    "Created: / 19.6.1998 / 02:43:39 / cg"
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   814
!
b537d0d4e6d3 more ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1589
diff changeset
   815
2101
8f2fab818f71 category renamining
Claus Gittinger <cg@exept.de>
parents: 2088
diff changeset
   816
textHasChanged
8f2fab818f71 category renamining
Claus Gittinger <cg@exept.de>
parents: 2088
diff changeset
   817
    ^ self modified
8f2fab818f71 category renamining
Claus Gittinger <cg@exept.de>
parents: 2088
diff changeset
   818
8f2fab818f71 category renamining
Claus Gittinger <cg@exept.de>
parents: 2088
diff changeset
   819
    "Created: / 19.6.1998 / 00:09:43 / cg"
2117
b50c6d182e28 added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   820
!
b50c6d182e28 added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   821
b50c6d182e28 added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   822
textHasChanged:aBoolean
b50c6d182e28 added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   823
    "ST-80 compatibility: set/clear the modified flag."
b50c6d182e28 added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   824
b50c6d182e28 added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   825
    self modified:aBoolean
b50c6d182e28 added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   826
b50c6d182e28 added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
   827
    "Created: / 5.2.2000 / 17:07:59 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   828
! !
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   829
4585
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   830
!EditTextView methodsFor:'accessing'!
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   831
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   832
completionSupport
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   833
    ^ completionSupport
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   834
!
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   835
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   836
completionSupport:anEditTextViewCompletionSupport
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   837
    completionSupport := anEditTextViewCompletionSupport.
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   838
!
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   839
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   840
completionSupportClass
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   841
    ^ self class defaultCompletionSupportClass
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   842
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   843
    "Created: / 26-09-2013 / 17:54:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   844
!
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
   845
4609
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   846
editedClass
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   847
    |cm|
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   848
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   849
    cm := self editedMethodOrClass.
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   850
    cm isBehavior ifTrue:[^ cm].
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   851
    cm isMethod ifTrue:[^ cm mclass].
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   852
    ^ nil
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   853
!
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   854
4775
e34752e6214e Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4771
diff changeset
   855
editedLanguage
e34752e6214e Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4771
diff changeset
   856
    ^ nil
e34752e6214e Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4771
diff changeset
   857
e34752e6214e Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4771
diff changeset
   858
    "Created: / 18-09-2013 / 14:16:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e34752e6214e Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4771
diff changeset
   859
!
e34752e6214e Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4771
diff changeset
   860
4609
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   861
editedMethod
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   862
    |cm|
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   863
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   864
    cm := self editedMethodOrClass.
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   865
    cm isMethod ifTrue:[^ cm].
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   866
    cm isBehavior ifTrue:[^ nil].
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   867
    ^ nil
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   868
!
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   869
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   870
editedMethodOrClass
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   871
    ^ nil
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   872
!
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   873
4585
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   874
hasSelectionOrTextInCursorLine
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   875
    ^ (self selectionOrTextOfCursorLine:false) notNil
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   876
!
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   877
4589
f6da08d703f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4585
diff changeset
   878
selectionOrTextOfCursorLine
f6da08d703f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4585
diff changeset
   879
    ^ self selectionOrTextOfCursorLine:true
f6da08d703f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4585
diff changeset
   880
!
f6da08d703f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4585
diff changeset
   881
4585
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   882
selectionOrTextOfCursorLine:doSelect
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   883
    |sel lNr line|
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   884
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   885
    sel := self selectionAsString.
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   886
    sel notNil ifTrue:[^ sel].
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   887
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   888
    lNr := self cursorLine.
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   889
    line := self listAt:lNr.
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   890
    line notEmptyOrNil ifTrue:[
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   891
        doSelect ifTrue:[
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   892
            self selectLine:lNr.
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   893
        ].
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   894
        ^ line
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   895
    ].
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   896
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   897
    ^ nil
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   898
! !
7b31719bf07a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4580
diff changeset
   899
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   900
!EditTextView methodsFor:'accessing-behavior'!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   901
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   902
acceptAction
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   903
    "return the action to be performed on accept (or nil)"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   904
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   905
    ^ acceptAction
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   906
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   907
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   908
acceptAction:aBlock
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   909
    "set the action to be performed on accept"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   910
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   911
    acceptAction := aBlock
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   912
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
   913
2792
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   914
acceptChannel
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   915
    "return the valueHolder holding true if text was accepted.
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   916
     By placing a true into this channel, an accept can also be forced."
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   917
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   918
    ^ acceptChannel
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   919
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   920
    "Modified: / 30.1.1998 / 14:17:11 / cg"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   921
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   922
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   923
acceptChannel:aValueHolder
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   924
    "set the valueHolder holding true if text was accepted.
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   925
     By placing a true into this channel, an accept can also be forced."
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   926
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   927
    |prev|
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   928
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   929
    prev := acceptChannel.
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   930
    acceptChannel := aValueHolder.
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   931
    self setupChannel:aValueHolder for:nil withOld:prev
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   932
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   933
    "Created: / 30.1.1998 / 14:51:09 / cg"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   934
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   935
1108
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
   936
acceptEnabled:aBoolean
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
   937
    "enable/disable accept. This greys the corresponding item in the menu"
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
   938
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
   939
    acceptEnabled := aBoolean
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
   940
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
   941
    "Created: 7.3.1997 / 11:04:34 / cg"
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
   942
!
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
   943
2792
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   944
accepted
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   945
    "return true if text was accepted"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   946
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   947
    ^ acceptChannel value
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   948
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   949
    "Created: 14.2.1997 / 16:43:46 / cg"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   950
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   951
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   952
accepted:aBoolean
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   953
    "set/clear the accepted flag.
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   954
     This may force my current contents to be placed into my model."
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   955
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   956
    acceptChannel value:aBoolean.
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   957
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   958
    "Created: / 14.2.1997 / 16:44:01 / cg"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   959
    "Modified: / 30.1.1998 / 14:20:15 / cg"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   960
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
   961
474
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
   962
autoIndent:aBoolean
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
   963
    autoIndent := aBoolean
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
   964
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
   965
    "Created: 5.3.1996 / 14:37:50 / cg"
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
   966
!
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
   967
2774
0415ba0f8cb5 cursorMovement getter
penk
parents: 2762
diff changeset
   968
cursorMovementWhenUpdating
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   969
    "return what is be done with the cursor,
2774
0415ba0f8cb5 cursorMovement getter
penk
parents: 2762
diff changeset
   970
     when I get a new text (via the model or the #contents/#list)
0415ba0f8cb5 cursorMovement getter
penk
parents: 2762
diff changeset
   971
     Allowed arguments are:
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   972
	#keep / nil     -> stay where it was
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   973
	#endOfText      -> position cursor to the end
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   974
	#beginOfText    -> position cursor to the beginning
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   975
	#endOfLine      -> position cursor to the current lines end
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   976
	#beginOfLine    -> position cursor to the current lines start
2774
0415ba0f8cb5 cursorMovement getter
penk
parents: 2762
diff changeset
   977
     The default is #beginOfText.
0415ba0f8cb5 cursorMovement getter
penk
parents: 2762
diff changeset
   978
     This may be useful for fields which get new values assigned from
0415ba0f8cb5 cursorMovement getter
penk
parents: 2762
diff changeset
   979
     the program (i.e. not from the user)"
0415ba0f8cb5 cursorMovement getter
penk
parents: 2762
diff changeset
   980
0415ba0f8cb5 cursorMovement getter
penk
parents: 2762
diff changeset
   981
    ^ cursorMovementWhenUpdating
0415ba0f8cb5 cursorMovement getter
penk
parents: 2762
diff changeset
   982
0415ba0f8cb5 cursorMovement getter
penk
parents: 2762
diff changeset
   983
    "Modified: 16.12.1995 / 16:27:55 / cg"
0415ba0f8cb5 cursorMovement getter
penk
parents: 2762
diff changeset
   984
!
0415ba0f8cb5 cursorMovement getter
penk
parents: 2762
diff changeset
   985
2133
47a23fdfc83f comment
Claus Gittinger <cg@exept.de>
parents: 2131
diff changeset
   986
cursorMovementWhenUpdating:aSymbolOrNil
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   987
    "define what should be done with the cursor,
2133
47a23fdfc83f comment
Claus Gittinger <cg@exept.de>
parents: 2131
diff changeset
   988
     when I get a new text (via the model or the #contents/#list)
47a23fdfc83f comment
Claus Gittinger <cg@exept.de>
parents: 2131
diff changeset
   989
     Allowed arguments are:
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   990
	#keep / nil     -> stay where it was
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   991
	#endOfText      -> position cursor to the end
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   992
	#beginOfText    -> position cursor to the beginning
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   993
	#endOfLine      -> position cursor to the current lines end
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
   994
	#beginOfLine    -> position cursor to the current lines start
2133
47a23fdfc83f comment
Claus Gittinger <cg@exept.de>
parents: 2131
diff changeset
   995
     The default is #beginOfText.
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   996
     This may be useful for fields which get new values assigned from
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   997
     the program (i.e. not from the user)"
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   998
2133
47a23fdfc83f comment
Claus Gittinger <cg@exept.de>
parents: 2131
diff changeset
   999
    cursorMovementWhenUpdating := aSymbolOrNil
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1000
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1001
    "Modified: 16.12.1995 / 16:27:55 / cg"
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1002
!
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1003
2035
6924861adf08 added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents: 2029
diff changeset
  1004
disableIfInvisible:aBoolean
6924861adf08 added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents: 2029
diff changeset
  1005
    disableIfInvisible := aBoolean
6924861adf08 added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents: 2029
diff changeset
  1006
!
6924861adf08 added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents: 2029
diff changeset
  1007
2438
6406f4444ee4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1008
dontReplaceSelectionOnInput
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  1009
    "remember that the current selection was created by a paste operation
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  1010
     (as opposed to an explicit selection by the user).
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  1011
     This selection will not be replaced by followup user input,
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  1012
     so multiple pastes will be possible."
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  1013
2438
6406f4444ee4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1014
    typeOfSelection := #paste
6406f4444ee4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1015
!
6406f4444ee4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
  1016
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1017
editModeHolder
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1018
    ^ editMode.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1019
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1020
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1021
editModeInsert
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1022
    editMode value:EditMode insertMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1023
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1024
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1025
editModeInsertAndSelect
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1026
    editMode value:EditMode insertAndSelectMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1027
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1028
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1029
editModeOverwrite
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1030
    editMode value:EditMode overwriteMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1031
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1032
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1033
exceptionBlock:aBlock
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1034
    "define the action to be triggered when user tries to modify
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1035
     readonly text"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1036
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1037
    exceptionBlock := aBlock
323
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1038
!
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1039
3296
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1040
fixedSize
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1041
    "make the texts size fixed (no lines may be added).
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1042
     OBSOLETE: use readOnly"
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1043
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1044
    <resource:#obsolete>
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1045
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1046
    |menu|
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1047
3296
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1048
    self obsoleteMethodWarning:'use #readOnly:'.
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1049
    readOnly == true ifFalse:[
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1050
	readOnly := true.
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1051
	(menu := self middleButtonMenu) notNil ifTrue:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1052
	    menu disableAll:#(cut paste replace indent)
3296
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1053
	]
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1054
    ]
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1055
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1056
    "Modified: 14.2.1997 / 17:35:24 / cg"
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1057
!
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  1058
477
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  1059
insertMode:aBoolean
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1060
    editMode value:(aBoolean ifTrue:[EditMode insertMode] ifFalse:[EditMode overwriteMode])
477
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  1061
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  1062
    "Created: 6.3.1996 / 12:24:05 / cg"
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  1063
!
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  1064
2795
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1065
insertModeHolder
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1066
    ^ BlockValue
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1067
	with:[:m | m isInsertMode]
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1068
	argument:(editMode).
3465
a6eb20608b1f BlockValue usage cleanup
Claus Gittinger <cg@exept.de>
parents: 3439
diff changeset
  1069
a6eb20608b1f BlockValue usage cleanup
Claus Gittinger <cg@exept.de>
parents: 3439
diff changeset
  1070
    "Modified: / 08-03-2007 / 22:58:37 / cg"
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1071
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1072
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1073
isInInsertMode
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  1074
    ^ editMode value isInsertMode
2795
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1075
!
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  1076
2792
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1077
isReadOnly
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1078
    "return true, if the text is readonly."
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1079
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1080
    ^ readOnly value
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1081
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1082
    "Modified: 14.2.1997 / 17:35:56 / cg"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1083
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1084
2796
481d9e54434c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  1085
modeLabelHolder
481d9e54434c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  1086
    "a valueHolder, which contains 'L' (learnMode), I (insertMode) or empty"
481d9e54434c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  1087
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1088
    ^ BlockValue
4041
d3a015f9d5dd changed: #modeLabelHolder
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
  1089
        with:[:e :l |
d3a015f9d5dd changed: #modeLabelHolder
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
  1090
            self isReadOnly ifTrue:[
d3a015f9d5dd changed: #modeLabelHolder
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
  1091
                ''
d3a015f9d5dd changed: #modeLabelHolder
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
  1092
            ] ifFalse:[
d3a015f9d5dd changed: #modeLabelHolder
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
  1093
                l ifTrue:[ 'L' allBold colorizeAllWith:Color red]
d3a015f9d5dd changed: #modeLabelHolder
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
  1094
                  ifFalse:[ e infoPrintString]]]
d3a015f9d5dd changed: #modeLabelHolder
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
  1095
        argument:(self editModeHolder)
d3a015f9d5dd changed: #modeLabelHolder
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
  1096
        argument:(self learnModeHolder).
3465
a6eb20608b1f BlockValue usage cleanup
Claus Gittinger <cg@exept.de>
parents: 3439
diff changeset
  1097
a6eb20608b1f BlockValue usage cleanup
Claus Gittinger <cg@exept.de>
parents: 3439
diff changeset
  1098
    "Modified: / 08-03-2007 / 22:58:59 / cg"
2796
481d9e54434c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  1099
!
481d9e54434c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  1100
2792
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1101
modified
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1102
    "return true if text was modified"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1103
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1104
    ^ modifiedChannel value
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1105
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1106
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1107
modified:aBoolean
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1108
    "set/clear the modified flag"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1109
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1110
    modifiedChannel value:aBoolean
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1111
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1112
    "Modified: 14.2.1997 / 16:44:05 / cg"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1113
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1114
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1115
modifiedChannel
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1116
    "return the valueHolder holding true if text was modified"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1117
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1118
    ^ modifiedChannel
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1119
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1120
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1121
modifiedChannel:aValueHolder
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1122
    "set the valueHolder holding true if text was modified"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1123
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1124
    |prev|
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1125
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1126
    prev := modifiedChannel.
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1127
    modifiedChannel := aValueHolder.
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1128
    self setupChannel:aValueHolder for:nil withOld:prev
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1129
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1130
    "Created: / 30.1.1998 / 14:51:32 / cg"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1131
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1132
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1133
readOnly
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1134
    "make the text readonly.
4664
f09d5587253f class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4661
diff changeset
  1135
     Obsolete because it is obfuscating (looks like a getter)
f09d5587253f class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4661
diff changeset
  1136
     - use #readOnly:"
2792
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1137
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1138
    <resource:#obsolete>
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1139
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1140
    self obsoleteMethodWarning:'use #readOnly:'.
3705
a819d7204ee3 changed #readOnly
Stefan Vogel <sv@exept.de>
parents: 3683
diff changeset
  1141
    self readOnly:true.
2792
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1142
4664
f09d5587253f class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4661
diff changeset
  1143
    "Modified: / 14-02-1997 / 17:35:56 / cg"
f09d5587253f class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4661
diff changeset
  1144
    "Modified (comment): / 02-08-2013 / 16:46:57 / cg"
2792
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1145
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1146
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1147
readOnly:aBoolean
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1148
    "make the text readonly (aBoolean == true) or writable (aBoolean == false).
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1149
     The argument may also be a valueHolder."
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1150
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1151
    readOnly := aBoolean
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1152
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1153
    "Created: 14.2.1997 / 17:35:39 / cg"
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1154
!
508ab005b021 category changes
Claus Gittinger <cg@exept.de>
parents: 2784
diff changeset
  1155
4782
353079ce0c9d class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4781
diff changeset
  1156
reallyModifiedChannel
353079ce0c9d class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4781
diff changeset
  1157
    "return the valueHolder holding true if text was really modified.
353079ce0c9d class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4781
diff changeset
  1158
     For compatibility with views which use the modified flag for syntax highlighting."
353079ce0c9d class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4781
diff changeset
  1159
353079ce0c9d class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4781
diff changeset
  1160
    ^ self modifiedChannel
353079ce0c9d class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4781
diff changeset
  1161
!
353079ce0c9d class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4781
diff changeset
  1162
4192
0bc8b69bb610 added: #st80Mode:
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  1163
st80Mode:aBoolean
0bc8b69bb610 added: #st80Mode:
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  1164
    "set/clear the st80Mode flag.
0bc8b69bb610 added: #st80Mode:
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  1165
     If on, the cursor wraps at the line end (like in vi or st80);
0bc8b69bb610 added: #st80Mode:
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  1166
     if off, we have the Rand-editor behavior (random access)"
0bc8b69bb610 added: #st80Mode:
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  1167
0bc8b69bb610 added: #st80Mode:
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  1168
    st80Mode := aBoolean
0bc8b69bb610 added: #st80Mode:
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  1169
0bc8b69bb610 added: #st80Mode:
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  1170
    "Created: / 09-11-2010 / 13:55:50 / cg"
0bc8b69bb610 added: #st80Mode:
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  1171
!
0bc8b69bb610 added: #st80Mode:
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  1172
323
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1173
tabMeansNextField:aBoolean
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1174
    "set/clear tabbing to the next field.
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1175
     If true, Tab is ignored and shifts the keyboard focus.
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1176
     If false, tabs can be entered into the text.
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1177
     The default is true for editTextView, false for single-line
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1178
     input fields."
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1179
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1180
    tabMeansNextField := aBoolean
2779
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1181
!
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1182
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1183
tabRequiresControl
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1184
    "returns true, if a focus tabbing requires a control-key to be pressed.
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1185
     The default is true for editTextView, false for other widgets,
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1186
     to allow for easier text entry"
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1187
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1188
    ^ tabRequiresControl
2779
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1189
!
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1190
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1191
tabRequiresControl:aBoolean
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1192
    "controls if a focus tabbing requires a control-key to be pressed.
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1193
     The default is true for editTextView, false for other widgets,
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1194
     to allow for easier text entry"
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1195
5ca530482fdd unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  1196
    tabRequiresControl := aBoolean
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1197
! !
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1198
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1199
!EditTextView methodsFor:'accessing-contents'!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1200
1902
302a68c2255e added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1201
at:lineNr basicPut:aLine
302a68c2255e added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1202
    "change a line without change notification"
302a68c2255e added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1203
302a68c2255e added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1204
    (self at:lineNr) = aLine ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1205
	super at:lineNr put:aLine.
1902
302a68c2255e added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1206
    ].
302a68c2255e added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1207
!
302a68c2255e added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1208
522
aa9458e4643e indent/undent did not trigger a modify
ca
parents: 503
diff changeset
  1209
at:lineNr put:aLine
aa9458e4643e indent/undent did not trigger a modify
ca
parents: 503
diff changeset
  1210
    (self at:lineNr) = aLine ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1211
	super at:lineNr put:aLine.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1212
	self textChanged
522
aa9458e4643e indent/undent did not trigger a modify
ca
parents: 503
diff changeset
  1213
    ].
aa9458e4643e indent/undent did not trigger a modify
ca
parents: 503
diff changeset
  1214
!
aa9458e4643e indent/undent did not trigger a modify
ca
parents: 503
diff changeset
  1215
4700
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  1216
characterAfterCursor
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  1217
    "return the character one after the cursor - space if beyond line."
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  1218
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  1219
    ^ self characterAtLine:cursorLine col:cursorCol+1
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  1220
!
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  1221
1577
4e487247ad33 dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1222
characterBeforeCursor
4700
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  1223
    "return the character to the left of cursor - space if beyond line, nil if at the beginning."
1577
4e487247ad33 dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1224
4e487247ad33 dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1225
    cursorCol == 1 ifTrue:[^ nil].
4e487247ad33 dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1226
4e487247ad33 dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1227
    ^ self characterAtLine:cursorLine col:cursorCol-1
4e487247ad33 dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1228
4e487247ad33 dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1229
    "Created: / 17.6.1998 / 15:16:41 / cg"
4e487247ad33 dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1230
!
4e487247ad33 dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1231
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1232
characterUnderCursor
2707
810c994db0b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
  1233
    "return the character under the cursor - space if beyond line.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1234
     For non-block cursors, this is the character immediately to the right
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1235
     of the insertion-bar or caret."
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1236
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1237
    ^ self characterAtLine:cursorLine col:cursorCol
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1238
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1239
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1240
contents
2213
6068f2786bd6 added #contentsAsString
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1241
    "return the contents as a String or Text (i.e. with emphasis)"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1242
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1243
    list isNil ifTrue:[^ ''].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1244
    self removeTrailingBlankLines.
3707
8f6bc68b9319 changed #contents - formatting and comments
Stefan Vogel <sv@exept.de>
parents: 3705
diff changeset
  1245
    ^ super contents.
3313
6c2fd7c5a02f CRLF management
fm
parents: 3310
diff changeset
  1246
6c2fd7c5a02f CRLF management
fm
parents: 3310
diff changeset
  1247
    "Modified: / 04-07-2006 / 19:22:32 / fm"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1248
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1249
3249
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1250
contents:something
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1251
    self contents:something keepUndoHistory:false.
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1252
!
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1253
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1254
contents:something keepUndoHistory:keepUndoHistory
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1255
    super contents:something.
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1256
    keepUndoHistory ifFalse:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1257
	undoSupport resetHistories.
3249
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1258
    ].
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1259
!
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1260
2213
6068f2786bd6 added #contentsAsString
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1261
contentsAsString
6068f2786bd6 added #contentsAsString
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1262
    "return the contents as a String (i.e. without emphasis)"
6068f2786bd6 added #contentsAsString
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1263
6068f2786bd6 added #contentsAsString
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1264
    list isNil ifTrue:[^ ''].
6068f2786bd6 added #contentsAsString
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1265
    self removeTrailingBlankLines.
6068f2786bd6 added #contentsAsString
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1266
    ^ (list collect:[:each | each isNil ifTrue:['']
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1267
					ifFalse:[each string]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1268
		    ]) asStringWithCRs
2213
6068f2786bd6 added #contentsAsString
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1269
!
6068f2786bd6 added #contentsAsString
Claus Gittinger <cg@exept.de>
parents: 2210
diff changeset
  1270
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1271
cursorCol
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1272
    "return the cursors col (1..).
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1273
     This is the absolute col; NOT the visible col"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1274
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1275
    ^ cursorCol
125
claus
parents: 123
diff changeset
  1276
!
claus
parents: 123
diff changeset
  1277
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1278
cursorColHolder
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1279
    "return a valueHolder for the cursors column (1..)."
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1280
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1281
    ^ cursorColHolder
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1282
!
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1283
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1284
cursorLine
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1285
    "return the cursors line (1..).
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1286
     This is the absolute line; NOT the visible line"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1287
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1288
    ^ cursorLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1289
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1290
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1291
cursorLineHolder
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1292
    "return a valueHolder for the cursors line (1..).
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1293
     This is the absolute line; NOT the visible line"
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1294
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1295
    ^ cursorLineHolder
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1296
!
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1297
4713
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1298
lineStringBeforeCursor
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1299
    "return the line's string before the cursor.
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1300
     Pad with spaces up to the cursor position if beyond the end of line"
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1301
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1302
    |line|
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1303
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1304
    line := ((self at:cursorLine) ? '') string.
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1305
    line size < (cursorCol-1) ifTrue:[
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1306
        ^ line paddedTo:(cursorCol-1)
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1307
    ].
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1308
    ^ line copyTo:(cursorCol-1)
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1309
!
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  1310
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1311
list:something
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1312
    "position cursor home when setting contents"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1313
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1314
    |prevCursorLine prevCursorCol|
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1315
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1316
    prevCursorLine := cursorLine.
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1317
    prevCursorCol := cursorCol.
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1318
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1319
    super list:something.
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1320
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1321
    (cursorMovementWhenUpdating == #endOfText
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1322
    or:[cursorMovementWhenUpdating == #end]) ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1323
	^ self cursorToEndOfText
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1324
    ].
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1325
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1326
    (cursorMovementWhenUpdating == #endOfLine) ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1327
	^ self cursorLine:prevCursorLine col:(self listAt:cursorLine) size + 1.
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1328
    ].
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1329
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1330
    (cursorMovementWhenUpdating == #beginOfText
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1331
    or:[cursorMovementWhenUpdating == #begin]) ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1332
	^ self cursorHome
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1333
    ].
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1334
    (cursorMovementWhenUpdating == #beginOfLine) ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1335
	^ self cursorLine:prevCursorLine col:1.
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1336
    ].
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1337
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1338
    "/ default: stay where it was
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1339
    "/ self cursorLine:prevCursorLine col:prevCursorCol.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1340
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1341
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
  1342
setContents:something
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
  1343
    |selType|
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
  1344
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  1345
    undoSupport resetHistories.
2955
Claus Gittinger <cg@exept.de>
parents: 2954
diff changeset
  1346
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
  1347
    selType := typeOfSelection.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
  1348
    super setContents:something.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
  1349
    typeOfSelection := selType.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
  1350
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
  1351
    "Created: / 31.3.1998 / 23:35:06 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1352
! !
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1353
4609
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  1354
!EditTextView methodsFor:'accessing-dimensions'!
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  1355
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  1356
xOfCursor
4728
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1357
    |point|
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1358
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1359
    cursorVisibleLine isNil ifTrue:[
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1360
        "/ take the end of the selection, if any
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1361
        (selectionStartLine notNil 
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1362
            and:[ self listLineIsVisible:selectionEndLine ])
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1363
        ifTrue:[
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1364
            ^ self xOfCol:selectionEndCol inVisibleLine:selectionEndLine.
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1365
        ].
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1366
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1367
"/        point := device 
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1368
"/                    translatePoint:(device pointerPosition)
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1369
"/                    fromView:nil
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1370
"/                    toView:self.
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1371
"/        ((self bounds) containsPoint:point) ifTrue:[
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1372
"/            ^ point x
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1373
"/        ].
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1374
"/        ^ 0
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1375
        ^ nil
af70b9c1d04c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
  1376
    ].
4609
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  1377
    ^self xOfCol:cursorCol inVisibleLine:cursorVisibleLine.
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  1378
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  1379
    "Created: / 27-05-2005 / 07:43:41 / janfrog"
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  1380
! !
4590
e28172cd6041 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4589
diff changeset
  1381
474
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  1382
!EditTextView methodsFor:'accessing-look'!
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  1383
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  1384
cursorForegroundColor:color1 backgroundColor:color2
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  1385
    "set both cursor foreground and cursor background colors"
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  1386
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  1387
    |wasOn|
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  1388
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  1389
    wasOn := self hideCursor.
1993
5ffe0b3943cd #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1390
    cursorFgColor := color1 onDevice:device.
5ffe0b3943cd #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1391
    cursorBgColor := color2 onDevice:device.
474
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  1392
    wasOn ifTrue:[self showCursor]
1333
56af09878b96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  1393
!
56af09878b96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  1394
1899
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1395
cursorType
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1396
    "return the style of the text cursor.
4721
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  1397
     Currently, supported are: #none
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  1398
                               #block, #frame, #ibeam, #caret, #solidCaret
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  1399
                               #bigCaret and #bigSolidCaret"
1899
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1400
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1401
    ^ cursorType
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1402
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1403
    "Modified: / 5.5.1999 / 14:52:33 / cg"
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1404
!
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1405
1333
56af09878b96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  1406
cursorType:aCursorTypeSymbol
56af09878b96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  1407
    "set the style of the text cursor.
4721
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  1408
     Currently, supported are: #none
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  1409
                               #block, #frame, #ibeam, #caret, #solidCaret
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  1410
                               #bigCaret and #bigSolidCaret"
1333
56af09878b96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  1411
1334
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1412
    cursorType := aCursorTypeSymbol.
1333
56af09878b96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  1413
56af09878b96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  1414
    "Created: 21.9.1997 / 13:42:23 / cg"
56af09878b96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  1415
    "Modified: 21.9.1997 / 13:43:35 / cg"
1334
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1416
!
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1417
1899
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1418
cursorTypeNoFocus
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1419
    "return the style of the text cursor when the view has no focus.
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1420
     If left unspecified, this is the same as the regular cursorType."
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1421
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1422
    ^ cursorTypeNoFocus
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1423
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1424
    "Created: / 5.5.1999 / 14:52:46 / cg"
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1425
!
c98fc612bab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1426
1334
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1427
cursorTypeNoFocus:aCursorTypeSymbol
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1428
    "set the style of the text cursor when the view has no focus.
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1429
     If left unspecified, this is the same as the regular cursorType."
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1430
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1431
    cursorTypeNoFocus := aCursorTypeSymbol
474
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  1432
! !
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  1433
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  1434
!EditTextView methodsFor:'accessing-replace'!
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  1435
4746
39a5681e71ca class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
  1436
lastReplacementInfo
39a5681e71ca class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
  1437
    ^ lastReplacementInfo
39a5681e71ca class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
  1438
!
39a5681e71ca class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4742
diff changeset
  1439
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  1440
lastStringToReplace: aString
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  1441
! !
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  1442
2119
2aa585fc62a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2117
diff changeset
  1443
!EditTextView methodsFor:'change & update'!
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1444
125
claus
parents: 123
diff changeset
  1445
accept
claus
parents: 123
diff changeset
  1446
    "accept the current contents by executing the accept-action and/or
claus
parents: 123
diff changeset
  1447
     changeMessage."
claus
parents: 123
diff changeset
  1448
1108
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  1449
    acceptEnabled == false ifTrue:[
3945
295e4733f3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3915
diff changeset
  1450
        self beep.
295e4733f3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3915
diff changeset
  1451
        ^ self
2035
6924861adf08 added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents: 2029
diff changeset
  1452
    ].
6924861adf08 added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents: 2029
diff changeset
  1453
    (disableIfInvisible == true and:[self reallyRealized not]) ifTrue:[
3945
295e4733f3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3915
diff changeset
  1454
        ^ self
1108
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  1455
    ].
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  1456
125
claus
parents: 123
diff changeset
  1457
    lockUpdates := true.
1013
391290c747b3 added an acceptChannel
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1458
391290c747b3 added an acceptChannel
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1459
    "/
391290c747b3 added an acceptChannel
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1460
    "/ ST-80 way of doing it
391290c747b3 added an acceptChannel
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1461
    "/
391290c747b3 added an acceptChannel
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1462
    model notNil ifTrue:[
4142
6522aff88c82 changed: #accept
Claus Gittinger <cg@exept.de>
parents: 4138
diff changeset
  1463
        self sendChangeMessage:changeMsg with:self argForChangeMessage.
3945
295e4733f3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3915
diff changeset
  1464
        acceptChannel value:true withoutNotifying:self.
2999
40d3a383e8db *** empty log message ***
ca
parents: 2989
diff changeset
  1465
    ].
40d3a383e8db *** empty log message ***
ca
parents: 2989
diff changeset
  1466
757
2cc7e423f0ef only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents: 730
diff changeset
  1467
    "/
2cc7e423f0ef only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents: 730
diff changeset
  1468
    "/ ST/X way of doing things
2cc7e423f0ef only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents: 730
diff changeset
  1469
    "/ as a historic (and temporary) leftover,
2cc7e423f0ef only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents: 730
diff changeset
  1470
    "/ the block is called with a stringCollection
2cc7e423f0ef only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents: 730
diff changeset
  1471
    "/ - not with the actual string
2cc7e423f0ef only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents: 730
diff changeset
  1472
    "/
2cc7e423f0ef only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents: 730
diff changeset
  1473
    acceptAction notNil ifTrue:[
3945
295e4733f3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3915
diff changeset
  1474
        acceptAction value:self list
757
2cc7e423f0ef only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents: 730
diff changeset
  1475
    ].
2cc7e423f0ef only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents: 730
diff changeset
  1476
125
claus
parents: 123
diff changeset
  1477
    lockUpdates := false.
757
2cc7e423f0ef only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents: 730
diff changeset
  1478
1437
ab84b08a9f9c allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents: 1426
diff changeset
  1479
    "Modified: / 30.1.1998 / 14:19:00 / cg"
131
claus
parents: 130
diff changeset
  1480
!
claus
parents: 130
diff changeset
  1481
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1482
argForChangeMessage
597
fb42c94a042e commentary
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
  1483
    "return the argument to be passed with the change notification.
fb42c94a042e commentary
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
  1484
     Defined as separate method for easier subclassability."
fb42c94a042e commentary
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
  1485
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1486
    ^ self contents
597
fb42c94a042e commentary
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
  1487
fb42c94a042e commentary
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
  1488
    "Modified: 29.4.1996 / 12:42:14 / cg"
121
claus
parents: 118
diff changeset
  1489
!
claus
parents: 118
diff changeset
  1490
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1491
getListFromModel
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1492
    "get my contents from the model.
597
fb42c94a042e commentary
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
  1493
     Redefined to ignore updates resulting from my own changes
fb42c94a042e commentary
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
  1494
     (i.e. if lockUpdates is true)."
121
claus
parents: 118
diff changeset
  1495
claus
parents: 118
diff changeset
  1496
    "
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1497
     ignore updates from my own change
121
claus
parents: 118
diff changeset
  1498
    "
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1499
    lockUpdates ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1500
	lockUpdates := false.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1501
	^ self
121
claus
parents: 118
diff changeset
  1502
    ].
2196
f8c955dd6eb9 validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents: 2186
diff changeset
  1503
    super getListFromModel.
3249
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1504
    undoSupport resetHistories.
2196
f8c955dd6eb9 validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents: 2186
diff changeset
  1505
f8c955dd6eb9 validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents: 2186
diff changeset
  1506
    "/ validate the cursorLine
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1507
    (cursorLine notNil
2310
861ab02b13b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2225
diff changeset
  1508
     and:[ cursorLine > list size ]) ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1509
	self cursorLine:list size + 1 col:1
2196
f8c955dd6eb9 validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents: 2186
diff changeset
  1510
    ].
1437
ab84b08a9f9c allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents: 1426
diff changeset
  1511
!
ab84b08a9f9c allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents: 1426
diff changeset
  1512
ab84b08a9f9c allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents: 1426
diff changeset
  1513
update:something with:aParameter from:changedObject
1438
bed1564b0640 fixed update for acceptChannel
Claus Gittinger <cg@exept.de>
parents: 1437
diff changeset
  1514
    changedObject == acceptChannel ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1515
	acceptChannel value == true ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1516
	    self accept.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1517
	].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1518
	^ self.
1437
ab84b08a9f9c allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents: 1426
diff changeset
  1519
    ].
ab84b08a9f9c allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents: 1426
diff changeset
  1520
    super update:something with:aParameter from:changedObject
ab84b08a9f9c allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents: 1426
diff changeset
  1521
ab84b08a9f9c allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents: 1426
diff changeset
  1522
    "Created: / 30.1.1998 / 14:15:56 / cg"
1439
d1b3ca91ed8a fixed update for acceptChannel
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1523
    "Modified: / 1.2.1998 / 13:15:55 / cg"
121
claus
parents: 118
diff changeset
  1524
! !
claus
parents: 118
diff changeset
  1525
claus
parents: 118
diff changeset
  1526
!EditTextView methodsFor:'cursor handling'!
claus
parents: 118
diff changeset
  1527
2406
aeabb4ccf07c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2404
diff changeset
  1528
characterPositionOfCursor
aeabb4ccf07c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2404
diff changeset
  1529
    ^ self characterPositionOfLine:cursorLine col:cursorCol
aeabb4ccf07c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2404
diff changeset
  1530
!
aeabb4ccf07c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2404
diff changeset
  1531
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1532
cursorBacktab
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1533
    "move cursor to prev tabstop"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1534
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1535
    self cursorCol:(self prevTabBefore:cursorCol).
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1536
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1537
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1538
cursorCol:newCol
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1539
    "move cursor to some column in the current line"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1540
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1541
    |wasOn|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1542
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  1543
    (cursorCol == newCol) ifTrue:[^ self].
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  1544
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1545
    wasOn := self hideCursor.
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1546
    self setValidatedCursorCol:newCol.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1547
    self makeCursorVisibleAndShowCursor:wasOn.
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1548
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1549
    "Modified: 22.5.1996 / 14:25:53 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1550
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1551
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1552
cursorDown
632
5af2c22002e4 dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1553
    "move cursor down; scroll if at end of visible text;
5af2c22002e4 dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1554
     beep if at end of physical text."
5af2c22002e4 dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1555
5af2c22002e4 dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1556
    |wasOn|
5af2c22002e4 dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1557
5af2c22002e4 dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1558
    self cursorDown:1.
5af2c22002e4 dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1559
2707
810c994db0b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
  1560
    "/ cursor beyond text ?
632
5af2c22002e4 dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1561
    cursorLine > list size ifTrue:[
4595
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1562
        wasOn := self hideCursor.
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1563
        self setValidatedCursorLine:(list size + 1) col:cursorCol.
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1564
        self makeCursorVisibleAndShowCursor:wasOn.
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1565
        self beep.
632
5af2c22002e4 dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1566
    ].
5af2c22002e4 dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1567
1561
db5f27354172 make cursor correctly visible if in partial last line.
Claus Gittinger <cg@exept.de>
parents: 1560
diff changeset
  1568
    "Modified: / 10.6.1998 / 17:00:23 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1569
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1570
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1571
cursorDown:n
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1572
    "move cursor down by n lines; scroll if at end of visible text"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1573
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1574
    |wasOn nv nL|
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1575
4595
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1576
    (nL := cursorLine) isNil ifTrue:[
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1577
        nL := firstLineShown
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1578
    ].
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1579
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1580
    self st80EditMode ifTrue:[
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1581
        nL == list size ifTrue:[
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1582
            wasOn := self hideCursor.
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1583
            self setValidatedCursorLine:(list size) col:(self listAt:list size) size + 1.
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1584
            self makeCursorVisibleAndShowCursor:wasOn.
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1585
            self beep.
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1586
            ^ self.
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1587
        ]
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1588
    ].
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1589
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1590
    cursorVisibleLine notNil ifTrue:[
4595
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1591
        wasOn := self hideCursor.
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1592
        nv := cursorVisibleLine + n - 1.
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1593
        (nv >= nFullLinesShown) ifTrue:[
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1594
            self scrollDown:(nv - nFullLinesShown + 1)
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1595
        ].
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1596
        self setValidatedCursorLine:(cursorLine + n) col:cursorCol.
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1597
        self makeCursorVisibleAndShowCursor:wasOn.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1598
    ] ifFalse:[
4595
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1599
        self setValidatedCursorLine:(nL + n) col:cursorCol.
2f1e71ea50ac class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4592
diff changeset
  1600
        self makeCursorVisible.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1601
    ].
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  1602
1561
db5f27354172 make cursor correctly visible if in partial last line.
Claus Gittinger <cg@exept.de>
parents: 1560
diff changeset
  1603
    "Modified: / 10.6.1998 / 16:59:17 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1604
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1605
121
claus
parents: 118
diff changeset
  1606
cursorHome
597
fb42c94a042e commentary
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
  1607
    "scroll to top AND move cursor to first line of text."
121
claus
parents: 118
diff changeset
  1608
674
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1609
    self cursorLine:1 col:1
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1610
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1611
"/    |wasOn|
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1612
"/
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1613
"/    wasOn := self hideCursor.
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1614
"/    self scrollToTop.
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1615
"/    cursorLine := cursorVisibleLine := 1.
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1616
"/    cursorCol := self validateCursorCol:1 inLine:cursorLine.
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1617
"/    self makeCursorVisibleAndShowCursor:wasOn.
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1618
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1619
    "Modified: 22.5.1996 / 18:26:42 / cg"
121
claus
parents: 118
diff changeset
  1620
!
claus
parents: 118
diff changeset
  1621
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1622
cursorLeft
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1623
    "move cursor to left"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1624
1300
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1625
    (cursorCol ~~ 1) ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1626
	self cursorCol:(cursorCol - 1)
1300
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1627
    ] ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1628
	cursorLine ~~ 1 ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1629
	    self st80EditMode ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1630
		self cursorUp.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1631
		self cursorToEndOfLine.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1632
	   ]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1633
	]
1300
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1634
    ]
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1635
1426
de76570ba19e crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents: 1419
diff changeset
  1636
    "Modified: / 23.1.1998 / 12:37:13 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1637
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1638
4126
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1639
cursorLeft:n
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1640
    "move cursor to left"
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1641
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1642
    n timesRepeat:[
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1643
        self cursorLeft
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1644
    ].
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1645
!
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1646
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1647
cursorLine:line col:col
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1648
    "this positions onto physical - not visible - line"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1649
676
b65b82a1ffcb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  1650
    |wasOn newCol|
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1651
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  1652
    ((line == cursorLine) and:[col == cursorCol]) ifTrue:[^ self].
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  1653
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1654
    wasOn := self hideCursor.
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1655
    self setValidatedCursorLine:line.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1656
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1657
    (col < 1) ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1658
	newCol := 1
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1659
    ] ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1660
	newCol := col.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1661
    ].
2647
23dca8f032c3 changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
  1662
    self st80EditMode ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1663
	(cursorLine == list size
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1664
	and:[cursorLine ~~ line]) ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1665
	    newCol := (self listAt:(list size)) size + 1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1666
	]
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
  1667
    ].
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1668
    self setValidatedCursorCol:newCol.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1669
    self makeCursorVisibleAndShowCursor:wasOn.
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1670
1596
0bbdb4e9fc43 made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
  1671
    "Modified: / 20.6.1998 / 18:19:06 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1672
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1673
1580
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  1674
cursorMovementAllowed
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  1675
    "return true, if the user may move the cursor around
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  1676
     (via button-click, or cursor-key with selection).
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  1677
     By default, true is returned, but this may be redefined
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  1678
     in special subclasses (such as a terminal view), where
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  1679
     this is not wanted"
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  1680
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  1681
    ^ true
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  1682
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  1683
    "Created: / 18.6.1998 / 14:11:16 / cg"
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  1684
!
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  1685
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1686
cursorReturn
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1687
    "move cursor to start of next line; scroll if at end of visible text"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1688
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1689
    |wasOn|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1690
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1691
    self checkForExistingLine:(cursorLine + 1).
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1692
    cursorVisibleLine notNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1693
	nFullLinesShown notNil ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1694
	    (cursorVisibleLine >= nFullLinesShown) ifTrue:[self scrollDown]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1695
	]
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1696
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1697
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1698
    wasOn := self hideCursor.
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1699
    self setValidatedCursorLine:(cursorLine + 1) col:1.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1700
    self makeCursorVisibleAndShowCursor:wasOn.
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1701
674
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1702
    "Modified: 22.5.1996 / 18:27:34 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1703
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1704
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1705
cursorRight
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1706
    "move cursor to right"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1707
1300
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1708
    |l|
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1709
3023
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  1710
    self st80EditMode ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1711
	l := (self listAt:cursorLine).
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1712
	cursorCol >= (l size + 1) ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1713
	    cursorLine < list size ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1714
		self cursorReturn.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1715
	    ].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1716
	    ^ self
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1717
	]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1718
    ].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1719
    self cursorCol:(cursorCol + 1)
1300
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1720
1596
0bbdb4e9fc43 made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
  1721
    "Modified: / 20.6.1998 / 18:19:07 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1722
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1723
4126
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1724
cursorRight:n
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1725
    "move cursor to right"
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1726
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1727
    n timesRepeat:[
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1728
        self cursorRight
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1729
    ].
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1730
!
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  1731
1833
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1732
cursorShown:aBoolean
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1733
    "change cursor visibility
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1734
     return true if cursor was visible before."
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1735
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1736
    |oldState|
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1737
4494
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1738
    aBoolean == cursorShown ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1739
        ^ cursorShown
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1740
    ].
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1741
1833
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1742
    oldState := cursorShown.
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1743
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1744
    aBoolean ifTrue:[
4494
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1745
        self drawCursor.
1833
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1746
    ] ifFalse:[
4494
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1747
        (cursorShown and:[shown]) ifTrue: [
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1748
            self undrawCursor.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1749
        ].
1833
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1750
    ].
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1751
    cursorShown := aBoolean.
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1752
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1753
    ^ oldState
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1754
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1755
    "Modified: / 30.3.1999 / 15:32:43 / stefan"
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1756
    "Created: / 30.3.1999 / 15:59:30 / stefan"
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1757
!
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  1758
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1759
cursorTab
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1760
    "move cursor to next tabstop"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1761
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1762
    self cursorCol:(self nextTabAfter:cursorCol).
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1763
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1764
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1765
cursorToBeginOfLine
3020
68a2dfad4e5e CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents: 2999
diff changeset
  1766
    "move cursor to the start of the current line"
68a2dfad4e5e CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents: 2999
diff changeset
  1767
68a2dfad4e5e CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents: 2999
diff changeset
  1768
    |textStart l|
68a2dfad4e5e CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents: 2999
diff changeset
  1769
68a2dfad4e5e CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents: 2999
diff changeset
  1770
    l := self listAt:cursorLine.
68a2dfad4e5e CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents: 2999
diff changeset
  1771
    textStart := l isNil ifTrue:[1] ifFalse:[l indexOfNonSeparator].
68a2dfad4e5e CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents: 2999
diff changeset
  1772
    cursorCol > textStart ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1773
	self cursorCol:textStart
3020
68a2dfad4e5e CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents: 2999
diff changeset
  1774
    ] ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1775
	self cursorCol:1
3020
68a2dfad4e5e CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents: 2999
diff changeset
  1776
    ]
68a2dfad4e5e CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents: 2999
diff changeset
  1777
68a2dfad4e5e CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents: 2999
diff changeset
  1778
    "Created: / 8.8.2004 / 18:51:21 / janfrog"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1779
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1780
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1781
cursorToBeginOfSelection
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1782
    "Move cursor to the beginning of current selection. noop if 
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1783
     there's no selection."
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1784
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1785
    self hasSelection ifTrue:[
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1786
        self cursorLine: selectionStartLine col: selectionStartCol
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1787
    ]
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1788
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1789
    "Created: / 29-08-2013 / 23:16:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1790
!
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1791
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1792
cursorToBottom
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1793
    "move cursor to the last line of text (col 1)"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1794
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1795
    |wasOn newTop|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1796
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1797
    wasOn := self hideCursor.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1798
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1799
    newTop := list size - nFullLinesShown.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1800
    (newTop < 1) ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1801
	newTop := 1
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1802
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1803
    self scrollToLine:newTop.
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1804
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1805
    self setValidatedCursorLine:(list size) col:1.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1806
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1807
    self makeCursorVisibleAndShowCursor:wasOn.
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1808
674
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1809
    "Modified: 22.5.1996 / 18:27:45 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1810
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1811
1415
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1812
cursorToCharacterPosition:pos
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1813
    "compute line/col from character position (1..)
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1814
     and move the cursor onto that char"
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1815
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1816
    |line col|
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1817
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1818
    line := self lineOfCharacterPosition:pos.
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1819
    col := pos - (self characterPositionOfLine:line col:1) + 1.
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1820
    self cursorLine:line col:col
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1821
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1822
    "Created: / 15.1.1998 / 21:55:33 / cg"
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1823
!
f75eeebc0d1d added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1390
diff changeset
  1824
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1825
cursorToEnd
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1826
    "move cursor down below last line of text"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1827
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1828
    |wasOn newTop lineNr line|
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1829
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1830
    lineNr := list size.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1831
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1832
    cursorLine >= lineNr ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1833
	line := self listAt:cursorLine.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1834
	(line isEmptyOrNil) ifTrue:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1835
	    ^ self
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1836
	]
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1837
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1838
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1839
    wasOn := self hideCursor.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1840
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1841
    lineNr := lineNr + 1.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1842
    newTop :=  lineNr - nFullLinesShown.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1843
    (newTop < 1) ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1844
	newTop := 1
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1845
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1846
    self scrollToLine:newTop.
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1847
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1848
    self setValidatedCursorLine:lineNr col:1.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1849
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1850
    self makeCursorVisibleAndShowCursor:wasOn.
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1851
674
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  1852
    "Modified: 22.5.1996 / 18:27:53 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1853
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1854
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1855
cursorToEndOfLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1856
    "move cursor to end of current line"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1857
1300
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1858
    |line|
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1859
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1860
    line := (self listAt:cursorLine).
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1861
    self cursorCol:(line size + 1)
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1862
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  1863
    "Modified: 13.8.1997 / 15:34:02 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1864
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1865
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1866
cursorToEndOfSelection
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1867
    "Move cursor to the end of current selection. noop if 
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1868
     there's no selection."
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1869
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1870
    self hasSelection ifTrue:[
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1871
        self cursorLine: selectionEndLine col: selectionEndCol + 1
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1872
    ]
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1873
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1874
    "Created: / 29-08-2013 / 23:16:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1875
!
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  1876
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1877
cursorToEndOfText
4288
f68354357ecc changed: #cursorToEndOfText
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  1878
    "move cursor to the end of the text (behind the last character in last line)"
f68354357ecc changed: #cursorToEndOfText
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  1879
f68354357ecc changed: #cursorToEndOfText
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  1880
    |wasOn newTop lastLineLength pos|
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1881
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1882
    wasOn := self hideCursor.
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1883
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1884
    newTop := list size - nFullLinesShown.
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1885
    (newTop < 1) ifTrue:[
4288
f68354357ecc changed: #cursorToEndOfText
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  1886
        newTop := 1
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1887
    ].
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1888
    self scrollToLine:newTop.
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1889
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1890
    self setValidatedCursorLine:list size.
4288
f68354357ecc changed: #cursorToEndOfText
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  1891
    lastLineLength := (self listAt:cursorLine) size.
f68354357ecc changed: #cursorToEndOfText
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  1892
    pos := (lastLineLength==0) ifTrue:[0] ifFalse:[lastLineLength+1].
f68354357ecc changed: #cursorToEndOfText
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  1893
    self setCursorCol:(self validateCursorCol:pos inLine:cursorLine).
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1894
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1895
    self makeCursorVisibleAndShowCursor:wasOn.
4288
f68354357ecc changed: #cursorToEndOfText
Claus Gittinger <cg@exept.de>
parents: 4287
diff changeset
  1896
4289
d74f746d4c0d comment/format in: #cursorToEndOfText
Claus Gittinger <cg@exept.de>
parents: 4288
diff changeset
  1897
    "Modified: / 15-07-2011 / 20:14:43 / cg"
2129
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1898
!
989228af033d added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
  1899
3310
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  1900
cursorToEndOfWord
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  1901
    "move the cursor to the end of the word"
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  1902
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  1903
    (cursorLine > list size) ifTrue:[^ self].
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  1904
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  1905
    self wordAtLine:cursorLine col:cursorCol do:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1906
	:beginLine :beginCol :endLine :endCol :style |
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1907
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  1908
	self cursorLine:endLine col:endCol+1
3310
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  1909
    ]
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  1910
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  1911
    "Created: / 28-06-2006 / 19:16:30 / cg"
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  1912
!
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  1913
131
claus
parents: 130
diff changeset
  1914
cursorToFirstVisibleLine
claus
parents: 130
diff changeset
  1915
    "place cursor into the first visible line; do not scroll."
claus
parents: 130
diff changeset
  1916
claus
parents: 130
diff changeset
  1917
    self cursorLine:(self visibleLineToAbsoluteLine:1) col:1
claus
parents: 130
diff changeset
  1918
!
claus
parents: 130
diff changeset
  1919
claus
parents: 130
diff changeset
  1920
cursorToLastVisibleLine
claus
parents: 130
diff changeset
  1921
    "place cursor into the first visible line; do not scroll."
claus
parents: 130
diff changeset
  1922
claus
parents: 130
diff changeset
  1923
    self cursorLine:(self visibleLineToAbsoluteLine:nFullLinesShown) col:1
claus
parents: 130
diff changeset
  1924
!
claus
parents: 130
diff changeset
  1925
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1926
cursorToNextWord
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1927
    "move the cursor to the beginning of the next word"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1928
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1929
    |col line searching|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1930
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  1931
    (cursorLine > list size) ifTrue:[^ self].
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1932
3890
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1933
    self 
4707
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  1934
        wordAtLine:cursorLine col:cursorCol 
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  1935
        do:[
3890
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1936
            :beginLine :beginCol :endLine :endCol :style |
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1937
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1938
            line := endLine.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1939
            col := endCol + 1.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1940
            searching := true.
4707
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  1941
            [searching and:[(self characterAtLine:line col:col) isSeparator]] whileTrue:[
3890
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1942
                self wordAtLine:line col:col do:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1943
                    :beginLine :beginCol :endLine :endCol :style |
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1944
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1945
                    (line > list size) ifTrue:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1946
                        "break out"
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1947
                        searching := false
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1948
                    ] ifFalse:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1949
                        line := endLine.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1950
                        col := endCol + 1.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1951
                    ]
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1952
                ]
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1953
            ].
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  1954
            self cursorLine:line col:col
4707
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  1955
    ]
121
claus
parents: 118
diff changeset
  1956
!
claus
parents: 118
diff changeset
  1957
499
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  1958
cursorToPreviousWord
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  1959
    "move the cursor to the beginning of this or the previous word"
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  1960
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  1961
    |col line searching l|
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  1962
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  1963
    (cursorLine > list size) ifTrue:[^ self].      "/ this is rubbish
499
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  1964
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  1965
    self wordAtLine:cursorLine col:cursorCol do:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1966
	:beginLine :beginCol :endLine :endCol :style |
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1967
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1968
	line := beginLine.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1969
	col := beginCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1970
	style == #wordLeft ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1971
	    col := col + 1
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1972
	].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1973
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1974
	(cursorLine == line
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1975
	and:[cursorCol == col]) ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1976
	    searching := true.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1977
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1978
	    col > 1 ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1979
		col := col - 1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1980
	    ].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1981
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1982
	    [searching] whileTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1983
		(col == 1) ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1984
		    line == 1 ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1985
			searching := false
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1986
		    ] ifFalse:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1987
			line := line - 1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1988
			l := list at:line.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1989
			col := l size + 1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1990
		    ]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1991
		] ifFalse:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1992
		    (self characterAtLine:line col:col) isSeparator ifFalse:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1993
			self wordAtLine:line col:col do:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1994
			    :beginLine :beginCol :endLine :endCol :style |
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1995
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1996
			    line := beginLine.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1997
			    col := beginCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1998
			    style == #wordLeft ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  1999
				col := col + 1
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2000
			    ].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2001
			    searching := false.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2002
			]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2003
		    ] ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2004
			col := col - 1
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2005
		    ]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2006
		]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2007
	    ]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2008
	].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2009
	self cursorLine:line col:col
499
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  2010
    ]
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  2011
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  2012
    "Created: 8.3.1996 / 21:52:48 / cg"
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  2013
    "Modified: 8.3.1996 / 22:12:45 / cg"
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  2014
!
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  2015
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2016
cursorToTop
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2017
    "move cursor to absolute home"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2018
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2019
    self cursorLine:1 col:1
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2020
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2021
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2022
cursorUp
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2023
    "move cursor up; scroll if at start of visible text"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2024
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2025
    self cursorUp:1
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2026
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2027
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2028
cursorUp:n
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2029
    "move cursor up n lines; scroll if at start of visible text"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2030
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2031
    |wasOn nv nl|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2032
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2033
    cursorLine isNil ifTrue:[
3725
410e861ca010 also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents: 3707
diff changeset
  2034
        self setCursorLine:(firstLineShown + nFullLinesShown - 1).
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2035
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2036
    nl := cursorLine - n.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2037
    nl < 1 ifTrue:[nl := 1].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2038
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2039
    (nl ~~ cursorLine) ifTrue: [
3725
410e861ca010 also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents: 3707
diff changeset
  2040
        wasOn := self hideCursor.
410e861ca010 also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents: 3707
diff changeset
  2041
        cursorVisibleLine notNil ifTrue:[
410e861ca010 also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents: 3707
diff changeset
  2042
            nv := cursorVisibleLine - n.
410e861ca010 also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents: 3707
diff changeset
  2043
            nv < 1 ifTrue:[
410e861ca010 also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents: 3707
diff changeset
  2044
                self scrollUp:(nv negated + 1)
410e861ca010 also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents: 3707
diff changeset
  2045
            ].
410e861ca010 also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents: 3707
diff changeset
  2046
        ].
410e861ca010 also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents: 3707
diff changeset
  2047
        self setValidatedCursorLine:nl col:cursorCol.
410e861ca010 also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents: 3707
diff changeset
  2048
"/        wasOn ifTrue:[self showCursor].
410e861ca010 also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents: 3707
diff changeset
  2049
        self makeCursorVisibleAndShowCursor:wasOn.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2050
    ]
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2051
674
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2052
    "Modified: 22.5.1996 / 18:28:11 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2053
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2054
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2055
cursorVisibleLine:visibleLineNr col:colNr
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2056
    "put cursor to visibleline/col"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2057
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2058
    |wasOn newCol listLine|
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2059
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2060
    wasOn := self hideCursor.
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2061
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2062
    listLine := self visibleLineToAbsoluteLine:visibleLineNr.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2063
    self setValidatedCursorLine:listLine.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2064
    cursorVisibleLine := visibleLineNr.
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2065
676
b65b82a1ffcb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2066
    newCol := colNr.
b65b82a1ffcb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2067
    (newCol < 1) ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2068
	newCol := 1
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2069
    ].
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2070
    self setValidatedCursorCol:newCol.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2071
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2072
    self makeCursorVisibleAndShowCursor:wasOn.
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2073
1597
5fdcfcedb91c fixed cursor positioning after replaceStringAtCursor.
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  2074
    "Modified: / 20.6.1998 / 18:40:28 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2075
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2076
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2077
cursorX:x y:y
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2078
    "put cursor to position next to x/y coordinate in view"
121
claus
parents: 118
diff changeset
  2079
claus
parents: 118
diff changeset
  2080
    |line col|
claus
parents: 118
diff changeset
  2081
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2082
    line := self visibleLineOfY:y.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2083
    col := self colOfX:x inVisibleLine:line.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2084
    self cursorVisibleLine:line col:col.
121
claus
parents: 118
diff changeset
  2085
!
claus
parents: 118
diff changeset
  2086
claus
parents: 118
diff changeset
  2087
drawCursor
claus
parents: 118
diff changeset
  2088
    "draw the cursor if shown and cursor is visible.
claus
parents: 118
diff changeset
  2089
     (but not, if there is a selection - to avoid confusion)"
claus
parents: 118
diff changeset
  2090
claus
parents: 118
diff changeset
  2091
    shown ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2092
	cursorVisibleLine notNil ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2093
	    self hasSelection ifFalse:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2094
		self drawCursorCharacter
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2095
	    ]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2096
	]
121
claus
parents: 118
diff changeset
  2097
    ]
claus
parents: 118
diff changeset
  2098
!
claus
parents: 118
diff changeset
  2099
claus
parents: 118
diff changeset
  2100
drawCursor:cursorType with:fgColor and:bgColor
claus
parents: 118
diff changeset
  2101
    "draw a cursor; the argument cursorType specifies what type
125
claus
parents: 123
diff changeset
  2102
     of cursor should be drawn.
4721
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  2103
     Currently, supported are: #none, 
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  2104
                               #block, #frame, #ibeam, #caret, #solidCaret
4580
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2105
                               #bigCaret and #bigSolidCaret"
2085
4498b1a50d72 fixed undrawCursor, when there is italic text
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  2106
2570
590956e81610 Remove unused method vars.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2107
    |x y w char y2 x1 x2 oldPaint oldClip|
121
claus
parents: 118
diff changeset
  2108
claus
parents: 118
diff changeset
  2109
    self hasSelection ifTrue:[
4580
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2110
        "
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2111
         hide cursor, if there is a selection
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2112
        "
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2113
        ^ super redrawVisibleLine:cursorVisibleLine col:cursorCol.
121
claus
parents: 118
diff changeset
  2114
    ].
claus
parents: 118
diff changeset
  2115
1334
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2116
    cursorType == #none ifTrue:[
4580
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2117
        ^ self
1334
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2118
    ].
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2119
121
claus
parents: 118
diff changeset
  2120
    cursorType == #block ifTrue:[
4580
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2121
        super drawVisibleLine:cursorVisibleLine
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2122
                          col:cursorCol
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2123
                         with:fgColor
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2124
                          and:bgColor.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2125
        ^ self
121
claus
parents: 118
diff changeset
  2126
    ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  2127
    x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x.
121
claus
parents: 118
diff changeset
  2128
    y := self yOfVisibleLine:cursorVisibleLine.
claus
parents: 118
diff changeset
  2129
1449
2a54bdfff203 eliminated direct refs to paint instvar
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
  2130
    oldPaint := self paint. "/ do not clobber GC
121
claus
parents: 118
diff changeset
  2131
    cursorType == #frame ifTrue:[
4580
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2132
        super redrawVisibleLine:cursorVisibleLine col:cursorCol.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2133
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2134
        char := self characterUnderCursor asString.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2135
        self paint:bgColor.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2136
        self displayRectangleX:x y:y
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2137
                         width:(font widthOf:char) height:fontHeight.
133
claus
parents: 132
diff changeset
  2138
    ] ifFalse:[
4580
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2139
        self paint:bgColor.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2140
        cursorType == #ibeam ifTrue:[
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2141
            x1 := x - 1.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2142
            y2 := y + fontHeight - lineSpacing.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2143
            self displayLineFromX:x1 y:y toX:x1 y:y2.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2144
            self displayLineFromX:x y:y toX:x y:y2.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2145
            ^ self
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2146
        ].
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2147
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2148
        cursorType == #Ibeam ifTrue:[
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2149
            x1 := x - 1.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2150
            y := y + 1.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2151
            y2 := y + fontHeight - lineSpacing.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2152
            self displayLineFromX:x1 y:y toX:x1 y:y2.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2153
            self displayLineFromX:x y:y toX:x y:y2.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2154
            self displayLineFromX:x1-2 y:y toX:x+2 y:y.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2155
            self displayLineFromX:x1-2 y:y2 toX:x+2 y:y2.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2156
            ^ self
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2157
        ].
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2158
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2159
        y := y + fontHeight - 3.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2160
        ((cursorType == #bigCaret) or:[cursorType == #bigSolidCaret]) ifTrue:[
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2161
            w := (fontWidth * 2 // 3) max:4.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2162
            y2 := y + w + (w//2).
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2163
        ] ifFalse:[
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2164
            w := (fontWidth // 2) max:4.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2165
            y2 := y + w.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2166
        ].
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2167
        x1 := x - w.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2168
        x2 := x + w.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2169
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2170
        oldClip := self clippingRectangleOrNil.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2171
        self clippingRectangle:(margin@margin extent:(width-margin) @ (height-margin)).
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2172
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2173
        cursorType == #caret ifTrue:[
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2174
            self lineWidth:2.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2175
            self displayLineFromX:x1 y:y2 toX:x y:y.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2176
            self displayLineFromX:x y:y toX:x2 y:y2.
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2177
        ] ifFalse:[
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2178
            "anything else: solidCaret"
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2179
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2180
            self fillPolygon:(Array with:(x1 @ y2)
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2181
                                    with:(x @ y)
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2182
                                    with:(x2 @ y2))
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2183
        ].
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2184
d888cfb6a97c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4576
diff changeset
  2185
        self clippingRectangle:oldClip
121
claus
parents: 118
diff changeset
  2186
    ].
133
claus
parents: 132
diff changeset
  2187
    self paint:oldPaint.
662
4bcdf0cce3a7 dont let caret cursor become too small (with small fonts)
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  2188
2088
b2beb67b1a98 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  2189
    "Modified: / 15.12.1999 / 22:24:17 / cg"
121
claus
parents: 118
diff changeset
  2190
!
claus
parents: 118
diff changeset
  2191
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2192
drawCursorCharacter
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2193
    "draw the cursor.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2194
     (i.e. the cursor if no selection)
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2195
     - helper for many cursor methods"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2196
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2197
    (hasKeyboardFocus
3296
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  2198
     and:[self enabled
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  2199
     and:[self isReadOnly not]]) ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  2200
	self drawFocusCursor
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2201
    ] ifFalse:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  2202
	self drawNoFocusCursor
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2203
    ]
1817
1a9e22f755c8 show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
  2204
1a9e22f755c8 show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
  2205
    "Modified: / 23.3.1999 / 13:52:48 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2206
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2207
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2208
drawFocusCursor
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2209
    "draw the cursor when the focus is in the view."
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2210
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2211
    self hasSelection ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2212
	^ super redrawVisibleLine:cursorVisibleLine col:cursorCol.
1334
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2213
    ].
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2214
    cursorType == #none ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2215
	^ self undrawCursor
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2216
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2217
    self drawCursor:cursorType with:cursorFgColor and:cursorBgColor.
1334
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2218
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2219
    "Modified: 22.9.1997 / 00:16:38 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2220
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2221
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2222
drawNoFocusCursor
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2223
    "draw the cursor for the case when the view has no keyboard focus"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2224
1334
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2225
    |cType|
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2226
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2227
    self hasSelection ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2228
	^ super redrawVisibleLine:cursorVisibleLine col:cursorCol.
121
claus
parents: 118
diff changeset
  2229
    ].
1022
4362861fe15e allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  2230
1334
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2231
    cType := cursorTypeNoFocus ? cursorType.
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2232
    cType == #none ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2233
	^ self undrawCursor
1334
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2234
    ].
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2235
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2236
    cType == #block ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2237
	^ self drawCursor:#frame with:cursorNoFocusFgColor and:cursorBgColor
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2238
    ].
1022
4362861fe15e allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  2239
1334
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2240
    ^ self drawCursor:cType with:cursorNoFocusFgColor and:cursorNoFocusFgColor.
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2241
84e43257565b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2242
    "Modified: 22.9.1997 / 00:16:13 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2243
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2244
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2245
gotoLine:aLineNumber
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2246
    "position cursor onto line, aLineNumber.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2247
     Make certain that this line is visible"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2248
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2249
    self makeLineVisible:aLineNumber.
2951
eb820ef25acf unselect before gotoLine
Claus Gittinger <cg@exept.de>
parents: 2950
diff changeset
  2250
    self unselect.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2251
    self cursorLine:aLineNumber col:1
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2252
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2253
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2254
hideCursor
1833
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  2255
    "make cursor invisible if currently invisible"
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  2256
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  2257
    ^ self cursorShown:false
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  2258
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  2259
    "Modified: / 30.3.1999 / 16:02:28 / stefan"
121
claus
parents: 118
diff changeset
  2260
!
claus
parents: 118
diff changeset
  2261
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2262
makeCursorVisible
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2263
    "scroll text to make cursorline visible
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2264
     (i.e. to have cursorLine in visible area)"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2265
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2266
    |line col|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2267
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2268
    cursorLine notNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2269
	line := cursorLine.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2270
	col := cursorCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2271
	"
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2272
	 if there is a selection, its better to
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2273
	 have its start being visible, instead of the end
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2274
	"
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2275
	(selectionStartLine notNil
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2276
	and:[selectionEndLine notNil]) ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2277
	    expandingTop ~~ false ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2278
		line := selectionStartLine.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2279
		col := selectionStartCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2280
	    ] ifFalse:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2281
		line := selectionEndLine.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2282
		col := selectionEndCol
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2283
	    ]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2284
	].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2285
	self makeLineVisible:line.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2286
	self makeColVisible:col inLine:line
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2287
    ]
479
fae6d1251888 fixed Shift-Cursor selection & show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 477
diff changeset
  2288
fae6d1251888 fixed Shift-Cursor selection & show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 477
diff changeset
  2289
    "Modified: 6.3.1996 / 13:46:46 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2290
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2291
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2292
makeCursorVisibleAndShowCursor:flag
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2293
    "scroll to make cursorLine visible;
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2294
     if flag is true, draw the cursor"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2295
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2296
    self makeCursorVisible.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2297
    flag ifTrue:[self showCursor]
121
claus
parents: 118
diff changeset
  2298
!
claus
parents: 118
diff changeset
  2299
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2300
setCursorCol:colNr
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2301
    "strictly private: set the cursorCol"
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2302
2815
d71f43d7de3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2796
diff changeset
  2303
    cursorCol := (colNr max:1).
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2304
    cursorColHolder value:cursorCol.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2305
!
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2306
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2307
setCursorLine:lineNr
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2308
    "strictly private: set the cursorLine"
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2309
3303
add21df4dcb1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3296
diff changeset
  2310
    "/ self assert:(lineNr notNil).
add21df4dcb1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3296
diff changeset
  2311
add21df4dcb1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3296
diff changeset
  2312
    cursorLine := (lineNr ? 1).
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2313
    cursorLineHolder value:cursorLine.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2314
    self updateCursorVisibleLine.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2315
!
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2316
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2317
setCursorLine:lineNr col:colNr
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2318
    "strictly private: set the cursorLine, col and update the visibleLine"
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2319
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2320
    self setCursorLine:lineNr.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2321
    self setCursorCol:colNr.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2322
!
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2323
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2324
setValidatedCursorCol:colNr
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2325
    "strictly private: set the cursorCol"
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2326
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2327
    self setCursorCol:(self validateCursorCol:colNr inLine:cursorLine).
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2328
!
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2329
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2330
setValidatedCursorLine:lineNr
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2331
    "strictly private: set the cursorLine and update the visibleLine"
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2332
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2333
    self setCursorLine:(self validateCursorLine:lineNr).
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2334
!
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2335
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2336
setValidatedCursorLine:lineNr col:colNr
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2337
    "strictly private: set the cursorLine, col and update the visibleLine"
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2338
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2339
    self setValidatedCursorLine:lineNr.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2340
    self setValidatedCursorCol:colNr.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2341
!
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2342
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2343
showCursor
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2344
    "make cursor visible if currently invisible"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2345
1833
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  2346
    ^ self cursorShown:true
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  2347
542d79f7ed5c Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1825
diff changeset
  2348
    "Modified: / 30.3.1999 / 16:02:34 / stefan"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2349
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2350
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2351
undrawCursor
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2352
    "undraw the cursor (i.e. redraw the character(s) under the cursor)"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2353
2085
4498b1a50d72 fixed undrawCursor, when there is italic text
Claus Gittinger <cg@exept.de>
parents: 2072
diff changeset
  2354
    |prevCol line oldClip x y e1 e2 e3|
1022
4362861fe15e allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  2355
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2356
    cursorVisibleLine notNil ifTrue:[
4494
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2357
        prevCol := cursorCol - 1.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2358
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2359
        "/ if there is any italic stuff in the cursor line,
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2360
        "/ redraw it completely (because characters overlap).
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2361
        cursorCol > 1 ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2362
            (line := self listAt:cursorLine) notNil ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2363
                line hasChangeOfEmphasis ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2364
                    line size >= (cursorCol-1) ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2365
                        e1 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol-1).
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2366
                        line size >= (cursorCol) ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2367
                            e2 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol).
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2368
                            line size >= (cursorCol+1) ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2369
                                e3 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol+1)
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2370
                            ].
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2371
                        ].
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2372
                    ].
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2373
                    (e1 notNil or:[e2 notNil or:[e3 notNil]]) ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2374
                        ^ super redrawVisibleLine:cursorVisibleLine
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2375
                    ]
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2376
                ]
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2377
            ]
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2378
        ].
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2379
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2380
        ((cursorType == #caret)
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2381
         or:[cursorType == #solidCaret
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2382
         or:[cursorType == #bigSolidCaret
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2383
         or:[cursorType == #bigCaret
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2384
         or:[cursorType == #Ibeam]]]]) ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2385
            "caret-cursor touches 4 characters"
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2386
            ((cursorCol > 1) and:[fontIsFixedWidth]) ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2387
                super redrawVisibleLine:cursorVisibleLine-1 from:prevCol to:cursorCol.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2388
                super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2389
                super redrawVisibleLine:cursorVisibleLine+1 from:prevCol to:cursorCol.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2390
            ] ifFalse:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2391
                "care for left margin"
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2392
                super redrawVisibleLine:cursorVisibleLine; redrawVisibleLine:cursorVisibleLine+1.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2393
            ].
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2394
            ^ self
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2395
        ].
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2396
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2397
        cursorType == #ibeam ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2398
            "ibeam-cursor touches 2 characters"
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2399
            cursorCol > 1 ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2400
                super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2401
            ] ifFalse:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2402
                "care for left margin"
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2403
                super redrawVisibleLine:cursorVisibleLine.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2404
            ].
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2405
            ^ self
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2406
        ].
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2407
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2408
        "block cursor is simple - just one character under cursor"
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2409
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2410
        "/ however, if italic characters are involved, we must care
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2411
        "/ for the chars before/after the cursor.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2412
        "/ We redraw the part of the previous character which got
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2413
        "/ detroyed by the block cursor.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2414
        "/ (must change the clip, to avoid destroying the prev-prev character)
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2415
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2416
        line := self visibleAt:cursorVisibleLine.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2417
        (line notNil and:[line isText]) ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2418
            cursorCol > 1 ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2419
                oldClip := self clippingRectangleOrNil.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2420
                x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2421
                y := self yOfVisibleLine:cursorVisibleLine.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2422
                self clippingRectangle:(x@y extent:((font width * 2) @ fontHeight)).
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2423
                super redrawVisibleLine:cursorVisibleLine from:cursorCol-1 to:cursorCol.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2424
                self clippingRectangle:oldClip.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2425
                ^ self.
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2426
            ].
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2427
        ].
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  2428
        super redrawVisibleLine:cursorVisibleLine col:cursorCol
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2429
    ]
728
3ef81000ee8c new cursorTypes: #bigCaret and #bigSolidCaret
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  2430
2088
b2beb67b1a98 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  2431
    "Modified: / 15.12.1999 / 22:25:59 / cg"
121
claus
parents: 118
diff changeset
  2432
!
claus
parents: 118
diff changeset
  2433
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2434
updateCursorVisibleLine
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2435
    "strictly private: set the visibleLine from the cursorLine.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2436
     notice: visibleLine will be set to nil if the cursor is not visible"
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2437
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2438
    cursorVisibleLine := self listLineToVisibleLine:cursorLine.
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2439
!
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  2440
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2441
validateCursorCol:col inLine:line
674
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2442
    "check of col is a valid cursor position; return a new col-nr if not.
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2443
     Here, no limits are enforced (and col is returned),
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2444
     but it may be redefined in EditFields or views which dont like the
674
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2445
     cursor to be positioned behind the end of a textLine (vi/st-80 behavior)"
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2446
1300
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  2447
    |l max|
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  2448
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
  2449
    "/ in ST80 mode,
2707
810c994db0b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
  2450
    "/ the cursor may not be positioned beyond the
810c994db0b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
  2451
    "/ end of a line or beyond the last line of the text
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2452
3023
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  2453
    self st80EditMode ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2454
	l := (self listAt:line).
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2455
	max := l size + 1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2456
	col > max ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2457
	    ^ max
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2458
	]
1300
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  2459
    ].
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2460
    ^ col
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2461
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
  2462
    "Created: / 22.5.1996 / 14:25:30 / cg"
1596
0bbdb4e9fc43 made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
  2463
    "Modified: / 20.6.1998 / 18:19:24 / cg"
674
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2464
!
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2465
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2466
validateCursorLine:line
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2467
    "check of line is a valid cursor line; return a fixed line-nr if not.
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2468
     Here, no limits are enforced (and line is returned), but it may be
674
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2469
     redefined in views which dont like the cursor to be positioned
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2470
     behind the end of the text (vi/st-80 behavior), or want to
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2471
     skip reserved regions"
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2472
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
  2473
    "/
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
  2474
    "/ in st80Mode, the cursor may not be positioned
2707
810c994db0b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2696
diff changeset
  2475
    "/ beyond the last line
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
  2476
    "/
3023
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  2477
    self st80EditMode ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2478
	^ (line min:(list size)) max:1
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
  2479
    ].
674
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2480
    ^ line
247db5b61407 added cursor-line validation
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2481
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
  2482
    "Created: / 22.5.1996 / 18:22:23 / cg"
1596
0bbdb4e9fc43 made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
  2483
    "Modified: / 20.6.1998 / 18:19:26 / cg"
672
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2484
!
065750d02339 added cursorCol-validation
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2485
121
claus
parents: 118
diff changeset
  2486
withCursorOffDo:aBlock
claus
parents: 118
diff changeset
  2487
    "evaluate aBlock with cursor off; turn it on afterwards."
claus
parents: 118
diff changeset
  2488
claus
parents: 118
diff changeset
  2489
    (shown not or:[cursorShown not]) ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2490
	^ aBlock value
121
claus
parents: 118
diff changeset
  2491
    ].
claus
parents: 118
diff changeset
  2492
    self hideCursor.
2522
d80496af7eaf #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2506
diff changeset
  2493
    aBlock ensure:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2494
	self showCursor
121
claus
parents: 118
diff changeset
  2495
    ]
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2496
! !
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2497
2589
62794ae04446 support drop
ca
parents: 2580
diff changeset
  2498
!EditTextView methodsFor:'drag & drop'!
62794ae04446 support drop
ca
parents: 2580
diff changeset
  2499
62794ae04446 support drop
ca
parents: 2580
diff changeset
  2500
allowDrop:aBoolean
3236
aeb1fe5a6ead drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3235
diff changeset
  2501
    "enable/disable drop support"
aeb1fe5a6ead drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3235
diff changeset
  2502
2589
62794ae04446 support drop
ca
parents: 2580
diff changeset
  2503
    aBoolean ifFalse:[
3907
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2504
        dropTarget := nil.
2589
62794ae04446 support drop
ca
parents: 2580
diff changeset
  2505
    ] ifTrue:[
3907
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2506
        dropTarget isNil ifTrue:[
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2507
            dropTarget := DropTarget 
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2508
                                receiver:self
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2509
                                argument:nil
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2510
                                dropSelector:#'drop:'
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2511
                                canDropSelector:#'canDrop:'
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2512
        ]
3236
aeb1fe5a6ead drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3235
diff changeset
  2513
    ].
aeb1fe5a6ead drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3235
diff changeset
  2514
!
aeb1fe5a6ead drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3235
diff changeset
  2515
3412
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2516
canDrop:aDropContext
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2517
    "public from d&d.
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2518
     I accept textObjects and fileObjects only."
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2519
4089
c6567fb50316 comment/format in: #canDrop:
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  2520
    "/ cg: disabled to avoid unintended drop (is same as copy-past, anyway)
3412
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2521
    aDropContext sourceWidget == self ifTrue:[^ false].
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2522
    ^ self canDropObjects:aDropContext dropObjects
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2523
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2524
    "Modified: / 13-10-2006 / 17:41:09 / cg"
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2525
!
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2526
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2527
canDropObjects:aCollectionOfDropObjects
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2528
    "public from d&d.
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2529
     I accept textObjects and fileObjects only."
2589
62794ae04446 support drop
ca
parents: 2580
diff changeset
  2530
62794ae04446 support drop
ca
parents: 2580
diff changeset
  2531
    self checkModificationsAllowed ifFalse:[^ false].
62794ae04446 support drop
ca
parents: 2580
diff changeset
  2532
3412
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2533
    aCollectionOfDropObjects isEmpty ifTrue:[ ^ false ].
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2534
    ^ aCollectionOfDropObjects conform:[:obj| (obj isTextObject or:[obj isFileObject])]
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2535
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2536
    "Created: / 13-10-2006 / 15:56:57 / cg"
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2537
    "Modified: / 13-10-2006 / 17:41:14 / cg"
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2538
!
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2539
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2540
drop:aDropContext
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2541
    "public from d&d.
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2542
     drop objects (new API)"
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2543
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2544
    self dropObjects:(aDropContext dropObjects)
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2545
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2546
    "Modified: / 13-10-2006 / 17:41:19 / cg"
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2547
!
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2548
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2549
dropFileObject:aDropObject
2589
62794ae04446 support drop
ca
parents: 2580
diff changeset
  2550
    "drop objects
3236
aeb1fe5a6ead drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3235
diff changeset
  2551
     For bw. compatibility, also collections of drop objects are handled (may vanish)"
aeb1fe5a6ead drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3235
diff changeset
  2552
4136
fcce27dfc253 changed: #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 4130
diff changeset
  2553
    |answer text fn pasteWhat sensor dontAskAgainHolder enforcedDropMode app|
3907
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2554
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2555
    pasteWhat := #name.
3412
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2556
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2557
    fn := aDropObject asFilename.
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2558
    (fn exists and:[fn isRegularFile]) ifTrue:[
3907
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2559
        enforcedDropMode := UserPreferences current enforcedDropModeForFiles.
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2560
        (enforcedDropMode notNil 
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2561
        and:[enforcedDropMode ~~ #name or:[fn fileSize <= (1024*1024)]]) ifTrue:[
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2562
            pasteWhat := enforcedDropMode.
3886
b50c9304f1d1 better alien file drop
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2563
        ] ifFalse:[
3907
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2564
            sensor := self sensor.
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2565
            (sensor shiftDown or:[sensor ctrlDown]) ifTrue:[
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2566
                pasteWhat := #name.
3886
b50c9304f1d1 better alien file drop
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2567
            ] ifFalse:[
3907
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2568
                (sensor metaDown) ifTrue:[
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2569
                    pasteWhat := #contents.
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2570
                ] ifFalse:[
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2571
                    dontAskAgainHolder := false asValue.
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2572
                    answer := Dialog
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2573
                        confirmWithCancel:(resources
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2574
                                            stringWithCRs:'Drop the Filename (%1)\or its Contents ?\\Hint: bypass this dialog by pressing SHIFT/CTRL or ALT during the next drop.\SHIFT/CTRL to drop the name, ALT for the contents.'
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2575
                                            with:fn name allBold)
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2576
                        labels:#( 'Cancel' 'Name' 'Contents' )
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2577
                        values:#( nil #name #contents )
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2578
                        default:#contents
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2579
                        check:(resources string:'Do not ask again; instead, always paste the contents of small files.') on:dontAskAgainHolder
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2580
                        title:(resources string:'Drop What').
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2581
                    answer isNil ifTrue:[ ^ self ].
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2582
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2583
                    dontAskAgainHolder value ifTrue:[
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2584
                        UserPreferences current enforcedDropModeForFiles:#contents
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2585
                    ].
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2586
                    pasteWhat := answer.
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2587
                ]
3886
b50c9304f1d1 better alien file drop
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2588
            ]
b50c9304f1d1 better alien file drop
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2589
        ].
b50c9304f1d1 better alien file drop
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2590
    ].
b50c9304f1d1 better alien file drop
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2591
3907
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  2592
    pasteWhat == #name ifTrue:[
3886
b50c9304f1d1 better alien file drop
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2593
        text := fn pathName
b50c9304f1d1 better alien file drop
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2594
    ] ifFalse:[
b50c9304f1d1 better alien file drop
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2595
        self withWaitCursorDo:[
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2596
            text := fn contentsOfEntireFile
4136
fcce27dfc253 changed: #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 4130
diff changeset
  2597
        ].
fcce27dfc253 changed: #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 4130
diff changeset
  2598
        (app := self application) notNil ifTrue:[
fcce27dfc253 changed: #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 4130
diff changeset
  2599
            app droppedFile:fn in:self
fcce27dfc253 changed: #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 4130
diff changeset
  2600
        ].
3886
b50c9304f1d1 better alien file drop
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2601
    ].
b50c9304f1d1 better alien file drop
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
  2602
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2603
    self 
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2604
        undoablePaste:text 
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2605
        info:'Drop File'.
3412
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2606
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2607
    "Created: / 13-10-2006 / 17:38:31 / cg"
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  2608
    "Modified: / 28-07-2007 / 13:27:09 / cg"
3412
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2609
!
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2610
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2611
dropObject:aDropObject
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2612
    "drop objects
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2613
     For bw. compatibility, also collections of drop objects are handled (may vanish)"
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2614
3415
35ffbeec46d9 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
  2615
    |text|
35ffbeec46d9 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
  2616
3412
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2617
    (aDropObject isFileObject) ifTrue:[
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2618
        self dropFileObject:aDropObject
3412
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2619
    ] ifFalse:[
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2620
        aDropObject isTextObject ifTrue:[
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2621
            text := aDropObject theObject.
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2622
            text isStringCollection ifTrue:[
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2623
                text := text asStringWithoutFinalCR
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2624
            ].
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2625
        ] ifFalse:[
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2626
            text := aDropObject theObject asString
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2627
        ].
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2628
        self 
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2629
            undoablePaste:text 
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2630
            info:'Drop'.
3412
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2631
    ].
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2632
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2633
    "Created: / 13-10-2006 / 17:37:05 / cg"
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  2634
    "Modified: / 28-07-2007 / 13:26:53 / cg"
3412
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2635
!
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2636
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2637
dropObjects:aCollectionOfDropObjects
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2638
    "public from d&d.
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2639
     drop objects (old API)"
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2640
3868
664a888e9c6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  2641
    aCollectionOfDropObjects do:[:el |
664a888e9c6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  2642
        self dropObject:el
3412
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2643
    ].
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2644
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2645
    "Created: / 13-10-2006 / 15:59:40 / cg"
e893eef88643 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 3410
diff changeset
  2646
    "Modified: / 13-10-2006 / 17:41:23 / cg"
2589
62794ae04446 support drop
ca
parents: 2580
diff changeset
  2647
! !
62794ae04446 support drop
ca
parents: 2580
diff changeset
  2648
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2649
!EditTextView methodsFor:'editing'!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2650
4286
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2651
convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2652
    "toLower/toUppercaseFirst/toUpper selected text"
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2653
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2654
    |line1 line2|
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2655
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2656
    line1 := self selectionStartLine.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2657
    line2 := self selectionEndLine.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2658
    line1 isNil ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2659
        line1 := self perform:#cursorLine ifNotUnderstood:nil.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2660
        line1 notNil ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2661
            line2 := line1
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2662
        ]
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2663
    ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2664
    line1 notNil ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2665
        line1 to:line2 do:[:lineNr |
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2666
            |line col1 col2 isAllLower isLowerFirst isAllUpper isUpperFirst
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2667
             makeLowercase makeUppercase makeUppercaseFirst makeLowercaseFirst|
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2668
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2669
            line := (self listAt:lineNr) copy.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2670
            line size > 0 ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2671
                lineNr == line1 ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2672
                    col1 := selectionStartCol.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2673
                ] ifFalse:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2674
                    col1 := 1.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2675
                ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2676
                lineNr == line2 ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2677
                    col2 := selectionEndCol.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2678
                ] ifFalse:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2679
                    col2 := (self listAt:lineNr) size.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2680
                ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2681
                isAllLower := isAllUpper := isUpperFirst := isLowerFirst := true.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2682
                col1 to:col2 do:[:col |
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2683
                    |ch|
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2684
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2685
                    ch := line at:col.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2686
                    ch isUppercase ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2687
                        isAllLower := false.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2688
                        col == col1 ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2689
                            isLowerFirst := false.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2690
                        ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2691
                    ] ifFalse:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2692
                        ch isLowercase ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2693
                            isAllUpper := false.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2694
                            col == col1 ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2695
                                isUpperFirst := false.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2696
                            ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2697
                        ]
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2698
                    ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2699
                ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2700
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2701
                makeLowercase := makeUppercase := makeUppercaseFirst := makeLowercaseFirst := false.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2702
                isLowerFirst ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2703
                    makeUppercaseFirst := true.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2704
                ] ifFalse:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2705
                    "/ must remember where we come from - otherwise, we end up
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2706
                    "/ in upperFirst - lowerFirst cycle.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2707
                    "/ think about a good place to store this state
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2708
                    false "(isUpperFirst and:[isAllUpper not])" ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2709
                        makeLowercaseFirst := true.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2710
                     ] ifFalse:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2711
                        isAllUpper ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2712
                            makeLowercase := true.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2713
                        ] ifFalse:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2714
                            makeUppercase := true.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2715
                        ]
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2716
                    ]
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2717
                ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2718
                makeUppercaseFirst ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2719
                    line at:col1 put:(line at:col1) asUppercase.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2720
                ] ifFalse:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2721
                    makeLowercaseFirst ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2722
                        line at:col1 put:(line at:col1) asLowercase.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2723
                    ] ifFalse:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2724
                        col1 to:col2 do:[:col |
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2725
                            |ch|
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2726
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2727
                            ch := line at:col.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2728
                            ch := makeLowercase
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2729
                                    ifTrue:[ ch asLowercase ]
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2730
                                    ifFalse:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2731
                                        makeUppercase
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2732
                                            ifTrue:[ ch asUppercase ]
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2733
                                            ifFalse:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2734
                                                col == col1
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2735
                                                    ifTrue:[ ch asUppercase ]
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2736
                                                    ifFalse:[ ch asLowercase ]
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2737
                                            ]
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2738
                                    ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2739
                            line at:col put:ch.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2740
                        ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2741
                    ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2742
                ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2743
                self withoutRedrawAt:lineNr put:line.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2744
                self invalidateLine:lineNr.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2745
            ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2746
        ].
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2747
    ]
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2748
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2749
    "Created: / 14-07-2011 / 11:40:26 / cg"
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2750
!
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  2751
313
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  2752
copyAndDeleteSelection
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  2753
    "copy the selection into the pastBuffer and delete it"
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  2754
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  2755
    selectionStartLine notNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2756
	self setClipboardText:(self selection).
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2757
	self deleteSelection.
313
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  2758
    ].
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  2759
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  2760
    "Created: 27.1.1996 / 16:23:28 / cg"
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  2761
!
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  2762
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2763
deleteCharAtCursor
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2764
    "delete single character under cursor; does not merge lines"
121
claus
parents: 118
diff changeset
  2765
claus
parents: 118
diff changeset
  2766
    |wasOn|
claus
parents: 118
diff changeset
  2767
claus
parents: 118
diff changeset
  2768
    wasOn := self hideCursor.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2769
    self deleteCharAtLine:cursorLine col:cursorCol.
121
claus
parents: 118
diff changeset
  2770
    wasOn ifTrue:[self showCursor]
claus
parents: 118
diff changeset
  2771
!
claus
parents: 118
diff changeset
  2772
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2773
deleteCharAtLine:lineNr col:colNr
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2774
    "delete a single character at colNr in line lineNr"
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2775
3023
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  2776
    self st80EditMode ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2777
	(self listAt:cursorLine) size + 1 = colNr ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2778
	    | wasOn |
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2779
	    wasOn := self hideCursor.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2780
	    self
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2781
		cursorReturn;
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2782
		cursorCol:1;
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2783
		deleteCharBeforeCursor.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2784
	    wasOn ifTrue:[ self showCursor].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2785
	    ^ self.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2786
	].
3023
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  2787
    ].
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  2788
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2789
    self deleteCharsAtLine:lineNr fromCol:colNr toCol:colNr
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2790
!
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2791
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2792
deleteCharBeforeCursor
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2793
    "delete single character to the left of cursor and move cursor to left"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2794
4592
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2795
    |soCol wasOn lineNrAboveCursor ln originalLine prevTab|
121
claus
parents: 118
diff changeset
  2796
claus
parents: 118
diff changeset
  2797
    wasOn := self hideCursor.
4592
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2798
    (autoIndent
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2799
    and:[ (tabPositions includes:cursorCol)
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2800
    ]) ifTrue:[
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2801
        prevTab := (self prevTabBefore:cursorCol) max:1.
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2802
        ln := originalLine := (list at:cursorLine) ? ''.
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2803
        ln size < prevTab ifTrue:[
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2804
            ln := ln , (String new:prevTab withAll:Character space).
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2805
        ].
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2806
        (ln copyTo:prevTab) isBlank ifTrue:[
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2807
            (ln copyFrom:prevTab+1) isBlank ifTrue:[
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2808
                cursorCol > prevTab ifTrue:[
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2809
                    self st80EditMode ifTrue:[
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2810
                        "/ ensure that there is no conflict here: st80EditMode will
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2811
                        "/ not allow a cursor position beyond the end of line,
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2812
                        "/ so avoid that cursorLine:col: will force us to the beginning of the line
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2813
                        originalLine size < prevTab ifTrue:[
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  2814
                            self basicListAt:cursorLine put:ln
4592
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2815
                        ]
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2816
                    ].
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2817
                    self cursorLine:cursorLine col:prevTab.
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2818
                    wasOn ifTrue:[ self showCursor ].
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2819
                    ^  self
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2820
                ].
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2821
            ] ifFalse:[
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2822
                self deleteFromLine:cursorLine col:prevTab toLine:cursorLine col:cursorCol-1.
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2823
                self cursorLine:cursorLine col:prevTab.
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2824
                wasOn ifTrue:[ self showCursor ].
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2825
                ^  self.
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2826
            ]
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2827
        ].
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2828
    ].
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2829
2491
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2830
"/        (autoIndent
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2831
"/    and:[cursorCol  ~~ 1
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2832
"/    and:[cursorLine <= (list size)]])
2491
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2833
"/     ifTrue:[
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2834
"/        soCol := (self leftIndentForLine:cursorLine) + 1.
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2835
"/
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2836
"/        (cursorCol == soCol and:[soCol > 1]) ifTrue:[
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2837
"/            ln := list at:cursorLine.
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2838
"/            (ln notNil and:[(ln indexOfNonSeparatorStartingAt:1) < soCol]) ifTrue:[
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2839
"/                soCol := 1
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2840
"/            ]
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2841
"/        ]
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2842
"/    ] ifFalse:[
4592
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2843
        soCol := 1.
2491
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2844
"/    ].
f3e207ae5156 auto indent fix
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
  2845
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
  2846
    (cursorCol ~~ soCol and:[cursorCol ~~ 1]) ifTrue:[
4592
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2847
        "
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2848
         somewhere in the middle of a line
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2849
        "
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2850
        self cursorLeft.
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2851
        self deleteCharAtLine:cursorLine col:cursorCol.
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
  2852
    ] ifFalse:[
4592
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2853
        "
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2854
         at begin of line - merge with previous line;
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2855
         except for the very first line.
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2856
        "
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2857
        (cursorLine == 1) ifFalse:[
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2858
            lineNrAboveCursor := self validateCursorLine:(cursorLine - 1).
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2859
            lineNrAboveCursor < cursorLine ifTrue:[
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2860
                (lineNrAboveCursor > 0 and:[lineNrAboveCursor > list size]) ifTrue:[
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2861
                    "/ we are beyond the end of the text.
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2862
                    "/ move the cursor to the previous line.
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2863
                    self cursorLine:lineNrAboveCursor col:1.
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2864
                ] ifFalse:[
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2865
                    self mergeLine:lineNrAboveCursor removeBlanks:false.
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2866
                ]
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2867
            ]
60fc44d286f2 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4590
diff changeset
  2868
        ]
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2869
    ].
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2870
    wasOn ifTrue:[ self showCursor ]
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2871
1419
3aec8008e0a6 more for st80Mode
Claus Gittinger <cg@exept.de>
parents: 1415
diff changeset
  2872
    "Modified: / 16.1.1998 / 22:33:04 / cg"
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2873
!
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2874
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2875
deleteCharsAtLine:lineNr fromCol:colNr
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2876
    "delete characters from colNr up to the end in line lineNr"
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2877
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2878
    |line|
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2879
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2880
    (line := self listAt:lineNr) notNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2881
	self deleteCharsAtLine:lineNr fromCol:colNr toCol:(line size)
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2882
    ]
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2883
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2884
!
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2885
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2886
deleteCharsAtLine:lineNr fromCol:startCol toCol:endCol
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2887
    "delete characters from startCol to endCol in line lineNr"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2888
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2889
    |deleted|
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2890
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2891
    deleted := self textFromLine:lineNr col:startCol toLine:lineNr col:endCol.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2892
    self basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2893
    self addUndo:(PasteString line:lineNr col:startCol string:deleted info:'delete').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2894
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2895
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2896
deleteCharsAtLine:lineNr toCol:colNr
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2897
    "delete characters from start up to colNr in line lineNr"
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2898
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2899
    self deleteCharsAtLine:lineNr fromCol:1 toCol:colNr
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2900
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  2901
121
claus
parents: 118
diff changeset
  2902
!
claus
parents: 118
diff changeset
  2903
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2904
deleteCursorLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2905
    "delete the line where the cursor sits"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2906
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  2907
    self deleteLine:cursorLine
121
claus
parents: 118
diff changeset
  2908
!
claus
parents: 118
diff changeset
  2909
2385
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2910
deleteFromCharacterPosition:charPos1 to:charPos2
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2911
    "delete a substring at a character position"
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2912
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2913
    |line1 col1 line2 col2|
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2914
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2915
    line1 := self lineOfCharacterPosition:charPos1.
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2916
    col1 := charPos1 - (self characterPositionOfLine:line1 col:1) + 1.
2725
eccf283b2efb deleteFromCharacterPos - fixed
Claus Gittinger <cg@exept.de>
parents: 2724
diff changeset
  2917
    col1 == 0 ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2918
	line1 := line1 - 1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  2919
	col1 := (self listAt:line1) size + 1.
2725
eccf283b2efb deleteFromCharacterPos - fixed
Claus Gittinger <cg@exept.de>
parents: 2724
diff changeset
  2920
    ].
2385
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2921
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2922
    line2 := self lineOfCharacterPosition:charPos2.
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2923
    col2 := charPos2 - (self characterPositionOfLine:line2 col:1) + 1.
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2924
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2925
    self deleteFromLine:line1 col:col1 toLine:line2 col:col2.
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2926
!
357e8a1cb2b2 added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents: 2373
diff changeset
  2927
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2928
deleteFromLine:startLine col:startCol toLine:endLine col:endCol
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2929
    "delete all text from startLine/startCol to endLine/endCol -
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2930
     joining lines if nescessary"
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2931
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2932
    |line newLine lineSize nMore|
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2933
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2934
    self checkModificationsAllowed ifFalse:[ ^ self].
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2935
    list isNil ifTrue:[^ self].
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2936
    startLine > list size ifTrue:[ ^ self]. "/ deleted space below text
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2937
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2938
    (startLine == endLine) ifTrue:[
4225
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2939
        "/ delete chars within a line
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2940
        self deleteCharsAtLine:startLine fromCol:startCol toCol:endCol.
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2941
        ^ self
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2942
    ].
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2943
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2944
    ((startCol == 1) and:[endCol == 0]) ifTrue:[
4225
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2945
        "/ delete full lines only
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2946
        endLine > startLine ifTrue:[
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2947
            self deleteFromLine:startLine toLine:(endLine - 1)
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2948
        ].
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2949
        ^ self
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2950
    ].
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2951
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2952
    "/ delete right rest of 1st line
4786
70fd2d143e7c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4782
diff changeset
  2953
    self deleteCharsAtLine:startLine fromCol:(startCol max:1).
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2955
    "/ delete the inner lines ...
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2956
    endLine > (startLine + 1) ifTrue:[
4225
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2957
        self deleteFromLine:(startLine + 1) toLine:(endLine - 1)
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2958
    ].
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2959
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2960
    (endCol ~~ 0) ifTrue:[
4225
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2961
        "/ delete the left rest of the last line
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2962
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2963
        self deleteCharsAtLine:(startLine + 1) toCol:endCol.
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2964
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2965
        "/ must add blanks, if startCol lies beyond end of startLine
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2966
        startLine <= list size ifTrue:[
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2967
            line := list at:startLine.
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2968
            lineSize := line size.
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2969
            (startCol > lineSize) ifTrue:[
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2970
                newLine := line.
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2971
                line isNil ifTrue:[
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2972
                    newLine := String new:(startCol - 1)
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2973
                ] ifFalse:[
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2974
                    nMore := startCol - 1 - lineSize.
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2975
                    nMore > 0 ifTrue:[
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2976
                        newLine := line , (line species new:nMore)
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2977
                    ]
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2978
                ].
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2979
                newLine ~~ line ifTrue:[
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  2980
                    self basicListAt:startLine put:newLine.
4225
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2981
                ].
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2982
                "/ TODO: remember old maxwidth of linerange,
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2983
                "/ only clear widthOfWidestLine, if this max
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2984
                "/ length was (one of) the longest.
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2985
                "/ avoids slow delete with huge texts.
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2986
                widthOfWidestLine := nil. "/ i.e. unknown
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2987
                self textChanged.
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2988
            ]
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2989
        ]
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2990
    ].
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2991
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2992
    "/ merge the left rest of 1st line with right rest of last line into one
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2993
    self mergeLine:startLine removeBlanks:false
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2994
4225
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2995
    "Modified: / 10-11-1998 / 23:52:59 / cg"
a0a83ed7368c changed: #deleteFromLine:col:toLine:col:
az
parents: 4213
diff changeset
  2996
    "Modified: / 18-03-2011 / 18:25:01 / az"
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2997
!
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  2998
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2999
deleteFromLine:startLineNr toLine:endLineNr
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3000
    "delete some lines"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3001
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3002
    |deleted|
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3003
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3004
    deleted := self textFromLine:startLineNr col:1 toLine:endLineNr+1 col:0.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3005
    self basicDeleteFromLine:startLineNr toLine:endLineNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3006
    self addUndo:(PasteString line:startLineNr col:1 string:deleted info:'delete').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3007
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3008
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  3009
deleteLine:lineNr
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  3010
    "delete line"
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  3011
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  3012
    self deleteFromLine:lineNr toLine:lineNr
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  3013
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  3014
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  3015
!
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  3016
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3017
deleteLineWithoutRedraw:lineNr
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3018
    "delete line - no redraw;
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3019
     return true, if something was really deleted"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3020
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3021
    |deleted ret|
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3022
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3023
    deleted := self textFromLine:lineNr col:1 toLine:lineNr+1 col:0.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3024
    ret := self basicDeleteLineWithoutRedraw:lineNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3025
    self addUndo:(PasteString line:lineNr col:1 string:deleted info:'delete').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3026
    ^ ret.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3027
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3028
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3029
deleteLinesWithoutRedrawFrom:startLine to:endLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3030
    "delete lines - no redraw;
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3031
     return true, if something was really deleted"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3032
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3033
    |lastLine|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3034
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3035
    self checkModificationsAllowed ifFalse:[^ false].
331
c58f0c52d2d7 made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
  3036
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3037
    (list isNil or:[startLine > list size]) ifTrue:[^ false].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3038
    (endLine > list size) ifTrue:[
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3039
        lastLine := list size
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3040
    ] ifFalse:[
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3041
        lastLine := endLine
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3042
    ].
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3043
    self basicListRemoveFromIndex:startLine toIndex:lastLine.
1717
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  3044
    "/ TODO: remember old maxwidth of linerange,
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  3045
    "/ only clear widthOfWidestLine, if this max
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  3046
    "/ length was (one of) the longest.
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  3047
    "/ avoids slow delete with huge texts.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3048
    widthOfWidestLine := nil. "/ i.e. unknown
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3049
    self textChanged.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3050
    ^ true
1717
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  3051
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  3052
    "Modified: / 10.11.1998 / 23:55:29 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3053
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3054
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3055
deleteSelection
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3056
    "delete the selection"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3057
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3058
    |wasOn startLine startCol endLine endCol|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3059
331
c58f0c52d2d7 made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
  3060
    self checkModificationsAllowed ifFalse:[ ^ self].
c58f0c52d2d7 made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
  3061
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3062
    selectionStartLine notNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3063
	wasOn := self hideCursor.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3064
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3065
	startLine := selectionStartLine.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3066
	startCol := selectionStartCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3067
	endLine := selectionEndLine.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3068
	endCol := selectionEndCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3069
	self unselectWithoutRedraw.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3070
	self deleteFromLine:startLine col:startCol toLine:endLine col:endCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3071
	self setCursorLine:startLine col:startCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3072
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3073
	self makeCursorVisibleAndShowCursor:wasOn
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3074
    ]
121
claus
parents: 118
diff changeset
  3075
!
claus
parents: 118
diff changeset
  3076
2157
ba22c3cc278b added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3077
deleteWordBeforeCursor
ba22c3cc278b added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3078
    "delete the word to the left of cursor and move cursor to left"
ba22c3cc278b added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3079
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  3080
    |wasOn beginCol beginLine endCol endLine|
2157
ba22c3cc278b added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3081
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3082
    self checkModificationsAllowed ifFalse:[ ^ self].
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3083
2157
ba22c3cc278b added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3084
    wasOn := self hideCursor.
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3085
    self 
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3086
        undoableDo:[
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3087
            endCol := cursorCol-1.
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3088
            endLine := cursorLine.
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3089
            self cursorToPreviousWord.
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3090
            beginCol := cursorCol.
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3091
            beginLine := cursorLine.
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3092
            self deleteFromLine:beginLine col:beginCol toLine:endLine col:endCol.
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3093
        ] 
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3094
        info:'Delete Word'.
2157
ba22c3cc278b added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3095
    wasOn ifTrue:[ self showCursor ].
ba22c3cc278b added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3096
ba22c3cc278b added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3097
    "Modified: / 22.2.2000 / 23:59:04 / cg"
ba22c3cc278b added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3098
!
ba22c3cc278b added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3099
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3100
insert:aCharacter atLine:lineNr col:colNr
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3101
    "insert a single character at lineNr/colNr;
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3102
     set emphasis to character at current position"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3103
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3104
    self basicInsert:aCharacter atLine:lineNr col:colNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3105
    aCharacter ~~ Character cr ifTrue:[
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3106
	self addUndo:(DeleteCharacters line:lineNr col:colNr info:'insert').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3107
    ]
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3108
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3109
121
claus
parents: 118
diff changeset
  3110
insertCharAtCursor:aCharacter
1566
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3111
    "insert a single character at cursor-position - advance cursor."
121
claus
parents: 118
diff changeset
  3112
claus
parents: 118
diff changeset
  3113
    |wasOn|
claus
parents: 118
diff changeset
  3114
claus
parents: 118
diff changeset
  3115
    wasOn := self hideCursor.
1566
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3116
    aCharacter == Character tab ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3117
	"/ needs special care to advance cursor correctly
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3118
	self insertTabAtCursor
121
claus
parents: 118
diff changeset
  3119
    ] ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3120
	self insert:aCharacter atLine:cursorLine col:cursorCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3121
	aCharacter == (Character cr) ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3122
	    self cursorReturn
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3123
	] ifFalse:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3124
	    self cursorRight.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3125
	].
121
claus
parents: 118
diff changeset
  3126
    ].
claus
parents: 118
diff changeset
  3127
    self makeCursorVisibleAndShowCursor:wasOn.
1566
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3128
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3129
    "Modified: / 12.6.1998 / 21:50:20 / cg"
121
claus
parents: 118
diff changeset
  3130
!
claus
parents: 118
diff changeset
  3131
641
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3132
insertLine:aString before:lineNr
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3133
    "insert the line aString before line lineNr"
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3134
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3135
    ^ self insertLines:(Array with:aString) from:1 to:1  before:lineNr.
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3136
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3137
    "Modified: 14.5.1996 / 13:42:54 / cg"
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3138
!
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3139
155
claus
parents: 133
diff changeset
  3140
insertLines:aStringCollection before:lineNr
claus
parents: 133
diff changeset
  3141
    "insert a bunch before line lineNr"
claus
parents: 133
diff changeset
  3142
claus
parents: 133
diff changeset
  3143
    self insertLines:aStringCollection from:1 to:aStringCollection size before:lineNr
claus
parents: 133
diff changeset
  3144
claus
parents: 133
diff changeset
  3145
    "Modified: 6.9.1995 / 20:51:03 / claus"
claus
parents: 133
diff changeset
  3146
!
claus
parents: 133
diff changeset
  3147
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3148
insertLines:someText from:start to:end before:lineNr
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3149
    "insert a bunch of lines before line lineNr.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3150
     The cursor position is left unchanged."
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3151
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3152
    |text indent visLine w nLines "{ Class: SmallInteger }"
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3153
     srcY "{ Class: SmallInteger }"
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3154
     dstY "{ Class: SmallInteger }" |
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3155
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3156
    autoIndent ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3157
        indent := self leftIndentForLine:lineNr.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3158
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3159
        text := someText collect:[:ln||line|
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3160
            ln notNil ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3161
                line := ln withoutLeadingSeparators.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3162
                (line isEmpty or:[indent == 0]) ifFalse:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3163
                    line := (String new:indent), line
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3164
                ].
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3165
                line
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3166
            ] ifFalse:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3167
                nil
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3168
            ]
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3169
        ].
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3170
    ] ifFalse:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3171
        text := someText
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3172
    ].
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3173
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3174
    visLine := self listLineToVisibleLine:lineNr.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3175
    (shown not or:[visLine isNil]) ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3176
        self withoutRedrawInsertLines:text
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3177
             from:start to:end
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3178
             before:lineNr.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3179
    ] ifFalse:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3180
        nLines := end - start + 1.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3181
        ((visLine + nLines) >= nLinesShown) ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3182
            self withoutRedrawInsertLines:text
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3183
                 from:start to:end
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3184
                 before:lineNr.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3185
            self redrawFromVisibleLine:visLine to:nLinesShown
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3186
        ] ifFalse:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3187
            w := self widthForScrollBetween:(lineNr + nLines)
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3188
                                        and:(firstLineShown + nLines + nLinesShown).
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3189
            srcY := topMargin + ((visLine - 1) * fontHeight).
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3190
            dstY := srcY + (nLines * fontHeight).
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3191
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3192
            "/
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3193
            "/ scroll ...
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3194
            "/
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3195
            "
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3196
             stupid: must catchExpose before inserting new
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3197
             stuff - since catchExpose may perform redraws
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3198
            "
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3199
            self catchExpose.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3200
            self withoutRedrawInsertLines:text
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3201
                 from:start to:end
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3202
                 before:lineNr.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3203
            self
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3204
                copyFrom:self
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3205
                x:textStartLeft y:srcY
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3206
                toX:textStartLeft y:dstY
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3207
                width:w
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3208
                height:(height - dstY)
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3209
                async:true.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3210
            self redrawFromVisibleLine:visLine to:(visLine + nLines - 1).
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3211
            self waitForExpose
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3212
        ].
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3213
    ].
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3214
    widthOfWidestLine notNil ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3215
        text do:[:line |
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3216
            widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line).
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3217
        ]
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3218
    ].
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3219
    self textChanged.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3220
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3221
    "Modified: 29.1.1997 / 13:02:39 / cg"
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3222
!
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3223
654
d621e63baaa5 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
  3224
insertLines:lines withCR:withCr
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3225
    "insert a bunch of lines at cursor position.
1566
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3226
     Cursor is moved behind insertion.
641
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3227
     If withCr is true, append cr after last line"
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3228
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3229
    |start end nLines wasOn|
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3230
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3231
    lines notNil ifTrue:[
4649
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3232
        nLines := lines size.
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3233
        (nLines == 1) ifTrue:[
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3234
            self insertStringAtCursor:(lines at:1).
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3235
            withCr ifTrue:[
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3236
                self insertCharAtCursor:(Character cr)
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3237
            ]
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3238
        ] ifFalse:[
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3239
            (cursorCol ~~ 1) ifTrue:[
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3240
                self insertStringAtCursor:(lines at:1).
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3241
                self insertCharAtCursor:(Character cr).
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3242
                start := 2
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3243
            ] ifFalse:[
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3244
                start := 1
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3245
            ].
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3246
            withCr ifTrue:[
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3247
                end := nLines
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3248
            ] ifFalse:[
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3249
                end := nLines - 1
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3250
            ].
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3251
            (start <= nLines) ifTrue:[
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3252
                (end >= start) ifTrue:[
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3253
                    wasOn := self hideCursor.
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3254
                    self insertLines:lines from:start to:end before:cursorLine.
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3255
                    self setCursorLine:(cursorLine + (end - start + 1)).
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3256
                    wasOn ifTrue:[self showCursor].
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3257
                ]
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3258
            ].
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3259
            withCr ifFalse:[
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3260
                "last line without cr"
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3261
                self insertStringAtCursor:(lines at:nLines)
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3262
            ]
1b1db54a3d29 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4635
diff changeset
  3263
        ]
641
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3264
    ]
654
d621e63baaa5 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
  3265
1566
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3266
    "Created: / 18.5.1996 / 15:32:06 / cg"
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3267
    "Modified: / 12.6.1998 / 21:51:16 / cg"
654
d621e63baaa5 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
  3268
!
d621e63baaa5 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
  3269
d621e63baaa5 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
  3270
insertLines:lines withCr:withCr
d621e63baaa5 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
  3271
    "insert a bunch of lines at cursor position. Cursor
d621e63baaa5 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
  3272
     is moved behind insertion.
d621e63baaa5 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
  3273
     If withCr is true, append cr after last line"
d621e63baaa5 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
  3274
2363
1982139b2c0b Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 2357
diff changeset
  3275
    <resource:#obsolete>
1982139b2c0b Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 2357
diff changeset
  3276
1292
ca4c9a957a32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
  3277
    self obsoleteMethodWarning:'use #insertLines:withCR:'.
ca4c9a957a32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
  3278
    self insertLines:lines withCR:withCr.
ca4c9a957a32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
  3279
ca4c9a957a32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
  3280
    "Modified: 31.7.1997 / 23:07:22 / cg"
641
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3281
!
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  3282
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3283
insertSelectedStringAtCursor:aString
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3284
    "insert the argument, aString at cursor position and select it"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3285
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3286
    |startLine startCol|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3287
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3288
    startLine := cursorLine.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3289
    startCol := cursorCol.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3290
    self insertStringAtCursor:aString.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3291
    self selectFromLine:startLine col:startCol
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  3292
		 toLine:cursorLine col:(cursorCol - 1).
3514
98e103cad51d insertSelectedStringAtCursor: - make selection visible afterwards;
Michael Beyl <mb@exept.de>
parents: 3510
diff changeset
  3293
    self makeSelectionVisible.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3294
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3295
1935
b59ff4681762 added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1929
diff changeset
  3296
insertString:aString atCharacterPosition:charPos
b59ff4681762 added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1929
diff changeset
  3297
    "insert the argument, aString at a character position"
b59ff4681762 added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1929
diff changeset
  3298
b59ff4681762 added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1929
diff changeset
  3299
    |line col|
b59ff4681762 added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1929
diff changeset
  3300
b59ff4681762 added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1929
diff changeset
  3301
    line := self lineOfCharacterPosition:charPos.
b59ff4681762 added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1929
diff changeset
  3302
    col := charPos - (self characterPositionOfLine:line col:1) + 1.
b59ff4681762 added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1929
diff changeset
  3303
    self insertString:aString atLine:line col:col
b59ff4681762 added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1929
diff changeset
  3304
!
b59ff4681762 added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1929
diff changeset
  3305
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3306
insertString:aString atLine:lineNr col:colNr
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3307
    "insert the string, aString at line/col;
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3308
     handle cr's correctly"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3309
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3310
    |start           "{ Class: SmallInteger }"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3311
     stop            "{ Class: SmallInteger }"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3312
     end             "{ Class: SmallInteger }"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3313
     subString c
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3314
     l               "{ Class: SmallInteger }" |
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3315
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3316
    aString isNil ifTrue:[^ self].
1560
43d0f7c2143f use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents: 1559
diff changeset
  3317
    (aString includes:(Character cr)) ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3318
	^ self insertStringWithoutCRs:aString atLine:lineNr col:colNr
121
claus
parents: 118
diff changeset
  3319
    ].
1560
43d0f7c2143f use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents: 1559
diff changeset
  3320
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3321
    l := lineNr.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3322
    c := colNr.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3323
    start := 1.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3324
    end := aString size.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3325
    [start <= end] whileTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3326
	stop := aString indexOf:(Character cr) startingAt:start.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3327
	stop == 0 ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3328
	    stop := end + 1
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3329
	].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3330
	subString := aString copyFrom:start to:(stop - 1).
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3331
	self insertStringWithoutCRs:subString atLine:l col:c.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3332
	(stop <= end) ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3333
	    c := c + subString size.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3334
	    self insert:(Character cr) atLine:l col:c.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3335
	    l := l + 1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3336
	    c := 1
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3337
	].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3338
	start := stop + 1
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3339
    ]
1480
eabb1848e2fa fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
  3340
1560
43d0f7c2143f use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents: 1559
diff changeset
  3341
    "Modified: / 10.6.1998 / 19:03:59 / cg"
121
claus
parents: 118
diff changeset
  3342
!
claus
parents: 118
diff changeset
  3343
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3344
insertStringAtCursor:aString
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3345
    "insert the argument, aString at cursor position
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3346
     handle cr's correctly. A nil argument is interpreted as an empty line."
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3347
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3348
    aString isNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3349
	"new:"
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3350
	self insertCharAtCursor:(Character cr).
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3351
	^ self
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3352
    ].
1560
43d0f7c2143f use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents: 1559
diff changeset
  3353
    (aString includes:(Character cr)) ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3354
	^ self insertStringWithoutCRsAtCursor:aString
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3355
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3356
654
d621e63baaa5 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 641
diff changeset
  3357
    self insertLines:aString asStringCollection withCR:false.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3358
1560
43d0f7c2143f use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents: 1559
diff changeset
  3359
    "Modified: / 10.6.1998 / 19:03:21 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3360
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3361
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3362
insertStringWithoutCRs:aString atLine:lineNr col:colNr
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3363
    "insert aString (which has no crs) at lineNr/colNr"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3364
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3365
    self withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr.
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  3366
    shown ifTrue:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  3367
        font hasOverlappingCharacters ifTrue:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  3368
            self invalidateLine:lineNr.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  3369
        ] ifFalse:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  3370
            self redrawLine:lineNr from:colNr
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  3371
        ]
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  3372
    ]
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  3373
4191
8ac20ced2fbf changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4190
diff changeset
  3374
    "Modified: / 09-11-2010 / 13:43:03 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3375
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3376
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3377
insertStringWithoutCRsAtCursor:aString
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3378
    "insert a string (which has no crs) at cursor position
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3379
     - advance cursor"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3380
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  3381
    |wasOn oldLen newLen deltaLen|
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  3382
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  3383
    aString size > 0 ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3384
	wasOn := self hideCursor.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3385
	(aString includes:Character tab) ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3386
	    self checkForExistingLine:cursorLine.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3387
	    oldLen := (list at:cursorLine) size.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3388
	    self insertString:aString atLine:cursorLine col:cursorCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3389
	    newLen := (list at:cursorLine) size.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3390
	    deltaLen := newLen - oldLen.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3391
	] ifFalse:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3392
	    self insertString:aString atLine:(cursorLine ? 1) col:cursorCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3393
	    deltaLen := aString size.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3394
	].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3395
	self setCursorCol:(cursorCol + deltaLen).
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3396
	wasOn ifTrue:[self showCursor]
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3397
    ]
1563
b4eb49efdfcd fixed cursor positioning if inserting a string with tabs.
Claus Gittinger <cg@exept.de>
parents: 1561
diff changeset
  3398
b4eb49efdfcd fixed cursor positioning if inserting a string with tabs.
Claus Gittinger <cg@exept.de>
parents: 1561
diff changeset
  3399
    "Modified: / 10.6.1998 / 20:43:52 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3400
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3401
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3402
insertTabAtCursor
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3403
    "insert spaces to next tab"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3404
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3405
    |wasOn nextTab|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3406
121
claus
parents: 118
diff changeset
  3407
    wasOn := self hideCursor.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3408
    nextTab := self nextTabAfter:cursorCol.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3409
    self insertStringAtCursor:(String new:(nextTab - cursorCol)).
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3410
    self makeCursorVisibleAndShowCursor:wasOn.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3411
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3412
3542
30ed44ed0178 +joinLines (CTRL-j);
Claus Gittinger <cg@exept.de>
parents: 3517
diff changeset
  3413
joinLines
3890
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3414
    "join lines (remove line-break)"
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3415
3583
fd5a924c8681 menu enablement
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
  3416
    self checkModificationsAllowed ifFalse:[ ^ self].
fd5a924c8681 menu enablement
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
  3417
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  3418
    self
3890
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3419
        undoableDo:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3420
            |line col lineLen|
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3421
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3422
            line := cursorLine.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3423
            col := cursorCol.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3424
            lineLen := (list at:line) size.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3425
            col > lineLen ifTrue:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3426
                self insertString:(String new:col-lineLen) atLine:line col:col+1.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3427
            ] ifFalse:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3428
                self deleteCharsAtLine:line fromCol:col toCol:lineLen.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3429
            ].
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3430
            self mergeLine:line removeBlanks:true.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3431
            self cursorLine:line col:col.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3432
        ]
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3433
        info:'Join'
3542
30ed44ed0178 +joinLines (CTRL-j);
Claus Gittinger <cg@exept.de>
parents: 3517
diff changeset
  3434
!
30ed44ed0178 +joinLines (CTRL-j);
Claus Gittinger <cg@exept.de>
parents: 3517
diff changeset
  3435
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  3436
mergeLine:lineNr
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  3437
    "merge line lineNr with line lineNr+1"
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  3438
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  3439
    self mergeLine:lineNr removeBlanks:true
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  3440
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  3441
    "Modified: 9.9.1997 / 09:28:03 / cg"
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  3442
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  3443
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3444
mergeLine:lineNr removeBlanks:removeBlanks
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3445
    "merge line lineNr with line lineNr+1"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3446
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3447
    |len|
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3448
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3449
    self checkModificationsAllowed ifFalse:[ ^ self].
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3450
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3451
    len := (self listAt:lineNr) size.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3452
    self nonUndoableDo:[
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3453
	self basicMergeLine:lineNr removeBlanks:removeBlanks.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3454
    ].
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3455
    self addUndo:(PasteString new line:lineNr col:len+1 string:(Character cr asString) selected:false).
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3456
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3457
2506
5568d67dbddd Ctrl-8 / Ctrl-9,
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  3458
parenthizeSelectionWith:openingCharacter and:closingCharacter
2505
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  3459
    |newSelectionEnd|
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  3460
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  3461
    self hasSelection ifFalse:[^ self].
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  3462
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  3463
    newSelectionEnd := selectionEndCol.
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  3464
2506
5568d67dbddd Ctrl-8 / Ctrl-9,
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  3465
    (self characterAtLine:selectionStartLine col:selectionStartCol) == openingCharacter ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3466
	(self characterAtLine:selectionEndLine col:selectionEndCol) == closingCharacter ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3467
	    self deleteCharAtLine:selectionEndLine col:selectionEndCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3468
	    newSelectionEnd := newSelectionEnd-1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3469
	].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3470
	self deleteCharAtLine:selectionStartLine col:selectionStartCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3471
	selectionStartLine == selectionEndLine ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3472
	    newSelectionEnd := newSelectionEnd-1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3473
	]
2505
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  3474
    ] ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3475
	self insert:closingCharacter atLine:selectionEndLine col:selectionEndCol+1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3476
	newSelectionEnd := newSelectionEnd+1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3477
	self insert:openingCharacter atLine:selectionStartLine col:selectionStartCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3478
	selectionStartLine == selectionEndLine ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3479
	    newSelectionEnd := newSelectionEnd+1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3480
	]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3481
    ].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3482
    self
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3483
	selectFromLine:selectionStartLine col:selectionStartCol
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3484
	toLine:selectionEndLine col:newSelectionEnd.
2505
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  3485
!
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  3486
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3487
removeTrailingBlankLines
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3488
    "remove all blank lines at end of text"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3489
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3490
    |lastLine "{ Class: SmallInteger }"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3491
     line finished|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3492
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3493
    lastLine := list size.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3494
    finished := false.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3495
    [finished] whileFalse:[
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3496
        (lastLine <= 1) ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3497
            finished := true
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3498
        ] ifFalse:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3499
            line := list at:lastLine.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3500
            line notNil ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3501
                line isBlank ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3502
                    self basicListAt:lastLine put:nil.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3503
                    line := nil
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3504
                ]
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3505
            ].
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3506
            line notNil ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3507
                finished := true
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3508
            ] ifFalse:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3509
                lastLine := lastLine - 1
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3510
            ]
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3511
        ]
118
claus
parents: 105
diff changeset
  3512
    ].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3513
    (lastLine ~~ list size) ifTrue:[
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3514
        list grow:lastLine.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3515
"/        self textChanged
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3516
    ]
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3517
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3518
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3519
replace:aCharacter atLine:lineNr col:colNr
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3520
    "replace a single character at lineNr/colNr"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3521
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3522
    |originalChar|
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3523
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3524
    originalChar := self characterAtLine:lineNr col:colNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3525
    self basicReplace:aCharacter atLine:lineNr col:colNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3526
    self addUndo:(ReplaceCharacters line:lineNr col:colNr character:originalChar info:'replace').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3527
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3528
4713
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3529
replace:patternArg by:replacePatternArg all:all ignoreCase:ignoreCase
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3530
    |pattern replacePattern|
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3531
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3532
    pattern := patternArg string.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3533
    replacePattern := replacePatternArg string.
4630
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3534
    (pattern notEmpty and:[ replacePattern notEmpty ]) ifTrue:[
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3535
        self rememberSearchPattern:pattern.
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3536
        self rememberSearchPattern:replacePattern.
4713
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3537
        LastSearchIgnoredCase := ignoreCase.
4630
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3538
        self
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3539
            undoableDo:[
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3540
                all ifTrue:[
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3541
                    self
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3542
                        replaceString:pattern
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3543
                        to:replacePattern
4713
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3544
                        ignoreCase:ignoreCase
4630
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3545
                ] ifFalse:[
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3546
                    (self selectionAsString notNil
4713
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3547
                        and:[ self selectionAsString sameAs:pattern caseSensitive:ignoreCase not ])
4630
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3548
                            ifTrue:[
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  3549
                                self replaceSelectionBy:replacePattern.
4630
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3550
                                self
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3551
                                    search:pattern
4713
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3552
                                    ignoreCase:ignoreCase
4630
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3553
                                    forward:(lastSearchDirection = #forward).
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3554
                            ].
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3555
                ]
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3556
            ]
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  3557
            info:'Replace'
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3558
    ]
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3559
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3560
    "Created: / 11-07-2006 / 11:19:57 / fm"
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3561
!
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3562
477
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3563
replaceCharAtCursor:aCharacter
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3564
    "replace a single character at cursor-position - advance cursor"
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3565
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3566
    |wasOn|
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3567
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3568
    wasOn := self hideCursor.
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3569
    aCharacter == (Character cr) ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3570
	self cursorReturn
477
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3571
    ] ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3572
	self replace:aCharacter atLine:cursorLine col:cursorCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3573
	self cursorRight.
477
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3574
    ].
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3575
    self makeCursorVisibleAndShowCursor:wasOn.
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3576
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3577
    "Created: 6.3.1996 / 12:27:42 / cg"
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3578
!
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3579
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3580
replaceContentsWith:newContents
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3581
    "replace everything"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3582
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3583
    |originalContents|
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3584
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3585
    originalContents := self contents.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3586
    self contents:newContents keepUndoHistory:true.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3587
    self addUndo:(ReplaceContents text:originalContents info:'replace').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3588
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3589
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  3590
replaceFromCharacterPosition:charPos1 to:charPos2 with:newString
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  3591
    "replace a substring at a character position"
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  3592
4701
fc3e667bcc01 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4700
diff changeset
  3593
    "/ sigh - insert first, to avoid troible due to shifing-in virtual line ends
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  3594
    self insertString:newString atCharacterPosition:charPos1.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  3595
    self deleteFromCharacterPosition:charPos1+newString size to:charPos2+newString size.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  3596
!
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  3597
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3598
replaceLine:lineNr with:newText
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3599
    "replace a line at lineNr"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3600
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3601
    |originalLine|
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3602
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3603
    originalLine := self listAt:lineNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3604
    originalLine isNil ifTrue:[
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3605
	self checkForExistingLine:lineNr
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3606
    ].
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3607
    self list at:lineNr put:newText.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3608
    self addUndo:(ReplaceLine line:lineNr string:originalLine info:'replace').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3609
    self invalidateLine:lineNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3610
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3611
    "Modified: / 12-04-2007 / 09:31:33 / cg"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3612
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3613
1564
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3614
replaceLines:lines withCR:withCr
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3615
    "replace a bunch of lines at cursor position. Cursor
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3616
     is moved behind replacement.
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3617
     If withCr is true, move to the beginning of the next line
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3618
     after the last line"
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3619
1809
111f603c0a1c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1807
diff changeset
  3620
    |line col nLines wasOn|
1564
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3621
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3622
    lines notNil ifTrue:[
4661
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3623
        wasOn := self hideCursor.
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3624
        nLines := lines size.
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3625
        line := cursorLine.
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3626
        col := cursorCol.
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3627
        lines keysAndValuesDo:[:i :l |
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3628
            self replaceString:(l ? '') atLine:line col:col.
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3629
            (i ~~ nLines or:[withCr]) ifTrue:[
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3630
                line := line + 1.
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3631
                col := 1.
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3632
            ] ifFalse:[
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3633
                col := col + (l size).
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3634
            ]
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3635
        ].
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3636
        self cursorLine:line col:col.
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3637
        self makeCursorVisibleAndShowCursor:wasOn.
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3638
        "/ wasOn ifTrue:[self showCursor].
1564
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3639
    ]
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3640
4661
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3641
    "Created: / 18-05-1996 / 15:32:06 / cg"
c029273f7660 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4649
diff changeset
  3642
    "Modified: / 25-07-2013 / 17:00:53 / cg"
1564
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3643
!
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3644
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3645
replaceSelectionBy:something
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3646
    "delete the selection (if any) and insert something, a character or string;
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3647
     leave cursor after insertion"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  3648
4666
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3649
    self replaceSelectionBy:something keepCursor:false select:false
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3650
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3651
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3652
replaceSelectionBy:something keepCursor:keep
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3653
    "delete the selection (if any) and insert something, a character or string;
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3654
     leave cursor after insertion or leave it, depending on keep"
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3655
4666
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3656
    self replaceSelectionBy:something keepCursor:keep select:false
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3657
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3658
    "Modified: 9.10.1996 / 16:14:35 / cg"
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3659
!
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3660
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3661
replaceSelectionBy:something keepCursor:keep select:selectNewText
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3662
    "delete the selection (if any) and insert something, a character or string;
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3663
     leave cursor after insertion or leave it, depending on keep.
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3664
     If selectNewText is true, select the new text; otherwise deselect"
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3665
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3666
    |sel l c selStartLine selStartCol|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3667
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3668
    l := cursorLine.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3669
    c := cursorCol.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3670
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3671
    sel := self selection.
4666
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3672
    sel isNil ifTrue:[
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3673
        selStartLine := l.
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3674
        selStartCol := c.
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3675
    ] ifFalse:[
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3676
        selStartLine := selectionStartLine.
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3677
        selStartCol := selectionStartCol.
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3678
4053
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  3679
        self setLastStringToReplace: sel.
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  3680
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3681
        self deleteSelection.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3682
        replacing := true.
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  3683
        lastReplacementInfo lastReplacement: ''.
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3684
        undoSupport actionInfo:'replace'.
3161
982c2e416728 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3160
diff changeset
  3685
    ].
982c2e416728 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3160
diff changeset
  3686
982c2e416728 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3160
diff changeset
  3687
    something isCharacter ifTrue:[
4051
4fdd00fbdc60 changed:
fm
parents: 4048
diff changeset
  3688
        lastReplacementInfo lastReplacement notNil ifTrue:[
840
b0071cea13fd fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  3689
"/ "XXX - replacing text with spaces ..."
b0071cea13fd fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  3690
"/            (lastReplacement endsWith:Character space) ifTrue:[
4051
4fdd00fbdc60 changed:
fm
parents: 4048
diff changeset
  3691
"/                lastReplacement := lastReplacementInfo lastReplacement copyWithoutLast:1 "copyTo:(lastReplacement size - 1)".
4fdd00fbdc60 changed:
fm
parents: 4048
diff changeset
  3692
"/                lastReplacement := lastReplacementInfo lastReplacement copyWith:something.
4fdd00fbdc60 changed:
fm
parents: 4048
diff changeset
  3693
"/                lastReplacement := lastReplacementInfo lastReplacement copyWith:Character space
840
b0071cea13fd fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  3694
"/            ] ifFalse:[
4051
4fdd00fbdc60 changed:
fm
parents: 4048
diff changeset
  3695
                lastReplacementInfo lastReplacement: (lastReplacementInfo lastReplacement copyWith:something).
840
b0071cea13fd fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  3696
"/            ]
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3697
        ].
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3698
        self isInInsertMode ifTrue:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3699
            self insertCharAtCursor:something
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3700
        ] ifFalse:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3701
            self replaceCharAtCursor:something
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3702
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3703
    ] ifFalse:[
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3704
        something isString ifTrue:[
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  3705
            lastReplacementInfo lastReplacement: something.
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3706
            self isInInsertMode ifTrue:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3707
                self insertStringAtCursor:something
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3708
            ] ifFalse:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3709
                self replaceStringAtCursor:something
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3710
            ]
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3711
        ] ifFalse:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3712
            Transcript showCR:'EditTextView: non String-or-Character in replace'.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3713
        ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3714
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3715
    keep ifTrue:[
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  3716
        self cursorLine:l col:c
4666
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3717
    ].
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3718
    selectNewText ifTrue:[
81e48e442abe class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  3719
        self selectFromLine:selStartLine col:selStartCol toLine:cursorLine col:cursorCol-1
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3720
    ]
477
e7c29649e8ae fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents: 474
diff changeset
  3721
840
b0071cea13fd fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  3722
    "Modified: 9.10.1996 / 16:14:35 / cg"
1564
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3723
!
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3724
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3725
replaceString:aString atLine:lineNr col:colNr
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3726
    "replace multiple characters starting at lineNr/colNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3727
     This is not prepared to encounter special chars (except TAB) in the string."
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3728
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3729
    |originalString|
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3730
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3731
    self checkModificationsAllowed ifFalse:[ ^ self].
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3732
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3733
    originalString := self textFromLine:lineNr col:colNr toLine:lineNr col:colNr+aString size-1.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3734
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3735
    self basicReplaceString:aString atLine:lineNr col:colNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3736
    self addUndo:(ReplaceCharacters line:lineNr col:colNr characters:originalString info:'replace').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3737
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3738
4713
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3739
replaceString:aString to:aNewString ignoreCase:ignoreCase
3549
569d0e4ab5a3 join at cursorposition
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3740
    |continue count|
569d0e4ab5a3 join at cursorposition
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3741
569d0e4ab5a3 join at cursorposition
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3742
    self cursorToTop.
569d0e4ab5a3 join at cursorposition
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3743
    self selectFromBeginning.
569d0e4ab5a3 join at cursorposition
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3744
    count := 0.
569d0e4ab5a3 join at cursorposition
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3745
    continue := true.
569d0e4ab5a3 join at cursorposition
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3746
    [ continue ] whileTrue:[
4713
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3747
        (self selectionAsString notNil
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3748
        and:[ self selectionAsString sameAs:aString caseSensitive:ignoreCase not ])
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3749
            ifTrue:[
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  3750
                self replaceSelectionBy:aNewString.
4713
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3751
                count := count + 1.
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3752
            ].
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3753
        self
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3754
            searchFwd:aString
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3755
            ignoreCase:ignoreCase
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3756
            ifAbsent:[
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3757
                Dialog information:('%1 has been replaced by %2 %3 times' 
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3758
                                    bindWith:aString with:aNewString with:count).
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3759
                continue := false.
e8c9caf13e05 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4707
diff changeset
  3760
            ].
3549
569d0e4ab5a3 join at cursorposition
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3761
    ].
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3762
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3763
    "Created: / 10-07-2006 / 16:42:48 / fm"
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3764
!
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  3765
1564
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3766
replaceStringAtCursor:aString
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3767
    "replace multiple characters at cursor-position - advance cursor"
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3768
1566
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3769
    |wasOn i1 i2|
1564
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3770
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3771
    wasOn := self hideCursor.
1566
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3772
    (aString includes:Character tab) ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3773
	"/ need special care for TAB (to move cursor correctly)
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3774
	i1 := 1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3775
	[i1 ~~ 0] whileTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3776
	    i2 := aString indexOf:Character tab startingAt:i1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3777
	    i2 ~~ 0 ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3778
		i1 ~~ i2 ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3779
		    self replaceString:(aString copyFrom:i1 to:i2-1) atLine:cursorLine col:cursorCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3780
		    self cursorCol:(cursorCol + (i2 - i1)).
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3781
		].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3782
		self replaceTABAtCursor.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3783
		i2 := i2 + 1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3784
	    ] ifFalse:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3785
		self replaceString:(aString copyFrom:i1) atLine:cursorLine col:cursorCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3786
		self cursorCol:(cursorCol + (aString size - i1 + 1)).
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3787
	    ].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3788
	    i1 := i2.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3789
	]
1566
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3790
    ] ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3791
	self replaceString:aString atLine:cursorLine col:cursorCol.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  3792
	self cursorCol:(cursorCol + aString size).
1566
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3793
    ].
1564
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3794
    self makeCursorVisibleAndShowCursor:wasOn.
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3795
04c13358013e renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  3796
    "Created: / 9.6.1998 / 20:33:20 / cg"
1597
5fdcfcedb91c fixed cursor positioning after replaceStringAtCursor.
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3797
    "Modified: / 20.6.1998 / 19:41:02 / cg"
1566
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3798
!
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3799
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3800
replaceTABAtCursor
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3801
    "replace a single character at cursor-position by a TAB character"
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3802
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3803
    |wasOn nextTab|
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3804
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3805
    wasOn := self hideCursor.
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3806
    nextTab := self nextTabAfter:cursorCol.
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3807
    self replaceStringAtCursor:(String new:(nextTab - cursorCol)).
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3808
    self makeCursorVisibleAndShowCursor:wasOn.
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3809
4e37a55bd140 care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
  3810
    "Created: / 12.6.1998 / 21:53:23 / cg"
3890
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3811
!
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3812
4256
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3813
selectWordBeforeCursor
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3814
    "select the word to the left of cursor"
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3815
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3816
    |savCursorLine savCursorCol  beginCol beginLine endCol endLine|
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3817
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3818
    savCursorLine := cursorLine.
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3819
    savCursorCol := cursorCol.
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3820
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3821
    endCol := cursorCol-1.
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3822
    endLine := cursorLine.
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3823
    self cursorToPreviousWord.
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3824
    beginCol := cursorCol.     
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3825
    beginLine := cursorLine.
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3826
    self cursorLine:savCursorLine col:savCursorCol.
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3827
    self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3828
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3829
    "Created: / 14-06-2011 / 14:46:35 / cg"
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3830
!
1e4bdc48136c added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents: 4253
diff changeset
  3831
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3832
splitLine:lineNr before:colNr
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3833
    "split the line linNr before colNr; the right part (from colNr)
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3834
     is cut off and inserted after lineNr; the view is redrawn"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3835
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3836
    self basicSplitLine:lineNr before:colNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3837
    self addUndo:(DeleteRange line1:lineNr col1:colNr line2:lineNr+1 col2:0 info:'split').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3838
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3839
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3840
withoutRedrawAt:lineNr put:aString
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3841
    "replace a line at lineNr"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3842
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3843
    |originalLine|
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3844
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3845
    originalLine := self listAt:lineNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3846
    self addUndo:(ReplaceLine line:lineNr string:originalLine info:'replace').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3847
    super withoutRedrawAt:lineNr put:aString.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3848
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3849
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3850
withoutRedrawInsertLine:aString before:lineNr
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3851
    "insert the argument, aString before line lineNr; the string
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3852
     becomes line lineNr; everything else is moved down; the view
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3853
     is not redrawn"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3854
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3855
    self basicWithoutRedrawInsertLines:{ aString } from:1 to:1 before:lineNr.
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3856
    self addUndo:(DeleteRange line1:lineNr col1:1 line2:lineNr+1 col2:0 info:'insert').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3857
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3858
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3859
withoutRedrawInsertLines:lines from:start to:end before:lineNr
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3860
    "insert a bunch of lines before line lineNr; the view is not redrawn"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3861
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3862
    self basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3863
    self isReadOnly ifFalse:[
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3864
	self addUndo:(DeleteRange line1:lineNr col1:1 line2:lineNr+end-start+1 col2:0 info:'insert').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3865
    ].
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3866
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3867
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3868
withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3869
    "insert aString (which has no crs) at lineNr/colNr"
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3870
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3871
    self basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr.
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3872
    self addUndo:(DeleteRange line1:lineNr col1:colNr line2:lineNr col2:colNr+aString size-1 info:'insert').
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3873
!
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3874
3890
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3875
wrapLines
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3876
    "wrap lines (insert line-break)"
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3877
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3878
    |lineLength answerString string|
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3879
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3880
    self checkModificationsAllowed ifFalse:[ ^ self].
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3881
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3882
    self hasSelection ifFalse:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3883
        self selectLine:cursorLine.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3884
    ].
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3885
    string := self selectionAsString.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3886
    string isEmptyOrNil ifTrue:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3887
        Dialog information:(resources string:'Nothing selected.').
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3888
        ^ self.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3889
    ].
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3890
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3891
    answerString := Dialog request:(resources string:'Line length (wrap after how many chars)?') initialAnswer:80.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3892
    lineLength := Number readFrom:answerString onError:nil.
4388
558b4dbf5648 changed:
Claus Gittinger <cg@exept.de>
parents: 4373
diff changeset
  3893
    lineLength isNil ifTrue:[^ self].
3890
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3894
    lineLength < 1 ifTrue:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3895
        lineLength := 1.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3896
    ].
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3897
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3898
    self
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3899
        undoableDo:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3900
            |inStream line col lineLen lastGoodCol lastStartCol word|
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3901
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3902
            line := selectionStartLine.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3903
            col := selectionStartCol.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3904
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3905
            self cutSelection.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3906
            self cursorLine:line col:col.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3907
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3908
            lastGoodCol := col.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3909
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3910
            inStream := string readStream.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3911
            [ inStream atEnd ] whileFalse:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3912
                [inStream atEnd not and:[inStream peek isSeparator]] whileTrue:[ inStream next ].
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3913
                word := WriteStream on:(String new:10).
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3914
                [inStream atEnd not and:[inStream peek isSeparator not]] whileTrue:[ word nextPut:inStream next ].
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3915
                (col + 1 + word size > lineLength) ifTrue:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3916
                    self insertCharAtCursor:(Character cr).
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3917
                    col := 1.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3918
                ] ifFalse:[
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3919
                    col ~~ 1 ifTrue:[ 
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3920
                        self insertStringAtCursor:' '.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3921
                        col := col + 1.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3922
                    ]    
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3923
               ].
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3924
               self insertStringAtCursor:word contents.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3925
               col := col + word size.
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3926
            ].
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3927
        ]
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  3928
        info:'Wrap'
4388
558b4dbf5648 changed:
Claus Gittinger <cg@exept.de>
parents: 4373
diff changeset
  3929
558b4dbf5648 changed:
Claus Gittinger <cg@exept.de>
parents: 4373
diff changeset
  3930
    "Modified: / 01-03-2012 / 19:56:22 / cg"
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  3931
! !
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  3932
2752
5650a9ab5935 method category rename
Claus Gittinger <cg@exept.de>
parents: 2744
diff changeset
  3933
!EditTextView methodsFor:'editing-basic'!
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  3934
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  3935
basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol
3549
569d0e4ab5a3 join at cursorposition
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3936
    "delete characters from startCol to endCol in line lineNr"
569d0e4ab5a3 join at cursorposition
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3937
1803
ac7cc1b99407 scroll left as required, if deleting characters of the longest line,
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  3938
    |line lineSize newLine start stop prevWidth newWidth|
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  3939
4673
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3940
    self unselect.
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3941
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3942
    cursorLine == lineNr ifTrue:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3943
        cursorCol >= startCol ifTrue:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3944
            cursorCol >= endCol ifTrue:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3945
                cursorCol := startCol.
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3946
            ] ifFalse:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3947
                cursorCol := cursorCol - (endCol - startCol + 1).
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3948
            ]
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3949
        ].
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3950
    ].
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3951
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  3952
    line := self listAt:lineNr.
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  3953
4673
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3954
    (self checkModificationsAllowed and:[line notNil]) ifFalse:[^ self].
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3955
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3956
    lineSize := line size.
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3957
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3958
    startCol == 0 ifFalse:[ start := startCol ] ifTrue:[ start := 1 ].
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3959
    endCol > lineSize ifFalse:[ stop  := endCol ] ifTrue:[ stop  := lineSize ].
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3960
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3961
    stop >= start ifTrue:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3962
        start ~~ 1 ifTrue:[ newLine := line copyFrom:1 to:(start-1) ]
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3963
                  ifFalse:[ newLine := '' ].
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3964
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3965
        stop == lineSize ifFalse:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3966
            line bitsPerCharacter > newLine bitsPerCharacter ifTrue:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3967
                newLine := line string species fromString:newLine.
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  3968
            ].
4673
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3969
            newLine := newLine, (line copyFrom:(stop + 1) to:lineSize)
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3970
        ].
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3971
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3972
        (trimBlankLines and:[newLine isBlank]) ifTrue:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3973
            newLine := nil
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3974
        ].
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3975
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3976
        prevWidth := self widthOfLine:lineNr.
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3977
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  3978
        self basicListAt:lineNr put:newLine.
4673
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3979
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3980
        (prevWidth = widthOfWidestLine) ifTrue:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3981
            "/ remember old width of this line,
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3982
            "/ only clear widthOfWidestLine, if this lines
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3983
            "/ length was (one of) the longest.
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3984
            "/ avoids slow delete with huge texts.
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3985
            widthOfWidestLine := nil.   "i.e. unknown"
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3986
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3987
            "/ scroll left if reqiured
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3988
            viewOrigin x > 0 ifTrue:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3989
                newWidth := self widthOfLine:lineNr.
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3990
                newWidth < (viewOrigin x + width) ifTrue:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3991
                    self scrollHorizontalTo:(newWidth
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3992
                                             - width
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3993
                                             + margin + margin
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3994
                                             + (font widthOf:'  '))
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3995
                ]
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  3996
            ].
4673
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3997
            self textChanged.
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3998
        ] ifFalse:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  3999
            self textChanged "/ textChangedButNoSizeChange
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  4000
        ].
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  4001
        font hasOverlappingCharacters ifTrue:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  4002
            self invalidateLine:lineNr.
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  4003
        ] ifFalse:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  4004
            self redrawLine:lineNr from:start.
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  4005
        ].
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  4006
    ].
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4007
4191
8ac20ced2fbf changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4190
diff changeset
  4008
    "Modified: / 09-11-2010 / 13:42:45 / cg"
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4009
!
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4010
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4011
basicDeleteFromLine:startLineNr toLine:endLineNr
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4012
    "delete some lines"
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4013
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4014
    |wasOn nLines|
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4015
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4016
    self checkModificationsAllowed ifFalse:[ ^ self].
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4017
    list isNil ifTrue:[^ self].
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4018
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4019
    wasOn := self hideCursor.
1717
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4020
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4021
    "/ isnt this the same as:
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4022
    "/ self deleteLinesWithoutRedrawFrom:startLineNr to:endLineNr.
4226
a09775d899a6 changed: #basicDeleteFromLine:toLine:
az
parents: 4225
diff changeset
  4023
    startLineNr <= list size ifTrue:[
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4024
        self basicListRemoveFromIndex:startLineNr toIndex:(endLineNr min:list size).
4226
a09775d899a6 changed: #basicDeleteFromLine:toLine:
az
parents: 4225
diff changeset
  4025
    ].
1717
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4026
    "/ TODO: remember old maxwidth of linerange,
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4027
    "/ only clear widthOfWidestLine, if this max
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4028
    "/ length was (one of) the longest.
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4029
    "/ avoids slow delete with huge texts.
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4030
    widthOfWidestLine := nil. "/ i.e. unknown
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4031
    self textChanged.
1717
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4032
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4033
    self redrawFromLine:startLineNr.
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4034
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4035
    nLines := list size.
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4036
    (firstLineShown >= nLines) ifTrue:[
4226
a09775d899a6 changed: #basicDeleteFromLine:toLine:
az
parents: 4225
diff changeset
  4037
        self makeLineVisible:nLines
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4038
    ].
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4039
    wasOn ifTrue:[self showCursor].
1717
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4040
4226
a09775d899a6 changed: #basicDeleteFromLine:toLine:
az
parents: 4225
diff changeset
  4041
    "Modified: / 10-11-1998 / 23:55:05 / cg"
a09775d899a6 changed: #basicDeleteFromLine:toLine:
az
parents: 4225
diff changeset
  4042
    "Modified: / 18-03-2011 / 18:26:23 / az"
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4043
!
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4044
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4045
basicDeleteLineWithoutRedraw:lineNr
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4046
    "delete line - no redraw;
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4047
     return true, if something was really deleted"
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4048
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4049
    self checkModificationsAllowed ifFalse:[ ^ false].
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4050
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4051
    (list isNil or:[lineNr > list size]) ifTrue:[^ false].
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4052
    list removeIndex:lineNr.
1717
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4053
    "/ TODO: remember old maxwidth of linerange,
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4054
    "/ only clear widthOfWidestLine, if this max
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4055
    "/ length was (one of) the longest.
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4056
    "/ avoids slow delete with huge texts.
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4057
    widthOfWidestLine := nil. "/ i.e. unknown
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4058
    self textChanged.
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4059
    ^ true
1717
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4060
83203096a851 dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  4061
    "Modified: / 10.11.1998 / 23:53:24 / cg"
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4062
!
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4063
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4064
basicInsert:aCharacter atLine:lineNr col:colNr
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  4065
    "insert a single character at lineNr/colNr;
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4066
     set emphasis to character at current position"
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4067
1929
8e70fb7c9701 fixed handling of italic text when inserting
Claus Gittinger <cg@exept.de>
parents: 1928
diff changeset
  4068
    |line lineSize newLine drawCharacterOnly attribute oldClip x y|
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4069
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4070
    self checkModificationsAllowed ifFalse:[ ^ self].
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4071
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4072
    aCharacter == (Character cr) ifTrue:[
4189
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4073
        self splitLine:lineNr before:colNr.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4074
        ^ self
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4075
    ].
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4076
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4077
    drawCharacterOnly := false.
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4078
    self checkForExistingLine:lineNr.
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4079
    line := list at:lineNr.
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4080
    lineSize := line size.
671
f3fe0d8c604d added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  4081
3023
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  4082
    self st80EditMode ifFalse:[
4189
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4083
        (trimBlankLines
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4084
        and:[colNr > lineSize
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4085
        and:[aCharacter == Character space]]) ifTrue:[
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4086
            ^ self
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4087
        ]
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4088
    ].
671
f3fe0d8c604d added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  4089
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4090
    (lineSize == 0) ifTrue:[
4189
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4091
        newLine := aCharacter asString species new:colNr.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4092
        drawCharacterOnly := true
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4093
    ] ifFalse: [
4189
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4094
        (colNr > lineSize) ifTrue: [
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4095
            colNr == (lineSize +1) ifTrue:[
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4096
                attribute := line emphasisAt:lineSize
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4097
            ].
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4098
            newLine := line species new:colNr.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4099
            newLine replaceFrom:1 to:lineSize with:line startingAt:1.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4100
            drawCharacterOnly := true
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4101
        ] ifFalse: [
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4102
            attribute := line emphasisAt:colNr.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4103
            newLine   := line species new:(lineSize + 1).
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4104
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4105
            newLine replaceFrom:1 to:(colNr - 1) with:line startingAt:1.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4106
            newLine replaceFrom:(colNr + 1) to:(lineSize + 1) with:line startingAt:colNr
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4107
        ]
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4108
    ].
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4109
2869
48d830f0aea5 insertCharacter: care for wide chars
Claus Gittinger <cg@exept.de>
parents: 2866
diff changeset
  4110
    aCharacter asString bitsPerCharacter > newLine bitsPerCharacter ifTrue:[
4189
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4111
        newLine := aCharacter asString species fromString:newLine.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4112
        line isText ifTrue:[
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4113
            newLine := newLine asText
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4114
        ]
2869
48d830f0aea5 insertCharacter: care for wide chars
Claus Gittinger <cg@exept.de>
parents: 2866
diff changeset
  4115
    ].
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4116
    newLine at:colNr put:aCharacter.
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4117
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4118
    attribute notNil ifTrue:[
4189
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4119
        newLine emphasisAt:colNr put:attribute.
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4120
    ].
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4121
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4122
    aCharacter == (Character tab) ifTrue:[
4189
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4123
        newLine := self withTabsExpanded:newLine.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4124
        drawCharacterOnly := false
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4125
    ].
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4126
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4127
    self basicListAt:lineNr put:(newLine ifNil:[newLine] ifNotNil:[newLine asSingleByteStringIfPossible]).
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4128
    widthOfWidestLine notNil ifTrue:[
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4129
        widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:newLine).
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4130
    ].
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4131
    self textChanged.
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4132
    shown ifTrue:[
4189
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4133
        "/ care for italic text - in this case, we must also
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4134
        "/ redraw the character before the insertion in order
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4135
        "/ to fix the slanted piece of the character.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4136
        "/ (but we must clip, to avoid destoying the character before)
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4137
        (newLine notNil and:[newLine isText]) ifTrue:[
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4138
            colNr > 1 ifTrue:[
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4139
                cursorVisibleLine notNil ifTrue:[
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4140
                    oldClip := self clippingRectangleOrNil.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4141
                    x := (self xOfCol:colNr-1 inVisibleLine:cursorVisibleLine) - viewOrigin x.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4142
                    y := self yOfVisibleLine:cursorVisibleLine.
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4143
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4144
                    font hasOverlappingCharacters ifTrue:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4145
                        self invalidateLine:lineNr.
4189
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4146
                    ] ifFalse:[
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4147
                        drawCharacterOnly ifTrue:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4148
                            self clippingRectangle:(x@y extent:((font width * 2) @ fontHeight)).
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4149
                            self redrawLine:lineNr from:colNr-1 to:colNr
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4150
                        ] ifFalse:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4151
                            self clippingRectangle:(x@y extent:((width - x) @ fontHeight)).
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4152
                            self redrawLine:lineNr from:colNr-1
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4153
                        ].
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4154
                        self clippingRectangle:oldClip.
4189
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4155
                    ].
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4156
                ].
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4157
                ^ self.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4158
            ].
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4159
        ].
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4160
        font hasOverlappingCharacters ifTrue:[
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4161
            self invalidateLine:lineNr.
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4162
        ] ifFalse:[
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4163
            drawCharacterOnly ifTrue:[
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4164
                self redrawLine:lineNr col:colNr
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4165
            ] ifFalse:[
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4166
                self redrawLine:lineNr from:colNr
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4167
            ]
c9adf30e582a changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
  4168
        ]
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4169
    ]
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4170
4191
8ac20ced2fbf changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4190
diff changeset
  4171
    "Modified: / 09-11-2010 / 13:43:18 / cg"
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4172
!
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4173
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4174
basicListAt:lineNr put:newLine
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4175
    "redefinable for special subclasses (with virtual list)"
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4176
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4177
    list at:lineNr put:newLine.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4178
!
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4179
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4180
basicListRemoveFromIndex:startLineNr toIndex:endLineNr
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4181
    "redefinable for special subclasses (with virtual list)"
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4182
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4183
    list removeFromIndex:startLineNr toIndex:(endLineNr min:list size).
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4184
!
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4185
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4186
basicMergeLine:lineNr removeBlanks:removeBlanks
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  4187
    "merge line lineNr with line lineNr+1"
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  4188
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4189
    |leftPart rightPart bothParts nextLineNr i|
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4190
2356
6416beb0f23a backSpace if behond end of text.
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  4191
    (list notNil and:[(list size) >= lineNr]) ifFalse:[
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4192
        "/ empty list or beyond end of text
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4193
        ^ self
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4194
    ].
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4195
    leftPart := self listAt:lineNr.
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4196
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4197
    leftPart isNil ifTrue:[
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4198
        leftPart := ''.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4199
        autoIndent ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4200
            (i := self leftIndentForLine:cursorLine) == 0 ifFalse:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4201
                leftPart := String new:i
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4202
            ]
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4203
        ]
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4204
    ].
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4205
    self cursorLine:lineNr col:((leftPart size) + 1).
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4206
    nextLineNr := self validateCursorLine:(lineNr + 1).
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4207
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  4208
    nextLineNr > (list size) ifFalse:[
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4209
        (rightPart := self listAt:nextLineNr) isNil ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4210
            rightPart := ''
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4211
        ] ifFalse:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4212
            removeBlanks ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4213
                rightPart := rightPart withoutLeadingSeparators.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4214
            ]
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4215
        ].
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4216
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4217
        bothParts := leftPart , rightPart.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4218
        (trimBlankLines and:[bothParts isBlank]) ifTrue:[bothParts := nil].
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4219
        self basicListAt:lineNr put:bothParts.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4220
        self redrawLine:lineNr.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4221
        self deleteLine:nextLineNr
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4222
    ]
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4223
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  4224
    "Created: 9.9.1997 / 09:27:38 / cg"
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  4225
    "Modified: 9.9.1997 / 09:28:27 / cg"
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4226
!
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4227
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4228
basicReplace:aCharacter atLine:lineNr col:colNr
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4229
    "replace a single character at lineNr/colNr"
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4230
1558
abf35cc39757 minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4231
    |line lineSize newLine drawCharacterOnly|
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4232
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4233
    self checkModificationsAllowed ifFalse:[ ^ self].
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4234
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4235
    aCharacter == (Character cr) ifTrue:[
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4236
        ^ self
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4237
    ].
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4238
1558
abf35cc39757 minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4239
    drawCharacterOnly := true.
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4240
    self checkForExistingLine:lineNr.
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4241
    line := list at:lineNr.
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4242
    lineSize := line size.
671
f3fe0d8c604d added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  4243
f3fe0d8c604d added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  4244
    (trimBlankLines
f3fe0d8c604d added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  4245
    and:[colNr > lineSize
f3fe0d8c604d added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  4246
    and:[aCharacter == Character space]]) ifTrue:[
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4247
        ^ self
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4248
    ].
671
f3fe0d8c604d added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  4249
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4250
    (lineSize == 0) ifTrue:[
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4251
        newLine := aCharacter asString species new:colNr.
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4252
    ] ifFalse: [
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4253
        (colNr > lineSize) ifTrue: [
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4254
            newLine := line species new:colNr.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4255
            newLine replaceFrom:1 to:lineSize with:line startingAt:1.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4256
        ] ifFalse: [
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4257
            newLine := line copy.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4258
        ]
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4259
    ].
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4260
    newLine at:colNr put:aCharacter.
1558
abf35cc39757 minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4261
    aCharacter == (Character tab) ifTrue:[
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4262
        newLine := self withTabsExpanded:newLine.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4263
        drawCharacterOnly := false
1558
abf35cc39757 minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4264
    ].
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4265
    self basicListAt:lineNr put:(newLine ifNil:[newLine] ifNotNil:[newLine asSingleByteStringIfPossible]).
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4266
    widthOfWidestLine notNil ifTrue:[
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4267
        widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:newLine).
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4268
    ].
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4269
    self textChanged.
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4270
    shown ifTrue:[
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4271
        font hasOverlappingCharacters ifTrue:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4272
            self invalidateLine:lineNr.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4273
        ] ifFalse:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4274
            drawCharacterOnly ifTrue:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4275
                self redrawLine:lineNr col:colNr
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4276
            ] ifFalse:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4277
                self redrawLine:lineNr from:colNr
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4278
            ]
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4279
        ]
629
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4280
    ]
cf0a3ab9b9f1 Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents: 606
diff changeset
  4281
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4282
    "Created: / 06-03-1996 / 12:29:20 / cg"
4191
8ac20ced2fbf changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4190
diff changeset
  4283
    "Modified: / 09-11-2010 / 13:42:54 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  4284
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  4285
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4286
basicReplaceString:aString atLine:lineNr col:colNr
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4287
    "replace multiple characters starting at lineNr/colNr.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4288
     This is not prepared to encounter special chars (except TAB)
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4289
     in the string."
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4290
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4291
    |line lineSize newLine endCol|
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4292
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4293
    self checkModificationsAllowed ifFalse:[ ^ self].
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4294
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4295
    self checkForExistingLine:lineNr.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4296
    line := list at:lineNr.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4297
    lineSize := line size.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4298
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4299
    endCol := colNr + aString size - 1.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4300
    (lineSize == 0) ifTrue:[
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4301
        newLine := aString species new:endCol.
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4302
    ] ifFalse: [
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4303
        (endCol > lineSize) ifTrue: [
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4304
            aString isText ifTrue:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4305
                newLine := aString species new:endCol.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4306
            ] ifFalse:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4307
                newLine := line species new:endCol.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4308
            ].
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4309
            newLine replaceFrom:1 to:lineSize with:line startingAt:1.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4310
        ] ifFalse: [
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4311
            aString isText ifTrue:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4312
                newLine := aString species new:line size.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4313
                newLine replaceFrom:1 to:lineSize with:line startingAt:1.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4314
            ] ifFalse:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4315
                newLine := line copy.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4316
            ]
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4317
        ]
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4318
    ].
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4319
    newLine replaceFrom:colNr with:aString.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4320
    (aString includes:(Character tab)) ifTrue:[
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4321
        newLine := self withTabsExpanded:newLine.
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4322
    ].
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4323
    self basicListAt:lineNr put:(newLine ifNil:[newLine] ifNotNil:[newLine asSingleByteStringIfPossible]).
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4324
    widthOfWidestLine notNil ifTrue:[
4458
f3421ef26d82 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4325
        widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:newLine).
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4326
    ].
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4327
    self textChanged.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4328
    shown ifTrue:[
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4329
        font hasOverlappingCharacters ifTrue:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4330
            self invalidateLine:lineNr.
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4331
        ] ifFalse:[
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4332
            self redrawLine:lineNr from:colNr
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4333
        ]
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4334
    ]
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4335
4190
d79217c1317d changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4189
diff changeset
  4336
    "Created: / 11-06-1998 / 10:38:32 / cg"
4191
8ac20ced2fbf changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 4190
diff changeset
  4337
    "Modified: / 09-11-2010 / 13:42:56 / cg"
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4338
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4339
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4340
basicSplitLine:lineNr before:colNr
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4341
    "split the line linNr before colNr; the right part (from colNr)
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4342
     is cut off and inserted after lineNr; the view is redrawn"
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4343
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  4344
    |line lineSize leftRest rightRest visLine w h mustWait
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4345
     srcY    "{ Class: SmallInteger }" |
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4346
3027
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4347
    list isNil ifTrue:[ ^ self ].
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4348
    lineNr > (list size) ifTrue:[ ^ self ].
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4349
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4350
    (colNr == 1) ifTrue:[
4199
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4351
        self nonUndoableDo:[
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4352
            self insertLine:nil before:lineNr.
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4353
        ].
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4354
        ^ self
3027
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4355
    ].
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4356
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4357
    line := list at:lineNr.
4199
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4358
    line notNil ifTrue:[
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4359
        lineSize := line size.
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4360
        (colNr <= lineSize) ifTrue:[
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4361
            rightRest := line copyFrom:colNr to:lineSize.
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4362
            (colNr > 1) ifTrue:[
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4363
                leftRest := line copyTo:(colNr - 1)
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4364
            ]
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4365
        ] ifFalse:[
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4366
            leftRest := line
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4367
        ]
3027
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4368
    ].
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4369
    leftRest notNil ifTrue:[
4199
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4370
        (trimBlankLines and:[leftRest isBlank]) ifTrue:[leftRest := nil]
3027
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4371
    ].
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4372
    self basicListAt:lineNr put:leftRest.
3027
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4373
    self nonUndoableDo:[
4199
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4374
        self withoutRedrawInsertLine:rightRest before:(lineNr + 1).
3027
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4375
    ].
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4376
    visLine := self listLineToVisibleLine:(lineNr).
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4377
    visLine notNil ifTrue:[
4199
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4378
        w := self widthForScrollBetween:lineNr
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4379
                                    and:(firstLineShown + nLinesShown).
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4380
        srcY := topMargin + (visLine * fontHeight).
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4381
        h := ((nLinesShown - visLine - 1) * fontHeight).
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4382
        (mustWait := (w > 0 and:[h > 0])) ifTrue:[
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4383
            self catchExpose.
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4384
            self
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4385
                copyFrom:self
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4386
                x:textStartLeft y:srcY
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4387
                toX:textStartLeft y:(srcY + fontHeight)
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4388
                width:w
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4389
                height:((nLinesShown - visLine - 1) * fontHeight)
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4390
                async:true.
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4391
        ].
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4392
        self redrawLine:lineNr.
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4393
        self redrawLine:(lineNr + 1).
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4394
        mustWait ifTrue:[self waitForExpose]
3027
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4395
    ].
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4396
    widthOfWidestLine := nil. "/ unknown
0dd9657b8033 *** empty log message ***
ca
parents: 3024
diff changeset
  4397
    self textChanged.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4398
4199
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  4399
    "Modified: / 06-12-2010 / 13:12:55 / cg"
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4400
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4401
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4402
basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4403
    "insert a bunch of lines before line lineNr; the view is not redrawn.
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4404
     Tabs are expanded here with a tab=8 setting (independent of any editor-setting,
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4405
     because the text might have been pasted from an alien view."
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4406
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4407
    |newLine newLines nLines|
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4408
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4409
    nLines := end - start + 1.
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4410
    newLines := Array new:(lines size).
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4411
    start to:end do:[:index |
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4412
        newLine := lines at:index.
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4413
        newLine notNil ifTrue:[
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4414
            newLine isString ifTrue:[
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4415
                newLine isBlank ifTrue:[
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4416
                    newLine := nil
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4417
                ] ifFalse:[
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4418
                    (newLine includes:(Character tab)) ifTrue:[
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4419
                        newLine := self withTabs:(ListView tab8Positions) expand:newLine
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4420
                    ]
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4421
                ]
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4422
            ]
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4423
        ].
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4424
        newLines at:index put:newLine
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4425
    ].
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4426
    list isNil ifTrue: [
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4427
        list := StringCollection new:(lineNr + nLines + 1)
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4428
    ] ifFalse: [
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4429
        list grow:((list size + nLines) max:(lineNr + nLines - 1))
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  4430
    ].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  4431
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  4432
    "I have changed 'replaceFrom:to:with:startingAt:' to correctly handle
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4433
     overlapping copy - if it didn't, we had to use:"
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4434
"
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4435
    index := list size.
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4436
    [index > lineNr] whileTrue: [
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4437
        pIndex := index - 1.
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4438
        list at:index put:(list at:pIndex).
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4439
        index := pIndex
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4440
    ].
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4441
"
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4442
    list replaceFrom:(lineNr + nLines) to:(list size) with:list startingAt:lineNr.
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4443
    list replaceFrom:lineNr to:(lineNr + nLines - 1) with:newLines startingAt:start.
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4444
    self contentsChanged
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4445
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4446
    "Modified: / 07-10-2011 / 15:55:18 / cg"
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4447
!
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4448
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4449
basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4450
    "insert aString (which has no crs) at lineNr/colNr.
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4451
     Tabs are expanded here with a tab=8 setting (independent of any editor-setting,
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4452
     because the text might have been pasted from an alien view."
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4453
4360
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  4454
    |isText strLen line lineSize newLine stringType sz lineCharWidth stringCharWidth|
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4455
4623
22047f737cb0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4609
diff changeset
  4456
    (aString isNil) ifTrue:[ ^ self].
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4457
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4458
    strLen := aString size.
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4459
    self checkForExistingLine:lineNr.
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4460
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4461
    stringType := aString string species.
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4462
    isText     := aString isText.
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4463
    line       := list at:lineNr.
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4464
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4465
    line notNil ifTrue:[
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4466
        lineSize := line size.
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4467
        line isString ifFalse:[
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4468
            stringType := line species
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4469
        ] ifTrue:[
4360
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  4470
            lineCharWidth := line bitsPerCharacter.
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  4471
            stringCharWidth := aString bitsPerCharacter.
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  4472
            lineCharWidth > stringCharWidth ifTrue:[
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4473
                stringType := line string species
4360
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  4474
            ] ifFalse:[
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  4475
                stringCharWidth > lineCharWidth ifTrue:[
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  4476
                    stringType := aString string species
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  4477
                ]
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4478
            ].
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4479
            line isText ifTrue:[ isText := true ]
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4480
        ].
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4481
    ] ifFalse:[
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4482
        lineSize := 0
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4483
    ].
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4484
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4485
    ((colNr == 1) and:[lineSize == 0]) ifTrue: [
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4486
        newLine := aString
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4487
    ] ifFalse:[
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4488
        (lineSize == 0 or:[colNr > lineSize]) ifTrue: [
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4489
            sz := colNr + strLen - 1
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4490
        ] ifFalse:[
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4491
            sz := lineSize + strLen
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4492
        ].
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4493
4360
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  4494
        newLine := stringType new:sz.
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  4495
        isText ifTrue:[
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  4496
            newLine := Text string:newLine
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4497
        ].
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4498
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4499
        (lineSize ~~ 0) ifTrue: [
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4500
            (colNr > lineSize) ifTrue: [
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4501
                newLine replaceFrom:1 to:lineSize with:line startingAt:1
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4502
            ] ifFalse: [
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4503
                newLine replaceFrom:1 to:(colNr - 1) with:line startingAt:1.
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4504
                newLine replaceFrom:(colNr + strLen) to:(lineSize + strLen) with:line startingAt:colNr
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4505
            ]
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4506
        ].
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4507
        newLine replaceFrom:(colNr max:1) to:(colNr + strLen - 1) with:aString startingAt:1
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4508
    ].
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4509
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4510
    (aString includes:(Character tab)) ifTrue:[
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4511
        newLine := self withTabs:(ListView tab8Positions) expand:newLine
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4512
    ].
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4513
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  4514
    self basicListAt:lineNr put:(newLine ifNil:[newLine] ifNotNil:[newLine asSingleByteStringIfPossible]).
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4515
    widthOfWidestLine notNil ifTrue:[
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  4516
        widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:newLine).
2954
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4517
    ].
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4518
    self textChanged.
65a518fe6eb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2952
diff changeset
  4519
4360
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  4520
    "Modified: / 25-01-2012 / 00:37:29 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4521
! !
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4522
2752
5650a9ab5935 method category rename
Claus Gittinger <cg@exept.de>
parents: 2744
diff changeset
  4523
!EditTextView methodsFor:'event handling'!
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4524
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4525
buttonPress:button x:x y:y
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4526
    "hide the cursor when button is activated"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4527
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4528
    hasKeyboardFocus := true.
2589
62794ae04446 support drop
ca
parents: 2580
diff changeset
  4529
    dragIsActive := false.
62794ae04446 support drop
ca
parents: 2580
diff changeset
  4530
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  4531
    completionSupport notNil ifTrue:[ 
4696
428c8bc44cfb refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4694
diff changeset
  4532
        "/ also give that guy a chance to close its popup view
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  4533
        completionSupport buttonPress:button x:x y:y
4696
428c8bc44cfb refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4694
diff changeset
  4534
    ].
4609
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  4535
1817
1a9e22f755c8 show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
  4536
    cursorShown ifTrue: [
3915
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4537
        self drawCursor
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4538
    ].
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4539
4420
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4540
    "On X11, be nice and paste PRIMARY when middle click. 
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4541
     Note, that middle button on X11 is translated to button
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4542
     128 in Smalltalk/X - see XWorkstation class>>initializeConstants"
4421
06727bd6c8e8 Make paste button symbolic
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4420
diff changeset
  4543
    (button == #paste and:[device platformName == #X11]) ifTrue:[
4420
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4544
        self undoableDo:[
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4545
            self paste: (self getClipboardText:#selection).
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4546
        ].
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4547
        ^self.
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4548
    ].
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4549
3915
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4550
    (button == 1) ifTrue:[
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4551
        self hideCursor
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4552
    ].
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4553
"/ some very old code from times, when a right-click was a paste in X11
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4554
"/
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4555
"/    (button == #paste) ifTrue:[
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4556
"/        self pasteOrReplace.
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4557
"/        ^ self
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4558
"/    ].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4559
    super buttonPress:button x:x y:y
1817
1a9e22f755c8 show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents: 1816
diff changeset
  4560
4420
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4561
    "Modified: / 23-03-1999 / 13:51:40 / cg"
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4562
    "Modified (comment): / 17-04-2012 / 21:02:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
121
claus
parents: 118
diff changeset
  4563
!
claus
parents: 118
diff changeset
  4564
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4565
buttonRelease:button x:x y:y
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4566
    "move the cursor to the click-position of previous button press"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4567
3789
a9b4805e0754 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
  4568
    |x1 x2 x2_3 newCursorCol|
3788
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4569
3915
737e276852c8 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3907
diff changeset
  4570
    (button == 1) ifTrue:[
3788
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4571
        typeOfSelection := nil.
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4572
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4573
        dragIsActive ifTrue:[
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4574
            self unselect
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4575
        ].
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4576
        selectionStartLine isNil ifTrue:[
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4577
            clickCol notNil ifTrue:[
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4578
                self cursorMovementAllowed ifTrue:[
3789
a9b4805e0754 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
  4579
                    newCursorCol := clickCol.
a9b4805e0754 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
  4580
a9b4805e0754 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
  4581
                    cursorType ~~ #block ifTrue:[
3790
7f4d267cf342 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3789
diff changeset
  4582
                        clickPos notNil ifTrue:[
7f4d267cf342 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3789
diff changeset
  4583
                            "/ we do something special, if the text-cursor's type is not a block-cursor
7f4d267cf342 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3789
diff changeset
  4584
                            "/ (i.e. if its an ibeam).
7f4d267cf342 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3789
diff changeset
  4585
                            "/ adjust clickCol if the user clicked in the right third of a character.
7f4d267cf342 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3789
diff changeset
  4586
                            x1 := self xOfCol:clickCol inVisibleLine:clickLine.  
7f4d267cf342 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3789
diff changeset
  4587
                            x2 := self xOfCol:clickCol+1 inVisibleLine:clickLine.
7f4d267cf342 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3789
diff changeset
  4588
                            x2_3 := x1 + ((x2-x1) * (2/3)).
7f4d267cf342 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3789
diff changeset
  4589
                            (clickPos x >= x2_3) ifTrue:[ newCursorCol := clickCol+1 ].
7f4d267cf342 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3789
diff changeset
  4590
                        ].
3789
a9b4805e0754 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
  4591
                    ].
a9b4805e0754 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3788
diff changeset
  4592
                    self cursorLine:clickLine col:newCursorCol.
4394
c3cabdc1f4cc changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4388
diff changeset
  4593
                ].
c3cabdc1f4cc changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4388
diff changeset
  4594
                true "self hadSelectionBeforeClick not" ifTrue:[
4396
7820ce5cac3d changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4394
diff changeset
  4595
                    list notEmptyOrNil ifTrue:[
7820ce5cac3d changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4394
diff changeset
  4596
                        UserPreferences current selectAllWhenClickingBeyondEnd ifTrue:[
7820ce5cac3d changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4394
diff changeset
  4597
                            (clickLine >= list size) ifTrue:[
7820ce5cac3d changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4394
diff changeset
  4598
                                (clickLine > (self list size + 2) 
7820ce5cac3d changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4394
diff changeset
  4599
                                or:[ clickCol > (list last size + 5) ]) ifTrue:[
7820ce5cac3d changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4394
diff changeset
  4600
                                    self selectAll
7820ce5cac3d changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4394
diff changeset
  4601
                                ].
4394
c3cabdc1f4cc changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4388
diff changeset
  4602
                            ].
4396
7820ce5cac3d changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4394
diff changeset
  4603
                        ]
4394
c3cabdc1f4cc changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4388
diff changeset
  4604
                    ]
3788
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4605
                ]
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4606
            ]
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4607
        ] ifFalse:[
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  4608
            lastStringFromReplaceForNextSearch := nil.  "new selection invalidates remembered string"
3788
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4609
        ].
b72271bf0bc2 when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents: 3786
diff changeset
  4610
        self showCursor
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4611
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4612
    super buttonRelease:button x:x y:y
1580
d30e562bea15 allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  4613
4396
7820ce5cac3d changed: #buttonRelease:x:y:
Claus Gittinger <cg@exept.de>
parents: 4394
diff changeset
  4614
    "Modified: / 07-03-2012 / 18:48:37 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4615
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4616
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  4617
cursorKeyPress:key shifted:shifted
4492
088b5fba29d0 changed: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  4618
    <resource: #keyboard (#CursorRight #CursorDown #CursorUp #CursorDown)>
088b5fba29d0 changed: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  4619
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4620
    | n oldTypeOfSelection |
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4621
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4622
    oldTypeOfSelection := typeOfSelection.
2730
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2725
diff changeset
  4623
2606
6a3ab90d339f redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents: 2599
diff changeset
  4624
    self changeTypeOfSelectionTo:nil.
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  4625
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  4626
    (key == #CursorRight) ifTrue:[
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4627
        (shifted and:[selectionStartLine isNil]) ifTrue:[
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4628
            selectionStartLine := selectionEndLine := clickStartLine := cursorLine.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4629
            selectionStartCol := selectionEndCol := clickStartCol := cursorCol.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4630
            cursorCol := cursorCol + 1.
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4631
            expandingTop := false.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4632
            self validateNewSelection.
4420
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4633
            self setPrimarySelection.
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4634
            self selectionChanged.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4635
            self redrawLine:selectionStartLine.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4636
            ^ self.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4637
        ].
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4638
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4639
        self cursorMovementAllowed ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4640
            shifted ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4641
                self addToSelectionAfter:[ self cursorRight ]
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4642
            ] ifFalse:[
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4643
                "/ Compensate for Claus paste-cursordown-paste feature.
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4644
                "/ Right after paste the cursor is at the beginning of the
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4645
                "/ selection. But if immediately after paste user moves cursor right
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4646
                "/ (but without shift!!!!!!), she probably wants to move past the 
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4647
                "/ pasted text, not into it. This is how every other editor behaves.
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4648
                oldTypeOfSelection == #paste ifTrue:[
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4649
                    cursorLine := selectionEndLine.
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4650
                    cursorCol := selectionEndCol + 1.
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4651
                ].
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4652
                self unselect; makeCursorVisible.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4653
                self cursorRight.
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4654
            ].
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4655
        ].
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4656
        ^ self
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  4657
    ].
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  4658
    (key == #CursorDown) ifTrue:[
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4659
        (shifted and:[selectionStartLine isNil]) ifTrue:[
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4660
            selectionStartLine := clickStartLine := cursorLine. selectionEndLine := cursorLine + 1.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4661
            selectionStartCol := clickStartCol := cursorCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4662
            selectionEndCol := cursorCol - 1.
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4663
            selectionEndCol == 1 ifTrue:[
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4664
                selectionEndCol := 0.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4665
            ].
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4666
            self setCursorLine: cursorLine + 1.
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4667
            self validateNewSelection.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4668
            self selectionChanged.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4669
            self redrawLine:selectionStartLine.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4670
            expandingTop := false.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4671
            self redrawLine:selectionEndLine.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4672
            ^ self
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4673
        ].
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4674
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4675
        selectionStartLine notNil ifTrue:[
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4676
            self cursorMovementAllowed ifTrue:[
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4677
                "/
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4678
                "/ treat the whole selection as cursor
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4679
                "/
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4680
"/                self setCursorLine:(selectionEndLine ? selectionStartLine).
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4681
"/                self setCursorCol:selectionStartCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4682
"/                (cursorCol == 0 or:[selectionEndCol == 0]) ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4683
"/                    self setCursorCol:1.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4684
"/                    self setCursorLine:(cursorLine - 1).
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4685
"/                ].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4686
"/                self makeCursorVisible.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4687
"/
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4688
"/                shifted ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4689
"/                    clickLine := cursorLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4690
"/                    clickCol := cursorCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4691
"/                    self setCursorLine: cursorLine + 1.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4692
"/                    self expandSelectionDown.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4693
"/                    ^ self
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4694
"/                ].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4695
"/                self unselect.
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4696
            ].
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4697
        ].
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4698
        self cursorMovementAllowed ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4699
            n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorDown).
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4700
            shifted ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4701
                self addToSelectionAfter:[ self cursorDown:n ]
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4702
            ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4703
                self unselect; makeCursorVisible.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4704
                self cursorDown:n.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4705
            ].  
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4706
            "/
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4707
            "/ flush keyboard to avoid runaway cursor
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4708
            "/
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4709
            self sensor flushKeyboardFor:self.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4710
        ].
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4711
        ^ self
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  4712
    ].
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  4713
    (key == #CursorLeft or:[key == #CursorUp]) ifTrue:[
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4714
        (shifted and:[selectionStartLine isNil]) ifTrue:[
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4715
            expandingTop := true.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4716
            key == #CursorLeft ifTrue:[
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4717
                cursorCol > 1 ifTrue:[
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4718
                    selectionStartLine := selectionEndLine := clickStartLine := cursorLine.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4719
                    selectionEndCol := clickStartCol := cursorCol-1.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4720
                    selectionStartCol := cursorCol-1.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4721
                    self setCursorCol: cursorCol-1.
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4722
                    self validateNewSelection.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4723
                    self selectionChanged.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4724
                    self redrawLine:selectionStartLine.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4725
                    ^ self
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4726
                ]
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4727
            ] ifFalse:[
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4728
                cursorLine > 1 ifTrue:[
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4729
                    selectionEndLine := clickStartLine := cursorLine.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4730
                    selectionStartCol := clickStartCol := cursorCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4731
                    selectionEndCol := cursorCol - 1.
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4732
                    selectionStartLine := cursorLine - 1.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4733
                    selectionEndCol == 1 ifTrue:[
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4734
                        selectionEndCol := 0.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4735
                    ].
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4736
                    self validateNewSelection.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4737
                    self selectionChanged.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4738
                    self redrawFromLine:selectionStartLine to:cursorLine.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4739
                    self setCursorLine: cursorLine - 1.  
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4740
                    ^ self
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4741
                ]
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4742
            ]
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4743
        ].
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4744
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4745
        self hasSelection ifTrue:[
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4746
            self cursorMovementAllowed ifTrue:[
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4747
                "/
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4748
                "/ treat the whole selection as cursor
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4749
                "/
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4750
"/                self setCursorLine:selectionStartLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4751
"/                self setCursorCol:selectionStartCol.
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4752
                self makeCursorVisible.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4753
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4754
"/                shifted ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4755
"/                    self unselect.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4756
"/                ]
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4757
            ].
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4758
        ].
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4759
        (key == #CursorLeft) ifTrue:[
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4760
            shifted ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4761
                self addToSelectionAfter:[self cursorLeft].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4762
            ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4763
                self unselect; makeCursorVisible.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4764
                self cursorLeft. 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4765
            ].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4766
            ^self
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4767
        ].
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4768
        (key == #CursorUp) ifTrue:[
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4769
            n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorUp).
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4770
            shifted ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4771
                self addToSelectionAfter: [ self cursorUp:n ]
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4772
            ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4773
                self unselect; makeCursorVisible.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4774
                self cursorUp:n.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4775
            ].
4100
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4776
            "/
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4777
            "/ flush keyboard to avoid runaway cursor
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4778
            "/
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4779
            self sensor flushKeyboardFor:self.
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4780
            ^ self
3fbb7392a6e1 changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents: 4097
diff changeset
  4781
        ].
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  4782
    ].
4420
8f0164295ef8 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4414
diff changeset
  4783
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  4784
    "Modified: / 30-08-2013 / 00:16:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  4785
!
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  4786
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  4787
doKeyPress:key x:x y:y
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4788
    "handle keyboard input"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4789
4521
0b6740e2d1a7 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4494
diff changeset
  4790
    <resource: #keyboard (#Paste #Insert #PasteFromHistory #Cut #Again #AgainForAll
3781
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4791
                          #Replace #Undo #Redo #Accept
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4792
                          #Delete #BasicDelete #BackSpace #BasicBackspace
4707
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  4793
                          #DeleteSpaces #Join
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4794
                          #SearchMatchingParent #SelectMatchingParents
4707
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  4795
                          #SelectWord #ExpandSelectionByWord
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4796
                          #SelectToEnd #SelectFromBeginning
4707
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  4797
                          #SelectLine #ExpandSelectionByLine
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4798
                          #BeginOfLine #EndOfLine #NextWord #PreviousWord
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4799
                          #CursorRight #CursorDown #CursorLeft #CursorUp
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4800
                          #Return #Tab #BackTab #NonInsertingTab #Escape
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4801
                          #GotoLine #BeginOfText #EndOfText
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4802
                          #InsertLine #DeleteLine
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4803
                          #SelectLineFromBeginning
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4804
                          #LearnKeyboardMacro #ExecuteKeyboardMacro #ToggleInsertMode
4162
9c80c8f4ba45 changed:
Claus Gittinger <cg@exept.de>
parents: 4143
diff changeset
  4805
                          #OpenSpecialCharacterWindow
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4806
                          #'F*' #'f*')>
2017
5d4bf15e09f5 simple (naive) undo
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  4807
4730
1f84a8cfec4e class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4728
diff changeset
  4808
    |fKeyMacros shiftPressed ctrlPressed i event macroName
1f84a8cfec4e class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4728
diff changeset
  4809
     immediateCompletion|
2184
fb634dc3e606 learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  4810
4701
fc3e667bcc01 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4700
diff changeset
  4811
    "/ experimental
4730
1f84a8cfec4e class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4728
diff changeset
  4812
    immediateCompletion := UserPreferences current immediateCodeCompletion.
4738
f59a81d925c9 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4731
diff changeset
  4813
    (immediateCompletion 
f59a81d925c9 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4731
diff changeset
  4814
    or:[UserPreferences current codeCompletionOnControlKey
f59a81d925c9 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4731
diff changeset
  4815
    or:[UserPreferences current codeCompletionOnTabKey]]) ifTrue:[
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  4816
        completionSupport isNil ifTrue:[
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  4817
            self initializeCompletionSupport.
4609
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  4818
        ].
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  4819
    ].
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  4820
    "/ JV: why setting it to nil here?
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  4821
"/    ifFalse:[
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  4822
"/        completionService := nil
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  4823
"/    ].
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  4824
    completionSupport notNil ifTrue:[
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  4825
        (completionSupport handleKeyPress:key x:x y:y) ifTrue:["eaten" ^ self].
4696
428c8bc44cfb refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4694
diff changeset
  4826
    ].
428c8bc44cfb refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4694
diff changeset
  4827
3793
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  4828
    (key == #LearnKeyboardMacro) ifTrue:[
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  4829
        self toggleLearnMode.
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  4830
        ^ self
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  4831
    ].
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  4832
    (key == #ExecuteKeyboardMacro) ifTrue:[
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  4833
        self executeLearnedKeyboardMacro.
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  4834
        ^ self.
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  4835
    ].
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4836
    (key == #Undo) ifTrue:[self undo. ^self].
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4837
    (key == #Redo) ifTrue:[self redo. ^self].
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4838
3793
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  4839
    self learnMode ifTrue:[
4482
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4840
        event := WindowGroup lastEventQuerySignal query.
3793
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  4841
        learnedMacro add:event.
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  4842
    ].
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  4843
4238
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  4844
    (self executekeyboardMacroNamed:key) ifTrue:[
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  4845
        "the macro named key exists"
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4846
        ^ self
2416
56acdd9e31b5 lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents: 2406
diff changeset
  4847
    ].
56acdd9e31b5 lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents: 2406
diff changeset
  4848
4482
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4849
    key isSymbol ifFalse:[
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4850
        "the usual case: key is a character, but maybe a string also (in X11)"
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4851
        self handleNonCommandKey:key.
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4852
        ^ self
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4853
    ].
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4854
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4855
    event isNil ifTrue:[
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4856
        event := WindowGroup lastEventQuerySignal query.
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4857
    ].
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4858
    shiftPressed := event hasShift.
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4859
    ctrlPressed := event hasCtrl and:[(event rawKey asString startsWith:'Ctrl') not].
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  4860
4253
adea55ecdb57 changed: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
  4861
    (key == #DeleteWordBeforeCursor) ifTrue:[
adea55ecdb57 changed: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
  4862
        self deleteWordBeforeCursor.
adea55ecdb57 changed: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
  4863
        ^ self.
adea55ecdb57 changed: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
  4864
    ].
adea55ecdb57 changed: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
  4865
3257
628e1e05814d shift-Tab fix.
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
  4866
    (key == #BackSpace or:[key == #BasicBackspace]) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4867
        selectionStartLine notNil ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4868
            ((key == #BasicBackspace)
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4869
            or:[ UserPreferences current deleteSetsClipboardText not ])
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4870
            ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4871
                self deleteSelection.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4872
            ] ifFalse: [
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4873
                self copyAndDeleteSelection.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4874
            ].
4609
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  4875
        ] ifFalse:[
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  4876
            self makeCursorVisible.
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  4877
"/          (shiftPressed and:[ ctrlPressed ]) ifTrue:[
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  4878
"/            self deleteWordBeforeCursor.
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  4879
"/          ] ifFalse:[
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  4880
            self deleteCharBeforeCursor.
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  4881
"/          ].
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4882
        ].
4738
f59a81d925c9 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4731
diff changeset
  4883
        true "immediateCompletion" ifTrue:[ 
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  4884
            completionSupport notNil ifTrue:[ completionSupport postKeyPress:key].
4731
e3da3340744b class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4730
diff changeset
  4885
        ].
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4886
        ^ self
2205
230cf9cef6c3 searchPatter, if from selection (escape meta characters)
Claus Gittinger <cg@exept.de>
parents: 2196
diff changeset
  4887
    ].
2184
fb634dc3e606 learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  4888
3782
79ae5dad28d4 Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  4889
    (key == #ToggleAutoIndent) ifTrue:[
79ae5dad28d4 Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  4890
        self autoIndent:(autoIndent not).
79ae5dad28d4 Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  4891
        ^ self.
79ae5dad28d4 Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  4892
    ].
79ae5dad28d4 Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  4893
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  4894
    key == #ToggleInsertMode ifTrue:[
3782
79ae5dad28d4 Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents: 3781
diff changeset
  4895
        self insertMode:(editMode value == EditMode insertMode) not.
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4896
        ^ self.
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  4897
    ].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4898
4162
9c80c8f4ba45 changed:
Claus Gittinger <cg@exept.de>
parents: 4143
diff changeset
  4899
    key == #OpenSpecialCharacterWindow ifTrue:[
9c80c8f4ba45 changed:
Claus Gittinger <cg@exept.de>
parents: 4143
diff changeset
  4900
        CharacterSetView notNil ifTrue:[
9c80c8f4ba45 changed:
Claus Gittinger <cg@exept.de>
parents: 4143
diff changeset
  4901
            self specialCharacters.
9c80c8f4ba45 changed:
Claus Gittinger <cg@exept.de>
parents: 4143
diff changeset
  4902
            ^ self.
9c80c8f4ba45 changed:
Claus Gittinger <cg@exept.de>
parents: 4143
diff changeset
  4903
        ]        
9c80c8f4ba45 changed:
Claus Gittinger <cg@exept.de>
parents: 4143
diff changeset
  4904
    ].
9c80c8f4ba45 changed:
Claus Gittinger <cg@exept.de>
parents: 4143
diff changeset
  4905
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4906
    replacing := false.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4907
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4908
    "
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4909
     Fn      pastes a key-sequence (but only if not overlayed with
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4910
             another function in the keyboard map)
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4911
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4912
     see TextView>>:x:y
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4913
    "
1177
9d23e1241404 avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents: 1108
diff changeset
  4914
    (key at:1) asLowercase == $f ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4915
        (('[fF][0-9]' match:key)
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4916
        or:['[fF][0-9][0-9]' match:key]) ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4917
            shiftPressed ifFalse:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4918
                fKeyMacros := UserPreferences current functionKeySequences.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4919
                fKeyMacros notNil ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4920
                    (fKeyMacros includesKey:key) ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4921
                        self pasteOrReplace:(fKeyMacros at:key) asStringCollection.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4922
                        ^ self
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4923
                    ]
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4924
                ]
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4925
            ]
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4926
        ].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4927
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4928
2506
5568d67dbddd Ctrl-8 / Ctrl-9,
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4929
    (key == #'Ctrl8' or:[key == #'Ctrl9']) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4930
        self parenthizeSelectionWith:$( and:$).
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4931
        ^ self.
2506
5568d67dbddd Ctrl-8 / Ctrl-9,
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4932
    ].
5568d67dbddd Ctrl-8 / Ctrl-9,
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4933
    (key == #'Ctrl2') ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4934
        self parenthizeSelectionWith:$" and:$".
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4935
        ^ self.
2506
5568d67dbddd Ctrl-8 / Ctrl-9,
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4936
    ].
5568d67dbddd Ctrl-8 / Ctrl-9,
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4937
    (key == #'Ctrl#') ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4938
        self parenthizeSelectionWith:$' and:$'.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4939
        ^ self.
2505
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  4940
    ].
4286
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  4941
    (key == #'ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst') ifTrue:[
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  4942
        self convertSelectionToLowercaseOrUppercaseOrUppercaseFirst.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  4943
        ^ self.
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  4944
    ].
2505
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  4945
274
6df4bb990f04 handle accept where acceptAction is define (this was a historic leftover)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  4946
    (key == #Accept)  ifTrue:[^ self accept].
6df4bb990f04 handle accept where acceptAction is define (this was a historic leftover)
Claus Gittinger <cg@exept.de>
parents: 259
diff changeset
  4947
4521
0b6740e2d1a7 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4494
diff changeset
  4948
    ((key == #Paste) or:[key == #Insert or:[key == #PasteFromHistory]]) ifTrue:[self pasteOrReplace. ^self].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4949
    (key == #Cut) ifTrue:[self cut. ^self].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4950
    (key == #Again) ifTrue:[self again. ^self].
3781
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4951
    (key == #AgainForAll) ifTrue:[self multipleAgain. ^self].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4952
3542
30ed44ed0178 +joinLines (CTRL-j);
Claus Gittinger <cg@exept.de>
parents: 3517
diff changeset
  4953
    (key == #Join) ifTrue:[self joinLines. ^self].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4954
    (key == #Replace) ifTrue:[self replace. ^self].
4707
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  4955
    (key == #ExpandSelectionByWord) ifTrue:[
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  4956
        self makeCursorVisible.
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  4957
        self findNextWordAfterSelectionAndAddToSelection.
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  4958
        ^ self
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  4959
    ].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4960
    (key == #SelectWord) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4961
        self makeCursorVisible.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4962
        self selectWordUnderCursor.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4963
        ^ self
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4964
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4965
2505
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  4966
    (key == #SearchMatchingParent) ifTrue:[self searchForMatchingParenthesis. ^ self].
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  4967
    (key == #SelectMatchingParents) ifTrue:[self searchForAndSelectMatchingParenthesis. ^ self].
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  4968
    (key == #SelectToEnd) ifTrue:[self selectUpToEnd. ^ self].
9204d5313979 Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents: 2491
diff changeset
  4969
    (key == #SelectFromBeginning) ifTrue:[self selectFromBeginning. ^ self].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4970
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4971
" disabled - nobody liked it ...
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4972
  and if you like it, its better done in the keymap.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4973
1304
173d00c195f9 flush pending keyboard events in cursor-up/down
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  4974
    (key == #Ctrlb) ifTrue:[self unselect. self cursorLeft. ^ self].
173d00c195f9 flush pending keyboard events in cursor-up/down
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  4975
    (key == #Ctrlf) ifTrue:[self unselect. self cursorRight. ^ self].
173d00c195f9 flush pending keyboard events in cursor-up/down
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  4976
    (key == #Ctrln) ifTrue:[self unselect. self cursorDown. ^ self].
173d00c195f9 flush pending keyboard events in cursor-up/down
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
  4977
    (key == #Ctrlp) ifTrue:[self unselect. self cursorUp. ^ self].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4978
"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  4979
1675
b1cba2341f95 EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
  4980
    (key == #BeginOfLine) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4981
        shiftPressed ifTrue: [
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4982
            "/ "Original St/X code - now use Ctrl modifier"
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4983
            "/ self unselect.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4984
            "/ self cursorHome.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4985
            "Jan's modification"
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4986
            self addToSelectionAfter:[ self cursorToBeginOfLine ].
4257
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  4987
            "/ Jan's modification modified by his own request ;-))
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4988
            "/ JV: Well, does not work correctly. Better to fix addToSelectionAfter: 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  4989
            "/ self selectFromBeginOfLine.
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4990
        ] ifFalse: [
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4991
            self unselect.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4992
            ctrlPressed ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4993
                self cursorHome.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4994
            ] ifFalse:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4995
                self cursorToBeginOfLine.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4996
            ]
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4997
        ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  4998
        ^ self
1675
b1cba2341f95 EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
  4999
    ].
b1cba2341f95 EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
  5000
    (key == #EndOfLine) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5001
        shiftPressed ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5002
            "/ "Original St/X code - now use Ctrl modifier"
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5003
            "/ self unselect.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5004
            "/ self cursorToBottom
4257
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  5005
            " Jan's modification"
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  5006
            self addToSelectionAfter:[ self cursorToEndOfLine ] .
4257
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  5007
            "/ Jan's modification modified by his own request ;-))
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  5008
            "/ JV: Well, does not work correctly. Better to fix addToSelectionAfter:
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  5009
            "/  self selectToEndOfLine.
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5010
        ] ifFalse:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5011
            self unselect.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5012
            ctrlPressed ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5013
                self cursorToBottom
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5014
            ] ifFalse:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5015
                self cursorToEndOfLine.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5016
            ]
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5017
        ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5018
        ^ self
1675
b1cba2341f95 EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
  5019
    ].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5020
    (key == #NextWord) ifTrue:[self cursorToNextWord. ^self].
3310
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  5021
    (key == #EndOfWord) ifTrue:[self cursorToEndOfWord. ^self].
499
939f39bd545f added previousWord
Claus Gittinger <cg@exept.de>
parents: 488
diff changeset
  5022
    (key == #PreviousWord) ifTrue:[self cursorToPreviousWord. ^self].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5023
    (key == #GotoLine) ifTrue:[self gotoLine. ^self].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5024
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5025
    (key == #CursorRight
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5026
    or:[key == #CursorDown
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5027
    or:[key == #CursorLeft
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5028
    or:[key == #CursorUp]]]) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5029
        self cursorKeyPress:key shifted:shiftPressed.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5030
        ^ self.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5031
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5032
3257
628e1e05814d shift-Tab fix.
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
  5033
    (key == #NonInsertingReturn) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5034
        self unselect. self cursorReturn.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5035
        ^ self
3257
628e1e05814d shift-Tab fix.
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
  5036
    ].
628e1e05814d shift-Tab fix.
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
  5037
628e1e05814d shift-Tab fix.
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
  5038
    (key == #Return) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5039
        shiftPressed ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5040
            self unselect. self cursorReturn.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5041
            ^ self
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5042
        ].
4199
cd7069b3bc33 comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4192
diff changeset
  5043
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5044
        self isReadOnly ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5045
            self unselect; makeCursorVisible.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5046
            self cursorReturn
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5047
        ] ifFalse:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5048
            self isInInsertMode ifFalse:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5049
                self cursorReturn.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5050
                autoIndent == true ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5051
                    i := self leftIndentForLine:(cursorLine + 1).
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5052
                    self cursorCol:(i+1 max:1)
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5053
                ]
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5054
            ] ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5055
                "/ old version just unselected ...
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5056
                "/ self unselect; makeCursorVisible.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5057
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5058
                "/ new version deletes ...
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5059
                typeOfSelection == #paste ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5060
                    self unselect; makeCursorVisible.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5061
                ] ifFalse:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5062
                    self copyAndDeleteSelection.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5063
                ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5064
                self insertCharAtCursor:(Character cr).
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5065
                autoIndent == true ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5066
                    i := self leftIndentForLine:cursorLine.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5067
                    self indentFromLine:cursorLine toLine:cursorLine.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5068
                    self cursorCol:(i+1 max:1)
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5069
                ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5070
            ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5071
        ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5072
        ^ self
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5073
    ].
309
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
  5074
2819
a7a41dfb9df7 BackTab / NonInsertingTab modifiers now defined in keyboard.rc
ca
parents: 2817
diff changeset
  5075
    (key == #NonInsertingTab) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5076
        self unselect. self cursorTab.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5077
        ^ self
2819
a7a41dfb9df7 BackTab / NonInsertingTab modifiers now defined in keyboard.rc
ca
parents: 2817
diff changeset
  5078
    ].
3422
a0c68e8bd56e tab with line selection means: indent/undent
Claus Gittinger <cg@exept.de>
parents: 3416
diff changeset
  5079
    ((key == #BackTab) or:[(key == #Tab)]) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5080
        self tabMeansNextField ifTrue:[^ super keyPress:key x:x y:y].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5081
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5082
        self hasSelection ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5083
            selectStyle == #line ifTrue:[
4238
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5084
                ((key == #Tab) and:[shiftPressed not]) ifTrue:[
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5085
                    macroName := #IndentBy4.
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5086
                ] ifFalse:[
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5087
                    macroName := #UndentBy4.
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5088
                ].
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5089
                macroName notNil ifTrue:[
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5090
                    self executekeyboardMacroNamed:macroName.
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5091
                ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5092
            ]
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5093
        ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5094
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5095
        self unselect.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5096
        (key == #Tab) ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5097
            (shiftPressed or:[self isInInsertMode not]) ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5098
                self cursorTab.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5099
                ^ self
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5100
            ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5101
            self insertTabAtCursor.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5102
            ^ self
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5103
        ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5104
        self cursorBacktab.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5105
        ^ self
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5106
    ].
309
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
  5107
2883
6cdb4a5a7b5e shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
  5108
    "/ key == #DeleteSpaces ifTrue:[
6cdb4a5a7b5e shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
  5109
    (key == #Delete) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5110
        shiftPressed ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5111
            [(cursorCol <= (self listAt:cursorLine) size)
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5112
             and:[self characterUnderCursor isSeparator]] whileTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5113
             self makeCursorVisible.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5114
                self deleteCharAtCursor.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5115
            ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5116
            ^ self
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5117
        ]
2883
6cdb4a5a7b5e shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
  5118
    ].
6cdb4a5a7b5e shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents: 2880
diff changeset
  5119
870
c606f29db5d7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 865
diff changeset
  5120
    (key == #Delete
c606f29db5d7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 865
diff changeset
  5121
     or:[key == #BasicDelete]) ifTrue:[
4129
34908a157d21 changed: #deleteCopyToClipboard:
fm
parents: 4126
diff changeset
  5122
        selectionStartLine notNil ifTrue:[  
4130
87d51f65430e changed: #doKeyPress:x:y:
fm
parents: 4129
diff changeset
  5123
"/          Again function is not supporting Delete action (on purpose, to avoid replacing the next search string)
87d51f65430e changed: #doKeyPress:x:y:
fm
parents: 4129
diff changeset
  5124
"/          To remove text repetetively, use Cut instead.
87d51f65430e changed: #doKeyPress:x:y:
fm
parents: 4129
diff changeset
  5125
"/            self setLastStringToReplace: self selection asStringWithoutFinalCR.
87d51f65430e changed: #doKeyPress:x:y:
fm
parents: 4129
diff changeset
  5126
"/            lastReplacementInfo lastReplacement: nil.
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5127
            ((key == #BasicDelete)
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5128
            or:[UserPreferences current deleteSetsClipboardText not]) ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5129
                self deleteSelection.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5130
            ] ifFalse:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5131
                self copyAndDeleteSelection.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5132
            ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5133
            ^ self
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5134
        ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5135
        self makeCursorVisible.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5136
        self deleteCharAtCursor.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5137
        ^ self
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5138
    ].
309
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
  5139
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5140
    (key == #BeginOfText) ifTrue:[     "i.e. HOME"
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5141
        self unselect.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5142
        cursorVisibleLine == 1 ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5143
            self cursorHome.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5144
        ] ifFalse:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5145
            self cursorToFirstVisibleLine
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5146
        ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5147
        ^ self
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5148
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5149
    (key == #EndOfText) ifTrue:[       "i.e. END"
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5150
        self unselect.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5151
        cursorVisibleLine == nFullLinesShown ifTrue:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5152
            self cursorToBottom.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5153
        ] ifFalse:[
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5154
            self cursorToLastVisibleLine
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5155
        ].
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5156
        ^ self
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5157
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5158
    ((key == #Escape)
3257
628e1e05814d shift-Tab fix.
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
  5159
    or:[key == #SelectLineFromBeginning]) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5160
        self makeCursorVisible.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5161
        self unselect. self selectCursorLineFromBeginning.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5162
        ^ self
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5163
    ].
3257
628e1e05814d shift-Tab fix.
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
  5164
    (key == #SelectLine) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5165
        self makeCursorVisible.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5166
        self unselect. self selectCursorLine.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5167
        ^ self
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5168
    ].
3257
628e1e05814d shift-Tab fix.
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
  5169
    (key == #ExpandSelectionByLine) ifTrue:[
4707
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  5170
        "/ self makeCursorVisible.
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5171
        self selectExpandCursorLine.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5172
        ^ self
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5173
    ].
3257
628e1e05814d shift-Tab fix.
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
  5174
    (key == #DeleteLine) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5175
        self makeCursorVisible.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5176
        self unselect. self deleteCursorLine.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5177
        ^ self
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5178
    ].
3257
628e1e05814d shift-Tab fix.
Claus Gittinger <cg@exept.de>
parents: 3252
diff changeset
  5179
    (key == #InsertLine) ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5180
        self makeCursorVisible.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5181
        self unselect. self insertLine:nil before:cursorLine.
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  5182
        ^ self
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5183
    ].
3781
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5184
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5185
    super keyPress:key x:x y:y
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5186
3310
83368f9014a1 word check
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
  5187
    "Modified: / 06-02-1998 / 11:59:59 / stefan"
4286
83ef1d9faf6d added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
  5188
    "Modified: / 14-07-2011 / 12:08:28 / cg"
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5189
    "Modified: / 26-09-2013 / 17:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
121
claus
parents: 118
diff changeset
  5190
!
claus
parents: 118
diff changeset
  5191
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5192
executeKeyboardMacro:cmdMacro
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5193
    Error handle:[:ex |
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5194
	self warn:'Error in keyboard macro: ' , ex description.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5195
	ex return.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5196
    ] do:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5197
	AbortOperationRequest handle:[:ex |
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5198
	    self warn:'Keyboard macro aborted'.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5199
	    ex return.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5200
	] do:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5201
	    Parser
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5202
		evaluate:cmdMacro asString
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5203
		receiver:self
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5204
		notifying:nil
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5205
		compile:false.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5206
	].
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5207
    ].
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5208
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5209
4843
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5210
extendSelectionToX:x y:y
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5211
    "mouse-move while button was pressed - handle selection changes"
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5212
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5213
    " Overwritten here to move cursor position to start/end of the
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5214
      selection, whichever changes"
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5215
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5216
    | oldClickLine oldClickCol newCursorLine newCursorCol |
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5217
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5218
    oldClickLine := clickStartLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5219
    oldClickCol := clickStartCol.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5220
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5221
    super extendSelectionToX:x y:y.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5222
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5223
    self hasSelection ifFalse: [ ^ self ].
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5224
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5225
    clickLine < oldClickLine ifTrue:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5226
        newCursorCol := selectionStartCol.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5227
        newCursorLine := selectionStartLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5228
    ] ifFalse:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5229
        clickLine == oldClickLine ifTrue:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5230
            clickCol < oldClickCol ifTrue:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5231
                newCursorLine := selectionStartLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5232
                newCursorCol := selectionStartCol.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5233
            ] ifFalse:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5234
                clickCol == oldClickCol ifTrue:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5235
                    newCursorLine := selectionStartLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5236
                    newCursorCol := selectionStartCol.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5237
                ] ifFalse:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5238
                    newCursorLine := selectionEndLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5239
                    newCursorCol := selectionEndCol + 1
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5240
                ]
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5241
            ]
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5242
        ] ifFalse:[
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5243
            newCursorLine := selectionEndLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5244
            newCursorCol := selectionEndCol + 1.       
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5245
        ]
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5246
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5247
    ].
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5248
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5249
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5250
    self setCursorCol: newCursorCol. 
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5251
    self setCursorLine: newCursorLine.
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5252
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5253
    "Created: / 28-08-2013 / 15:28:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5254
    "Modified: / 28-08-2013 / 17:18:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5255
!
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  5256
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5257
handleNonCommandKey:keyArg
4700
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  5258
    |selStartLineBefore selStartColBefore selEndLineBefore selEndColBefore key|
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5259
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5260
    self isReadOnly ifTrue:[
3813
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5261
        self flash.
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5262
        ^ self.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5263
    ].
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5264
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5265
    key := keyArg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5266
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5267
    typeOfSelection == #paste ifTrue:[
4846
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5268
        "Pasted selection will NOT be replaced by keystroke (non-standard, St/X feature)"
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5269
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5270
        "/ After paste, the cursor is at the beginning to support
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5271
        "/ paste-cursordown-paste. Compensate for this here - we want
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5272
        "/ to continue editing after the end of the selection.
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5273
        "/ This is
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5274
        cursorLine := selectionEndLine.
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5275
        cursorCol := selectionEndCol + 1.
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5276
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5277
        "/ Cursor position set, we can unselect.
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5278
        self unselect.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5279
    ].
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5280
4700
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  5281
    selStartLineBefore := selectionStartLine.
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  5282
    selStartColBefore := self selectionStartCol.
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  5283
    selEndLineBefore := selectionEndLine.
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  5284
    selEndColBefore := self selectionEndCol.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5285
4481
76c592c0ae9c class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4475
diff changeset
  5286
    (characterEncoding ? #'iso10646-1') ~~ #'iso10646-1' ifTrue:[
76c592c0ae9c class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4475
diff changeset
  5287
        key isCharacter ifTrue:[
76c592c0ae9c class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4475
diff changeset
  5288
            key := CharacterEncoder encode:key from:#'iso10646-1' into:characterEncoding.
76c592c0ae9c class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4475
diff changeset
  5289
        ] ifFalse:[
76c592c0ae9c class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4475
diff changeset
  5290
            key := CharacterEncoder encodeString:key from:#'iso10646-1' into:characterEncoding.
76c592c0ae9c class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4475
diff changeset
  5291
        ].
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5292
    ].
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5293
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5294
    "replace selection by what is typed in -
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  5295
     if word was selected with a space, keep it.
4700
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  5296
     if there was no selection, the key's character is inserted"
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  5297
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  5298
    editMode value isInsertAndSelectMode ifTrue:[
3813
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5299
        selectionStartLine := selectionStartCol := selectionEndLine := selectionEndCol := nil.
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  5300
    ].
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5301
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5302
    (selectStyle == #wordLeft) ifTrue:[
3813
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5303
        self replaceSelectionBy:(' ' , key asString)
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5304
    ] ifFalse:[
3813
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5305
        (selectStyle == #wordRight) ifTrue:[
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5306
            self replaceSelectionBy:(key asString , ' ').
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5307
            self cursorLeft
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5308
        ] ifFalse:[
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5309
            self replaceSelectionBy:key
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5310
        ]
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5311
    ].
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5312
    selectStyle := nil.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5313
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  5314
    editMode value isInsertAndSelectMode ifTrue:[
4700
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  5315
        selectionStartLine := selStartLineBefore.
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  5316
        selectionStartCol := selStartColBefore.
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  5317
        selectionEndLine := selEndLineBefore.
150468a2ea5a class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4697
diff changeset
  5318
        selectionEndCol := selEndColBefore.
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  5319
    ].
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  5320
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5321
    showMatchingParenthesis ifTrue:[
3813
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5322
        "emacs style parenthesis shower"
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5323
      (ExecutingMacroQuery query ? false) ifFalse:[
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5324
        "claus: only do it for closing parenthesis -
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5325
                otherwise its too anoying.
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5326
        "
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5327
"
4481
76c592c0ae9c class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4475
diff changeset
  5328
        ('()[]{}' includes:key) ifTrue:[
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5329
"
4481
76c592c0ae9c class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4475
diff changeset
  5330
        (')]}' includes:key) ifTrue:[
3813
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5331
        self
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5332
            searchForMatchingParenthesisFromLine:cursorLine col:(cursorCol - 1)
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5333
            ifFound:[:line :col |
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5334
                         |savLine savCol sensor|
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5335
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5336
                         self withCursor:Cursor eye do:[
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5337
                             savLine := cursorLine.
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5338
                             savCol := cursorCol.
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5339
                             self cursorLine:line col:col.
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5340
                             device flush.
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5341
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5342
                             "/ want to wait 200ms, but not if another keyPress
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5343
                             "/ arrives in the meantime ...
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5344
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5345
                             sensor := self sensor.
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5346
                             5 timesRepeat:[
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5347
                                 (sensor hasKeyPressEventFor:self) ifFalse:[
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5348
                                     Processor activeProcess millisecondDelay:40.
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5349
                                 ]
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5350
                             ].
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5351
                             self cursorLine:savLine col:savCol
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5352
                         ]
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5353
                    ]
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5354
            ifNotFound:[self showNotFound]
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5355
            onError:[self beep]
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5356
        ].
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5357
      ]
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5358
    ].
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5359
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5360
"/    true "autoExpandWhileTyping" ifTrue:[
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5361
"/        self wordAtLine:cursorLine col:cursorCol-1 do:[
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5362
"/            :beginLine :beginCol :endLine :endCol :style |
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5363
"/
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5364
"/            self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5365
"/            self selection.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5366
"/            typeOfSelection := #paste.
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5367
"/        ].
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5368
"/    ].
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  5369
    editMode value isInsertAndSelectMode ifTrue:[
3813
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5370
        selectionStartLine isNil ifTrue:[
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5371
            self selectFromLine:cursorLine col:cursorCol-1 toLine:cursorLine col:cursorCol-1.
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5372
        ] ifFalse:[
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5373
            self selectFromLine:selectionStartLine col:selectionStartCol toLine:cursorLine col:cursorCol-1.
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5374
        ].
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  5375
    ].
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5376
    completionSupport notNil ifTrue:[ completionSupport postKeyPress:keyArg ].
4360
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  5377
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  5378
    "Modified (comment): / 25-01-2012 / 00:30:11 / cg"
4846
cd2e0b754655 Fix for paster-keystroke: should insert character at the end of the just pasted selection,
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4845
diff changeset
  5379
    "Modified: / 30-08-2013 / 20:10:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5380
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5381
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5382
keyPress:key x:x y:y
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5383
    "handle keyboard input"
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5384
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5385
    |wasOn|
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5386
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5387
    wasOn := cursorShown.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5388
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5389
    NoModificationError handle:[:ex |
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5390
        self flash.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5391
        (cursorShown not and:[wasOn]) ifTrue:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5392
            self makeCursorVisibleAndShowCursor:wasOn.
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5393
        ].
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5394
    ] do:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5395
        self undoableDo:[
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5396
            self doKeyPress:key x:x y:y
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5397
        ].
4242
93363c9c43cd changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4238
diff changeset
  5398
    ].
93363c9c43cd changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4238
diff changeset
  5399
    self repairDamage
93363c9c43cd changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4238
diff changeset
  5400
93363c9c43cd changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4238
diff changeset
  5401
    "Modified: / 18-04-2011 / 21:35:27 / cg"
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5402
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  5403
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5404
mapped
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5405
    "view was made visible"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5406
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5407
    super mapped.
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  5408
    self updateCursorVisibleLine.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5409
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5410
3268
d30df22739ca move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents: 3257
diff changeset
  5411
requestAutoAccept
d30df22739ca move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents: 3257
diff changeset
  5412
    "this is invoked when a dialog closes via accept or cancel.
d30df22739ca move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents: 3257
diff changeset
  5413
     This forces my value to be accepted into my model"
d30df22739ca move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents: 3257
diff changeset
  5414
d30df22739ca move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents: 3257
diff changeset
  5415
    acceptEnabled == false ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5416
	"/ nope -
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5417
	^ false
3268
d30df22739ca move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents: 3257
diff changeset
  5418
    ].
d30df22739ca move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents: 3257
diff changeset
  5419
    self accept.
d30df22739ca move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents: 3257
diff changeset
  5420
    ^ true.
d30df22739ca move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents: 3257
diff changeset
  5421
!
d30df22739ca move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents: 3257
diff changeset
  5422
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5423
sizeChanged:how
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5424
    "make certain, cursor is visible after the sizechange"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5425
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5426
    |cv|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5427
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5428
    cv := cursorVisibleLine.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5429
    super sizeChanged:how.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5430
    cv notNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5431
	self makeLineVisible:cursorLine
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5432
    ]
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5433
! !
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5434
1807
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5435
!EditTextView methodsFor:'focus handling'!
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5436
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5437
hasKeyboardFocus:aBoolean
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5438
    "sent by the windowGroup, a delegate or myself to make me show a block cursor
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5439
     (otherwise, I would not know about this)"
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5440
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5441
    hasKeyboardFocus := aBoolean.
4609
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  5442
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5443
    (cursorShown
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5444
    and:[self enabled
3296
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  5445
    and:[self isReadOnly not]]) ifTrue:[
4609
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  5446
        self drawCursor
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  5447
    ].
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  5448
8b3eb80d04d0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  5449
    hasKeyboardFocus ifFalse:[
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5450
        completionSupport notNil ifTrue:[
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5451
            completionSupport editViewLostFocus.
4696
428c8bc44cfb refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4694
diff changeset
  5452
        ].
1816
0b9380a0cc7e only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents: 1811
diff changeset
  5453
    ].
0b9380a0cc7e only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents: 1811
diff changeset
  5454
0b9380a0cc7e only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents: 1811
diff changeset
  5455
    "Modified: / 23.3.1999 / 13:49:35 / cg"
1807
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5456
!
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5457
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5458
showFocus:explicit
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5459
    "in addition to however my superclass thinks how a focusView is to be
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5460
     displayed, show the cursor when I got the focus"
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5461
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5462
    self showCursor.
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5463
    self hasKeyboardFocus:true.
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5464
    super showFocus:explicit
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5465
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5466
    "Modified: 11.12.1996 / 16:56:54 / cg"
1918
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  5467
!
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  5468
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  5469
wantsFocusWithPointerEnter
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  5470
    "return true, if I want the focus when
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  5471
     the mouse pointer enters"
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  5472
3296
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  5473
    (UserPreferences current focusFollowsMouse ~~ false
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  5474
     and:[(styleSheet at:#'editText.requestFocusOnPointerEnter' default:true)
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  5475
     and:[self enabled
4781
11d53632e47e class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4775
diff changeset
  5476
     and:[true "self isReadOnly not"]]]
4097
233d27a2b0a0 comment/format in: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  5477
    ) ifTrue:[
233d27a2b0a0 comment/format in: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  5478
        ^ true
1918
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  5479
    ].
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  5480
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  5481
    ^ false
1807
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5482
! !
30526cb1acfc category and comment
Claus Gittinger <cg@exept.de>
parents: 1804
diff changeset
  5483
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5484
!EditTextView methodsFor:'formatting'!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5485
4237
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5486
executekeyboardMacroNamed:macroName
4371
a631db2025af changed: #executekeyboardMacroNamed:
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  5487
    "try to execute the keyboard macro; 
a631db2025af changed: #executekeyboardMacroNamed:
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  5488
     return true if that worked, false otherwise"
a631db2025af changed: #executekeyboardMacroNamed:
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  5489
4482
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  5490
    |cmdMacro|
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  5491
0530a2d95b4b class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4481
diff changeset
  5492
    cmdMacro := UserPreferences current functionKeySequences at:macroName ifAbsent:[^ false].
4371
a631db2025af changed: #executekeyboardMacroNamed:
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  5493
    self
a631db2025af changed: #executekeyboardMacroNamed:
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  5494
        undoableDo:[ self executeKeyboardMacro:cmdMacro ]
a631db2025af changed: #executekeyboardMacroNamed:
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  5495
        info: macroName.
a631db2025af changed: #executekeyboardMacroNamed:
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  5496
    ^ true
4238
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5497
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5498
    "
4483
5b71475eddbc class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  5499
      EditTextView open
4238
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5500
                contents:'bla';
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5501
                selectAll;
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5502
                executekeyboardMacroNamed:#IndentBy4.
4483
5b71475eddbc class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  5503
      EditTextView open
4238
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5504
                contents:'bla';
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5505
                selectAll;
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5506
                executekeyboardMacroNamed:#blabla.
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5507
    "
4371
a631db2025af changed: #executekeyboardMacroNamed:
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  5508
a631db2025af changed: #executekeyboardMacroNamed:
Claus Gittinger <cg@exept.de>
parents: 4360
diff changeset
  5509
    "Modified: / 14-02-2012 / 11:17:27 / cg"
4237
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5510
!
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5511
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5512
indent
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  5513
    "indent a line-range - this is done by searching for the
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  5514
     last non-empty line before the selection, and changing the indent
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5515
     of the selected line-range based on that line's indent."
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5516
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5517
    |start end|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5518
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5519
    selectionStartLine isNil ifTrue:[^ self].
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  5520
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5521
    start := selectionStartLine.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5522
    end := selectionEndLine.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5523
    (selectionEndCol == 0) ifTrue:[
3786
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5524
        end := end - 1
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5525
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5526
    self unselect.
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5527
    self
3786
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5528
        undoableDo:[self indentFromLine:start toLine:end]
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5529
        info:'Indent'
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5530
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5531
4237
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5532
indentBy4
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5533
    self executekeyboardMacroNamed:#IndentBy4.
4237
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5534
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5535
    "Modified: / 06-04-2011 / 18:52:40 / cg"
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5536
!
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5537
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5538
indentFromLine:start toLine:end
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  5539
    "indent a line-range - this is done by searching for the
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5540
     last non-empty line before start, and change the indent
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5541
     of the selected line-range based on that line's indent."
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5542
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5543
    |leftStart delta d line spaces anyChange|
474
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5544
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5545
    leftStart := self leftIndentForLine:start.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5546
    (leftStart == 0) ifTrue:[^ self].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5547
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5548
    delta := leftStart - (self leftIndentOfLine:start).
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5549
    (delta == 0) ifTrue:[^ self].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5550
    (delta > 0) ifTrue:[
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5551
        spaces := String new:delta
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5552
    ].
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5553
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5554
    anyChange := false.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5555
    start to:end do:[:lineNr |
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5556
        line := self listAt:lineNr.
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5557
        line notNil ifTrue:[
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5558
            line isBlank ifTrue:[
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5559
                self basicListAt:lineNr put:nil
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5560
            ] ifFalse:[
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5561
                (delta > 0) ifTrue:[
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5562
                    line := spaces , line.
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5563
                    widthOfWidestLine notNil ifTrue:[
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5564
                        widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line).
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5565
                    ]
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5566
                ] ifFalse:[
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5567
                    "check if deletion is ok"
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5568
                    d := delta negated + 1.
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5569
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5570
                    line size > d ifTrue:[
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5571
                        (line copyTo:(d - 1)) withoutSeparators isEmpty ifTrue:[
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5572
                            line := line copyFrom:d
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5573
                        ]
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5574
                    ].
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5575
                    widthOfWidestLine := nil
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5576
                ].
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5577
                self replaceLine:lineNr with:line.
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5578
                anyChange := true.
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5579
            ]
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5580
        ]
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5581
    ].
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5582
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5583
    anyChange ifTrue:[ self textChanged ].
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  5584
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  5585
    "/ self redrawFromLine:start to:end
474
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5586
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5587
    "Modified: 5.3.1996 / 14:59:18 / cg"
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5588
!
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5589
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5590
leftIndentForLine:lineNr
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5591
    "find an appropriate indent for a line.
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5592
     this is done by searching for the last non-empty line before it
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5593
     and returning its indent."
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5594
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  5595
    "SHOULD GO TO ListView"
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  5596
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  5597
    |line lnr indent|
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  5598
474
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5599
    lnr := lineNr.
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  5600
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  5601
    [lnr ~~ 1] whileTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5602
	lnr  := lnr - 1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5603
	line := self listAt:lnr.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5604
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5605
	line notNil ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5606
	    indent := line indexOfNonSeparatorStartingAt:1.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5607
	    indent ~~ 0 ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5608
		^ indent - 1
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5609
	    ]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5610
	]
474
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5611
    ].
827
6b42229252b9 reuse of basic editing functionality and thus change
ca
parents: 823
diff changeset
  5612
    ^ 0
474
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5613
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5614
    "Created: 5.3.1996 / 14:58:53 / cg"
4237
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5615
!
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5616
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5617
undentBy4
4238
5f7125996b44 changed:
Stefan Vogel <sv@exept.de>
parents: 4237
diff changeset
  5618
    self executekeyboardMacroNamed:#UndentBy4.
4237
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5619
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  5620
    "Modified: / 06-04-2011 / 18:52:49 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  5621
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  5622
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  5623
!EditTextView methodsFor:'initialization'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  5624
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  5625
fetchDeviceResources
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  5626
    "fetch device colors, to avoid reallocation at redraw time"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  5627
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  5628
    super fetchDeviceResources.
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  5629
1993
5ffe0b3943cd #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  5630
    cursorFgColor notNil ifTrue:[cursorFgColor := cursorFgColor onDevice:device].
5ffe0b3943cd #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  5631
    cursorBgColor notNil ifTrue:[cursorBgColor := cursorBgColor onDevice:device].
5ffe0b3943cd #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  5632
    cursorNoFocusFgColor notNil ifTrue:[cursorNoFocusFgColor := cursorNoFocusFgColor onDevice:device].
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  5633
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  5634
    "Created: 14.1.1997 / 00:15:24 / cg"
1022
4362861fe15e allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  5635
    "Modified: 18.2.1997 / 15:02:46 / cg"
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  5636
!
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  5637
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5638
initEvents
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5639
    "enable enter/leave events in addition"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5640
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5641
    super initEvents.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5642
    self enableEnterLeaveEvents
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5643
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5644
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5645
initStyle
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5646
    "initialize style specific stuff"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5647
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5648
    super initStyle.
4576
c9d937d20173 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4566
diff changeset
  5649
    "/ lineSpacing := 2.       "/ for underwave - also looks better
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5650
    lockUpdates := false.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5651
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5652
    cursorFgColor := DefaultCursorForegroundColor.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5653
    cursorFgColor isNil ifTrue:[cursorFgColor := bgColor].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5654
    cursorBgColor := DefaultCursorBackgroundColor.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5655
    cursorBgColor isNil ifTrue:[cursorBgColor := fgColor].
4721
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  5656
    cursorType isNil ifTrue:[cursorType := DefaultCursorType].
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  5657
    cursorTypeNoFocus isNil ifTrue:[
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  5658
        cursorTypeNoFocus := cursorType.
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  5659
        DefaultCursorTypeNoFocus notNil ifTrue:[
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  5660
            cursorTypeNoFocus := DefaultCursorTypeNoFocus.
59fc420ce5b0 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4715
diff changeset
  5661
        ]
1534
bcb211e1b41a read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  5662
    ].
1022
4362861fe15e allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  5663
    cursorNoFocusFgColor := DefaultCursorNoFocusForegroundColor.
4362861fe15e allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  5664
    cursorNoFocusFgColor isNil ifTrue:[
4576
c9d937d20173 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4566
diff changeset
  5665
        cursorType ~~ #block ifTrue:[
c9d937d20173 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4566
diff changeset
  5666
            cursorNoFocusFgColor := cursorBgColor
c9d937d20173 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4566
diff changeset
  5667
        ] ifFalse:[
c9d937d20173 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4566
diff changeset
  5668
            cursorNoFocusFgColor := cursorFgColor
c9d937d20173 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4566
diff changeset
  5669
        ]
1022
4362861fe15e allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  5670
    ].
4362861fe15e allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  5671
2088
b2beb67b1a98 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  5672
    "Modified: / 15.12.1999 / 22:27:45 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5673
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5674
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5675
initialize
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5676
    "initialize a new EditTextView;
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5677
     setup some instance variables"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5678
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5679
    super initialize.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5680
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5681
    self level:-1.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5682
    readOnly := false.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5683
    fixedSize := false.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5684
    exceptionBlock := [:errorText | ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5685
    cursorShown := prevCursorState := true.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5686
    cursorLine := 1.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5687
    cursorVisibleLine := 1.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5688
    cursorCol := 1.
2815
d71f43d7de3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2796
diff changeset
  5689
    cursorLineHolder := 1 asValue.
d71f43d7de3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2796
diff changeset
  5690
    cursorColHolder := 1 asValue.
2119
2aa585fc62a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2117
diff changeset
  5691
    modifiedChannel := ValueHolder with:false.
2aa585fc62a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2117
diff changeset
  5692
    acceptChannel := ValueHolder with:false.
1437
ab84b08a9f9c allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents: 1426
diff changeset
  5693
    acceptChannel addDependent:self.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5694
    showMatchingParenthesis := false.
3296
7322b2e5222c Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3269
diff changeset
  5695
    hasKeyboardFocus := false.
323
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  5696
    tabMeansNextField := false.
474
f73ed1f5cb75 added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents: 473
diff changeset
  5697
    autoIndent := false.
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  5698
    editMode := EditMode insertMode asValue.
2795
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5699
    learnMode := false asValue.
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5700
    trimBlankLines := self st80EditMode not.
2131
858209ba8509 cursor movement default
Claus Gittinger <cg@exept.de>
parents: 2129
diff changeset
  5701
    cursorMovementWhenUpdating := #beginOfText.
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  5702
    lastReplacementInfo := LastReplacementInfo new.
1596
0bbdb4e9fc43 made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
  5703
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5704
    "/ enable drop by default
2589
62794ae04446 support drop
ca
parents: 2580
diff changeset
  5705
    self allowDrop:true.        "/ readOnly tested in #canDrop:
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  5706
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  5707
    undoSupport := UndoSupport for:self.
4696
428c8bc44cfb refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4694
diff changeset
  5708
!
428c8bc44cfb refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4694
diff changeset
  5709
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5710
initializeCompletionSupport
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5711
    |supportClass|
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5712
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5713
    completionSupport isNil ifTrue:[
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5714
        (supportClass := self completionSupportClass) notNil ifTrue:[
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5715
            completionSupport := supportClass for:self.            
4696
428c8bc44cfb refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4694
diff changeset
  5716
        ].
428c8bc44cfb refactored codeCompletionService
Claus Gittinger <cg@exept.de>
parents: 4694
diff changeset
  5717
    ].
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5718
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5719
    "Created: / 26-09-2013 / 17:51:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5720
!
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5721
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5722
release
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5723
    completionSupport notNil ifTrue:[
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  5724
        completionSupport release
4771
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5725
    ].
109861cbb78c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4764
diff changeset
  5726
    super release
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  5727
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  5728
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5729
!EditTextView methodsFor:'macros'!
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5730
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5731
executeLearnedKeyboardMacro
4673
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  5732
    "replay the characters as learned previously"
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  5733
2795
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5734
    (self learnMode not and:[learnedMacro size > 0]) ifTrue:[
3813
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5735
        ExecutingMacroQuery 
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5736
            answer:true
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5737
            do:[
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5738
                learnedMacro do:[:event |
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5739
                            WindowGroup lastEventQuerySignal answer:event
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5740
                            do:[
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5741
                                self
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5742
                                    dispatchEvent:event
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5743
                                    withFocusOn:nil
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5744
                                    delegate:false
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5745
                            ]
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5746
                ]
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5747
            ].
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5748
    ] ifFalse:[
3813
8d719ca5812d dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  5749
        self flash.
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5750
    ].
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5751
!
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5752
2795
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5753
learnMode
3793
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  5754
    "true if currently learning"
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  5755
2795
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5756
    ^ (learnMode value ? false).
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5757
!
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5758
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5759
learnMode:aBoolean
3793
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  5760
    "toggle the learn-mode"
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  5761
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5762
    |fg bg|
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5763
2795
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5764
    self learnModeHolder value:aBoolean.
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5765
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5766
    aBoolean ifTrue:[
3793
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  5767
        learnedMacro := OrderedCollection new.
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  5768
        fg := Color white.
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  5769
        bg := Color black.
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5770
    ] ifFalse:[
3793
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  5771
        cursorFgColor := fg := (DefaultCursorForegroundColor ? bgColor).
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  5772
        cursorBgColor := bg := (DefaultCursorBackgroundColor ? fgColor).
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5773
    ].
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5774
    self cursorForegroundColor:fg backgroundColor:bg.
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5775
!
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5776
2795
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5777
learnModeHolder
4673
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  5778
    "a holder returning true, if in learn mode"
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  5779
2795
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5780
    learnMode isNil ifTrue:[
4673
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  5781
        learnMode := false asValue
2795
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5782
    ].
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5783
    ^ learnMode
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5784
!
1f7b5f242eee learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  5785
4673
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  5786
rememberLearnedMacroAs: nameString
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  5787
    Macros isNil ifTrue:[
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  5788
        Macros := Dictionary new.
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  5789
    ].
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  5790
    Macros at:nameString put:learnedMacro
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  5791
!
575d2d398823 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4666
diff changeset
  5792
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5793
toggleLearnMode
3793
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  5794
    "toggle the learn-mode"
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  5795
5a6074a257c1 learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
  5796
    self learnMode:(self learnMode not).
2580
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5797
! !
12fea7ffcf8e learn/execute on menu
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
  5798
4449
59fe55c937ea changed: #openFileBrowserOnIt
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  5799
!EditTextView methodsFor:'menu & menu actions'!
121
claus
parents: 118
diff changeset
  5800
2680
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5801
babelFishTranslate:fromToModeString
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5802
    "translate the selected text and paste it after the selection"
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5803
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5804
    |original translated|
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5805
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5806
    original := self selectionAsString.
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5807
    original size == 0 ifTrue:[^ self].
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5808
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5809
    self withWaitCursorDo:[
4143
34d78a2ca94f changed: #babelFishTranslate:
Claus Gittinger <cg@exept.de>
parents: 4142
diff changeset
  5810
        (HostNameLookupError , SOAP::SoapImplError) handle:[:ex |
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5811
            Dialog warn:('Translation failed - WEB Service error:\\%1.' bindWith:ex description allBold) withCRs
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5812
        ] do:[
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5813
            translated := SOAP::BabelFishClient new translate:original mode:fromToModeString.
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5814
        ]
2680
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5815
    ].
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5816
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5817
    "/ v pasteOrReplace:translated
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5818
    self cursorLine:(self selectionEndLine) col:(self selectionEndCol + 1).
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5819
    self unselect.
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5820
    self 
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5821
        undoablePaste:translated 
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5822
        info:'Translate'
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  5823
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  5824
    "Modified: / 28-07-2007 / 13:27:21 / cg"
2680
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5825
!
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5826
3517
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5827
compareWithClipboard
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5828
    "compare the selection against the clipboard contents"
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5829
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5830
    |t1 t2|
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5831
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5832
    t2 := self getClipboardText.
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5833
    t2 isEmptyOrNil ifTrue:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5834
	Dialog information:'Clipboard is empty.'.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5835
	^ self.
3517
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5836
    ].
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5837
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5838
    self hasSelection ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5839
	t1 := self selectionAsString.
3517
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5840
    ] ifFalse:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5841
	t1 := self contents asString
3517
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5842
    ].
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5843
    t1 := t1 string.
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5844
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5845
    t1 = t2 ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5846
	Dialog information:'Strings are equal.'.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5847
	^ self.
3517
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5848
    ].
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5849
    DiffTextView
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5850
	openOn:t1 label:'Editor'
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5851
	and:t2 label:'Clipboard'
3517
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5852
!
0a2f117c2fb8 +compare menu item
Claus Gittinger <cg@exept.de>
parents: 3514
diff changeset
  5853
121
claus
parents: 118
diff changeset
  5854
cut
claus
parents: 118
diff changeset
  5855
    "cut selection into copybuffer"
claus
parents: 118
diff changeset
  5856
3324
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5857
    self deleteCopyToClipboard:true
121
claus
parents: 118
diff changeset
  5858
!
claus
parents: 118
diff changeset
  5859
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5860
defaultForGotoLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5861
    "return a default value to show in the gotoLine box"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5862
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5863
    cursorLine notNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  5864
	^ cursorLine
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5865
    ].
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5866
    ^ super defaultForGotoLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5867
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  5868
3324
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5869
deleteCopyToClipboard:toClipboard
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5870
    "cut selection into copybuffer"
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5871
4129
34908a157d21 changed: #deleteCopyToClipboard:
fm
parents: 4126
diff changeset
  5872
    |line col history sel |
3324
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5873
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5874
    (self checkModificationsAllowed) ifFalse:[
3786
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5875
        self flash.
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5876
        ^ self
3324
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5877
    ].
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5878
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5879
    sel := self selection.
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5880
    sel notNil ifTrue:[
4129
34908a157d21 changed: #deleteCopyToClipboard:
fm
parents: 4126
diff changeset
  5881
        self setLastStringToReplace: sel.
4053
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  5882
3786
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5883
        line := selectionStartLine.
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5884
        col := selectionStartCol.
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5885
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5886
        toClipboard ifTrue:[
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5887
            "
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5888
             remember in CopyBuffer
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5889
            "
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5890
            self setClipboardText:sel. "/ lastString.
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5891
        ].
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5892
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5893
        "
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5894
         append to DeleteHistory (if there is one)
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5895
        "
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5896
        history := Smalltalk at:#DeleteHistory.
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5897
        history notNil ifTrue:[
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5898
            history addAll:(sel asStringCollection).
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5899
            history size > 1000 ifTrue:[
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5900
                history := history copyFrom:(history size - 1000)
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5901
            ].
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5902
        ].
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5903
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5904
        "
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5905
         now, delete it
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5906
        "
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5907
        self 
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5908
            undoableDo:[self deleteSelection] 
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5909
            info:'Delete'.
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  5910
        lastReplacementInfo lastReplacement: nil
3324
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5911
    ] ifFalse:[
3786
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5912
        "
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5913
         a cut without selection will search&cut again
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5914
        "
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5915
        self undoableDo:[
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5916
            self again
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  5917
        ]
3324
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5918
    ]
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5919
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5920
    "Modified: / 5.4.1998 / 16:51:53 / cg"
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5921
!
1297aecf6699 delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents: 3313
diff changeset
  5922
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  5923
editMenu
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  5924
    "return the views middleButtonMenu"
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  5925
3781
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5926
    <resource: #keyboard (#Again #AgainForAll #Copy #Cut #Paste #Accept 
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5927
                          #Find #GotoLine #SaveAs #Print
3890
4c5c54cf856b +wrapLines
Claus Gittinger <cg@exept.de>
parents: 3886
diff changeset
  5928
                          #PasteFromHistory #Join #Wrap #Undo #Redo 
3781
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5929
                          #ToggleAutoIndent #ToggleInsertMode 
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5930
                          #LearnKeyboardMacro #ExecuteKeyboardMacro )>
1261
bdb18f73205c resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1198
diff changeset
  5931
    <resource: #programMenu>
1054
d699ecd13e60 menu resource
Claus Gittinger <cg@exept.de>
parents: 1049
diff changeset
  5932
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  5933
    |items m sub translateItems sortItems miscItems toolItems subSub toolSub
3569
d3eec21d0ece also show \"what-would-be-done\" in redo item
Claus Gittinger <cg@exept.de>
parents: 3566
diff changeset
  5934
     transSub sortSub what undoIdx redoIdx sensor main mainItems|
1515
9e9b65bd6efb care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1495
diff changeset
  5935
2460
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  5936
    items := #(
3781
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5937
                    ('Redo'             redo           Redo        )
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5938
                    ('Again (for All)'  multipleAgain  AgainForAll )
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5939
                    ('-'                                        )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5940
                    ('Search...'        search         Find     )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5941
                    ('Goto Line...'     gotoLine       GotoLine )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5942
                    ('-'                                        )
4213
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5943
                    ('Tools'            tools                   ) ).
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5944
    CharacterSetView notNil ifTrue:[
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5945
        items := items ,
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5946
                    #(
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5947
                        ('Special Characters...'    specialCharacters  OpenSpecialCharacterWindow )
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5948
                    ).
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5949
    ].
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5950
    items := items , #(
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5951
                    ('-'                                        )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5952
                    ('Save As...'       save           SaveAs   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5953
                    ('Print'            doPrint        Print    )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5954
                    ('='                                        )
4213
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5955
                    ('Misc'             misc           ShiftCtrl) ).
2460
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  5956
2866
9dd71df46f73 specialCharacters menu item
Claus Gittinger <cg@exept.de>
parents: 2857
diff changeset
  5957
    miscItems := #(
3781
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5958
                    ('AutoIndent \c'    autoIndent:                  ToggleAutoIndent )
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5959
                    ('InsertMode \c'    insertMode:                  ToggleInsertMode )
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5960
                    ('-'                                        )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5961
                    ('Paste Previous...'   pasteOrReplaceFromHistory PasteFromHistory )
3781
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5962
                    ('Join Lines'       joinLines                    Join )
4388
558b4dbf5648 changed:
Claus Gittinger <cg@exept.de>
parents: 4373
diff changeset
  5963
                    ('Wrap Lines...'    wrapLines                    Wrap )
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5964
                    ('-'                                        )
3781
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5965
                    ('Learn Macro'      learnMode:                   LearnKeyboardMacro)
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5966
                    ('Execute Macro'    executeLearnedKeyboardMacro  ExecuteKeyboardMacro )
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5967
                    ('-'                                        )
3811
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  5968
                    ('Insert File...'           insertFile          )
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  5969
                    ('Insert URL Contents...'   insertURL           )
3781
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5970
                    ('Insert new UUID'      insertUUID          )
36268d8303d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5971
                    ('Insert Date && Time'  insertDateAndTime   )
3732
30fde62d31e6 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
  5972
                    ('-'                                        )
30fde62d31e6 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
  5973
                    ('Insert File as String Literal...' insertFileAsStringLiteral  )
30fde62d31e6 changed #editMenu
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
  5974
                    ('Paste as String Literal'          pasteAsStringLiteral       )
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5975
                    ('-'                                        )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5976
                ).
4213
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5977
"/    CharacterSetView notNil ifTrue:[
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5978
"/        miscItems := miscItems ,
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5979
"/                    #(
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5980
"/                        ('Special Characters...'    specialCharacters  OpenSpecialCharacterWindow )
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5981
"/                    ).
6045bffe7299 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4199
diff changeset
  5982
"/    ].
3406
c5efa51e7929 dont offer CharacterSetView display in menu, if its not available.
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  5983
    miscItems := miscItems ,
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5984
                #(
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5985
                    ('Font...'                  changeFont              )
2870
994a3a44c526 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  5986
"/                    ('Encoding...'      changeEncoding          )
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5987
                ).
2866
9dd71df46f73 specialCharacters menu item
Claus Gittinger <cg@exept.de>
parents: 2857
diff changeset
  5988
2680
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  5989
    translateItems := #(
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5990
                    ('English -> German'      (babelFishTranslate: 'en_de')   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5991
                    ('English -> French'      (babelFishTranslate: 'en_fr')   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5992
                    ('English -> Italian'     (babelFishTranslate: 'en_it')   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5993
                    ('English -> Spanish'     (babelFishTranslate: 'en_es')   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5994
                    ('English -> Portuguese'  (babelFishTranslate: 'en_pt')   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5995
                    ('-'                                        )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5996
                    ('German -> English'      (babelFishTranslate: 'de_en')   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5997
                    ('French -> English'      (babelFishTranslate: 'fr_en')   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5998
                    ('Italian -> English'     (babelFishTranslate: 'it_en')   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  5999
                    ('Spanish -> English'     (babelFishTranslate: 'es_en')   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6000
                    ('Portuguese -> English'  (babelFishTranslate: 'pt_en')   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6001
              ).
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6002
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6003
    sortItems := #(
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6004
                    ('Lines'                            (sortSelection:ignoreCase: #lines false)        )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6005
                    ('Lines by First Word'              (sortSelection:ignoreCase: #linesByFirstWord false)     )
4373
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6006
                    ('Lines by n''th Word'              (sortSelection:ignoreCase: #linesByNthWord false)       )
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6007
                    ('Lines by n''th Number'            (sortSelection:ignoreCase: #linesByNthNumber false)     )
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6008
                    ('Lines by n''th Hex Number'        (sortSelection:ignoreCase: #linesByNthHexNumber false)     )
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6009
                    ('Words'                            (sortSelection:ignoreCase: #words false)        )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6010
                    ('-'                                                      )
4373
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6011
                    ('Lines (ignore case)'               (sortSelection:ignoreCase: #lines true)         )
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6012
                    ('Lines by First Word (ignore case)' (sortSelection:ignoreCase: #linesByFirstWord true)      )
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6013
                    ('Lines by n''th Word (ignore case)' (sortSelection:ignoreCase: #linesByNthWord true)        )
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6014
                    ('Words (ignore case)'               (sortSelection:ignoreCase: #words true)         )
4763
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6015
                    ('-'                                                      )
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6016
                    ('By Line Length'                    (sortSelection:ignoreCase: #linesByLength nil)         )
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6017
                    ('Reverse'                           (sortSelection:ignoreCase: #reverse       nil)         )
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6018
              ).
2680
208d99c47d7c babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents: 2677
diff changeset
  6019
2762
e29673db4ddb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2757
diff changeset
  6020
    toolItems := #(
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6021
                    ('Indent'                      indent                     )
4287
858f9e8961b6 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 4286
diff changeset
  6022
                    ('Toggle Case'      convertSelectionToLowercaseOrUppercaseOrUppercaseFirst   ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst)
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6023
                    ('Sort'                        sort                       )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6024
                    ('-'                                                      )
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6025
                    ('Google Spell Check'          googleSpellingSuggestion   )
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6026
                    ('Builtin Spell Check'         internalSpellingSuggestion   )
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6027
                    ('Translate'                   babelFishTranslate         )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6028
                    ('Compare with Clipboard...'   compareWithClipboard       )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6029
              ).
2762
e29673db4ddb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2757
diff changeset
  6030
3623
f99c70d99425 close door to fileBrowser and workspace
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  6031
    Smalltalk isStandAloneApp ifFalse:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6032
        toolItems := toolItems , #(
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6033
                        ('-'                                                      )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6034
                        ('Open FileBrowser on It'      openFileBrowserOnIt        )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6035
                        ('Open Workspace with It'      openWorkspaceWithIt        )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6036
                  ).
3623
f99c70d99425 close door to fileBrowser and workspace
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  6037
    ].
f99c70d99425 close door to fileBrowser and workspace
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  6038
2460
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  6039
    sub := PopUpMenu itemList:items resources:resources performer:model.
2461
54d220735048 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2460
diff changeset
  6040
    sub receiver:self.
2460
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  6041
2919
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
  6042
    toolSub := PopUpMenu itemList:toolItems resources:resources performer:model.
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
  6043
    toolSub receiver:self.
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
  6044
    sub subMenuAt:#tools put:toolSub.
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
  6045
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6046
    transSub := PopUpMenu itemList:translateItems resources:resources performer:model.
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6047
    transSub receiver:self.
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6048
    toolSub subMenuAt:#babelFishTranslate put:transSub.
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6049
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6050
    sortSub := PopUpMenu itemList:sortItems resources:resources performer:model.
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6051
    sortSub receiver:self.
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6052
    toolSub subMenuAt:#sort put:sortSub.
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6053
2866
9dd71df46f73 specialCharacters menu item
Claus Gittinger <cg@exept.de>
parents: 2857
diff changeset
  6054
    subSub := PopUpMenu itemList:miscItems resources:resources performer:model.
9dd71df46f73 specialCharacters menu item
Claus Gittinger <cg@exept.de>
parents: 2857
diff changeset
  6055
    subSub receiver:self.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  6056
    subSub checkToggleAt:#autoIndent: put:autoIndent.
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  6057
    subSub checkToggleAt:#insertMode: put:(self isInInsertMode).
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  6058
    subSub checkToggleAt:#learnMode: put:(self learnModeHolder value).
3907
e4be6bf71a98 Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents: 3890
diff changeset
  6059
2866
9dd71df46f73 specialCharacters menu item
Claus Gittinger <cg@exept.de>
parents: 2857
diff changeset
  6060
    sub subMenuAt:#misc put:subSub.
9dd71df46f73 specialCharacters menu item
Claus Gittinger <cg@exept.de>
parents: 2857
diff changeset
  6061
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6062
    mainItems := #(
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6063
                    ('Undo'    undo             Undo   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6064
                    ('Again'   again            Again  )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6065
                    ('-'                               )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6066
                    ('Cut'     cut              Cut    )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6067
                    ('Copy'    copySelection    Copy   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6068
                    ('Paste'   pasteOrReplace   Paste  )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6069
                    ('-'                               )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6070
                    ('Accept'  accept           Accept )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6071
                    ('='                               )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6072
                    ('More'    others           Ctrl   )
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6073
              ).
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6074
    main := PopUpMenu itemList:mainItems resources:resources.
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6075
    main subMenuAt:#others put:sub.
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6076
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6077
    sensor := self sensor.
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6078
    (sensor notNil and:[sensor ctrlDown]) ifTrue:[
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6079
       sensor shiftDown ifTrue:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6080
            m := subSub
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6081
        ] ifFalse:[
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6082
            m := sub
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6083
        ]
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  6084
    ] ifFalse:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6085
        m := main
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  6086
    ].
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  6087
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6088
    "/ the 'Smalltalk at:' code is here to
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6089
    "/ avoid making the SOAP package a prerequisite for this package (libwidg)
4373
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6090
    (Smalltalk at:#'SOAP::GoogleClient') isNil ifTrue:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6091
        "/ GoogleClient new spellingSuggestionOf: 'Smmalltlaak and Soaap'.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6092
        m disable:#googleSpellingSuggestion
2676
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6093
    ].
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6094
    (Smalltalk at:#'RBSpellChecker') isNil ifTrue:[
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6095
        m disable:#internalSpellingSuggestion
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6096
    ].
2676
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6097
3811
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6098
    HTTPInterface isNil ifTrue:[
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6099
        m disableAll:#(insertURL)
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6100
    ].
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6101
1733
c5139b7402f0 use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
  6102
    self isReadOnly ifTrue:[
4475
ca13f24cb1f3 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4464
diff changeset
  6103
        m disableAll:#(accept undo again multipleAgain redo
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6104
                       paste pasteOrReplace pasteOrReplaceFromHistory
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6105
                       cut indent autoIndent: insertMode:
3811
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6106
                       insertFile insertFileAsStringLiteral insertURL
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6107
                       babelFishTranslate googleSpellingSuggestion sort
4475
ca13f24cb1f3 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4464
diff changeset
  6108
                       convertSelectionToLowercaseOrUppercaseOrUppercaseFirst 
4764
bf1d2ec07858 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4763
diff changeset
  6109
                       joinLines wrapLines insertUUID insertDateAndTime pasteAsStringLiteral
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6110
                       specialCharacters)
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  6111
    ].
2817
7c82a9535b96 not ifTrue -> ifFalse
Claus Gittinger <cg@exept.de>
parents: 2815
diff changeset
  6112
    self hasSelectionForCopy ifFalse:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6113
        m disable:#copySelection.
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  6114
    ].
2416
56acdd9e31b5 lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents: 2406
diff changeset
  6115
    self hasSelection ifFalse:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6116
        m disableAll:#(cut googleSpellingSuggestion babelFishTranslate openFileBrowserOnIt openWorkspaceWithIt sort indent).
2762
e29673db4ddb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2757
diff changeset
  6117
    ] ifTrue:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6118
        (Error handle:[:ex |
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6119
            ex return:false
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6120
        ] do:[
4042
2dac2f89e877 changed:
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  6121
            |fn|
2dac2f89e877 changed:
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  6122
            fn := self selectionAsString.
2dac2f89e877 changed:
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  6123
            fn asFilename exists or:[ fn withoutSeparators withoutQuotes asFilename exists ]
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6124
        ]) ifFalse:[
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6125
            m disableAll:#(openFileBrowserOnIt).
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6126
        ]
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  6127
    ].
2569
b499c81c58ae added hasUndoAction query.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  6128
    self hasUndoAction ifFalse:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6129
        m disable:#undo.
3115
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  6130
    ] ifTrue:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6131
        what := undoSupport undoActionInfo.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6132
        what notNil ifTrue:[
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6133
            undoIdx := m indexOf:#undo.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6134
            m labelAt:undoIdx put:(resources string:'Undo (%1)' with:what).
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6135
        ]
1818
aa16d9b96e40 fixed cut to not compress multiple blanks.
Claus Gittinger <cg@exept.de>
parents: 1817
diff changeset
  6136
    ].
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  6137
    self hasRedoAction ifFalse:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6138
        sub disable:#redo.
3569
d3eec21d0ece also show \"what-would-be-done\" in redo item
Claus Gittinger <cg@exept.de>
parents: 3566
diff changeset
  6139
    ] ifTrue:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6140
        what := undoSupport redoActionInfo.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6141
        what notNil ifTrue:[
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6142
            redoIdx := sub indexOf:#redo.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6143
            sub labelAt:redoIdx put:(resources string:'Redo (%1)' with:what).
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6144
        ]
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  6145
    ].
1108
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  6146
    acceptEnabled == false ifTrue:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6147
        m disable:#accept
1108
3d14bb6bceb7 added disableAccept
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  6148
    ].
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  6149
    ^ m.
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  6150
4388
558b4dbf5648 changed:
Claus Gittinger <cg@exept.de>
parents: 4373
diff changeset
  6151
    "Modified: / 01-03-2012 / 19:56:58 / cg"
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  6152
!
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
  6153
2544
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6154
getTextSelectionFromHistory
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6155
    |sel list box history|
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6156
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6157
    history := device getCopyBufferHistory copy.
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6158
    list := history collect:[:entry |
4165
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6159
                |text shown|
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6160
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6161
                text := entry asString string asCollectionOfLines.
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6162
                shown := text detect:[:line| line notEmptyOrNil] ifNone:['      '].
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6163
                text size > 1 ifTrue:[
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6164
                    shown := shown,(resources string:' ... [%1 lines]' with:text size).
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6165
                ].
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6166
                shown
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6167
            ].
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6168
2544
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6169
    box := ListSelectionBox
4165
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6170
                title:(resources string:'Clipboard History')
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6171
                okText:(resources string:'Paste')
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6172
                abortText:(resources string:'Cancel')
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6173
                list:list
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6174
                action:[:idx | idx notNil ifTrue:[sel := history at:idx]].
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6175
    box label:(resources string:'Select Previous Copybuffer String').
2544
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6176
    box useIndex:true.
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6177
    box show.
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6178
    ^ sel.
4165
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6179
869b207a6964 changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  6180
    "Modified: / 25-08-2010 / 22:02:14 / cg"
2544
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6181
!
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6182
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6183
getTextSelectionOrTextSelectionFromHistory
2730
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2725
diff changeset
  6184
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2725
diff changeset
  6185
    self sensor shiftDown ifTrue:[
3855
8607bb2b8b6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3825
diff changeset
  6186
        ^ self getTextSelectionFromHistory
2544
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6187
    ].
2724
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6188
4285
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6189
    "/ return either the (xterm-) selection or the clipBoard depending on
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6190
    "/ the Ctrl-Key state.
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6191
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6192
    "/ ouch - this used to be ok for ALT-c / ALT-v,
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6193
    "/ but no longer works with CTRL-c / CTRL-v.
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6194
    ^ self getClipboardText:#clipboard
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6195
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6196
"/    ^ self
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6197
"/        getClipboardText:(self sensor ctrlDown
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6198
"/                            ifTrue:[#selection]
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6199
"/                            ifFalse:[#clipboard])
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6200
8487c7a8fab0 changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents: 4275
diff changeset
  6201
    "Modified: / 13-07-2011 / 14:55:58 / cg"
2544
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6202
!
48ab4ed67816 shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents: 2540
diff changeset
  6203
2676
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6204
googleSpellingSuggestion
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6205
    "insert the google-spelling suggestion for the selected text.
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6206
     Requires that the SOAP stuff is loaded and working."
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6207
2677
afb234f8b822 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  6208
    |text suggestion|
2676
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6209
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6210
    self withWaitCursorDo:[
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6211
        text := self selection asString string withoutSeparators.
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6212
        text size == 0 ifTrue:[^ self].
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6213
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6214
        "/ the 'Smalltalk at:' code is here to
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6215
        "/ avoid making the SOAP package a prerequisite for this package (libwidg)
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6216
        (Smalltalk at:#'SOAP::SoapImplError') handle:[:ex |
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6217
            Dialog warn:('Spelling correction failed - WEB Service error:\\%1.' bindWith:ex description allBold) withCRs.
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6218
            ^ self.
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6219
        ] do:[
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6220
            suggestion := (Smalltalk at:#'SOAP::GoogleClient') new spellingSuggestionOf:text.
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6221
        ].
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6222
        suggestion size == 0 ifTrue:[
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6223
            self information:('No spelling suggestion from Google for: ' , text).
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6224
            Transcript showCR:('No spelling suggestion from Google for: ' , text).
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6225
            ^ self.
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6226
        ].
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6227
    ].
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6228
    self 
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6229
        undoablePaste:suggestion 
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6230
        info:'Spelling Suggestion'.
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6231
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6232
    "Modified: / 28-07-2007 / 13:25:10 / cg"
2676
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6233
!
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6234
3595
9277e3a4d2e9 paste date and time added
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
  6235
insertDateAndTime
9277e3a4d2e9 paste date and time added
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
  6236
    "insert the curent date and time string"
9277e3a4d2e9 paste date and time added
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
  6237
9277e3a4d2e9 paste date and time added
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
  6238
    typeOfSelection := nil.
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6239
    self
3786
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  6240
        undoableDo:[ self pasteOrReplace:(Timestamp now printStringRFC1123Format)]
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6241
        info:'Paste Date and Time'
3595
9277e3a4d2e9 paste date and time added
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
  6242
!
9277e3a4d2e9 paste date and time added
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
  6243
2676
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6244
insertFile
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6245
    "insert contents of a file
2676
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6246
     - ask user for filename using a fileSelectionBox."
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6247
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6248
    self insertFileAsStringLiteral:false
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6249
!
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6250
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6251
insertFileAsStringLiteral
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6252
    "insert a file's contents as a string literal.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6253
     Almost the same as the insert file, but single-quotes are doubled,
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6254
     to make it a legal string literal"
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6255
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6256
    self insertFileAsStringLiteral:true
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6257
!
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6258
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6259
insertFileAsStringLiteral:asStringLiteral
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6260
    "insert contents of a file; either as-is or as a string literal.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6261
     - ask user for filename using a fileSelectionBox."
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6262
3409
d650e3ae9085 insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents: 3406
diff changeset
  6263
    |sel selFn file text ok initial|
d650e3ae9085 insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents: 3406
diff changeset
  6264
d650e3ae9085 insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents: 3406
diff changeset
  6265
    ((sel := self selectionAsString) notEmptyOrNil
d650e3ae9085 insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents: 3406
diff changeset
  6266
    and:[ (selFn := sel asFilename) exists
d650e3ae9085 insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents: 3406
diff changeset
  6267
    and:[ selFn isRegularFile ]])
d650e3ae9085 insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents: 3406
diff changeset
  6268
    ifTrue:[
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6269
        initial := selFn pathName.
3409
d650e3ae9085 insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents: 3406
diff changeset
  6270
    ].
2757
b98097eaf8dc Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents: 2756
diff changeset
  6271
b98097eaf8dc Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents: 2756
diff changeset
  6272
    [
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6273
        |why|
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6274
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6275
        file := Dialog
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6276
            requestFileName:(resources string:'Insert Contents Of:')
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6277
            default:initial
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6278
            ok:(resources string:'Insert')
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6279
            abort:(resources string:'Cancel')
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6280
            pattern:nil
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6281
            fromDirectory:directoryForFileDialog.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6282
        file isNil ifTrue:[
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6283
            "cancel"
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6284
            ^ self.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6285
        ].
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6286
        file := file asFilename.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6287
        directoryForFileDialog := file.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6288
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6289
        ok := file isReadable and:[file isDirectory not].
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6290
        ok ifFalse:[
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6291
            file isReadable ifFalse:[
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6292
                why := '%1 is unreadable.\\Please try again.'
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6293
            ] ifTrue:[
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6294
                why := '%1 is a directory.\\Please try again.'
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6295
            ].
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6296
            Dialog warn:(resources stringWithCRs:why with:file pathName).
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6297
        ].
2909
a43e1343718f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2901
diff changeset
  6298
    ] doUntil:[ok].
2757
b98097eaf8dc Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents: 2756
diff changeset
  6299
b98097eaf8dc Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents: 2756
diff changeset
  6300
    text := file contentsOfEntireFile.
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6301
    self
3786
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  6302
        undoableDo:[ self paste:(asStringLiteral ifTrue:[text storeString] ifFalse:[text]) ]
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6303
        info:'Paste File'
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6304
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6305
    "Modified: / 28-07-2007 / 13:23:32 / cg"
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6306
!
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6307
3811
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6308
insertURL
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6309
    "insert contents of a URL
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6310
     - ask user for URL using a dialog."
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6311
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6312
    self insertURLAsStringLiteral:false
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6313
!
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6314
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6315
insertURLAsStringLiteral:asStringLiteral
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6316
    "insert contents of a file; either as-is or as a string literal.
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6317
     - ask user for filename using a fileSelectionBox."
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6318
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6319
    |sel url text response initial|
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6320
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6321
    (sel := self selectionAsString) notEmptyOrNil
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6322
    ifTrue:[
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6323
        initial := sel.
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6324
    ].
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6325
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6326
    url := Dialog
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6327
        request:(resources string:'Insert Contents of URL:')
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6328
        initialAnswer:initial
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6329
        okLabel:(resources string:'Insert')
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6330
        title:(resources string:'URL').
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6331
    url isNil ifTrue:[
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6332
        "cancel"
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6333
        ^ self.
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6334
    ].
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6335
    response := HTTPInterface get:url.
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6336
    response isErrorResponse ifTrue:[
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6337
        Dialog warn:(resources string:'Could not fetch the document: %1' with:url).
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6338
        ^ self.
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6339
    ].
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6340
    text := response data asString.
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6341
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6342
    self
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6343
        undoableDo:[ 
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6344
            self paste:(asStringLiteral ifTrue:[text storeString] ifFalse:[text]) 
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6345
        ]
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6346
        info:'Insert Contents of URL'
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6347
!
a56e6f74ee4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  6348
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6349
insertUUID
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6350
    "insert a new UUID's string"
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6351
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6352
    typeOfSelection := nil.
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6353
    self
3786
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  6354
        undoableDo:[ self pasteOrReplace:(UUID genUUID printString)]
3799
f6cbe8d860d5 code formatting
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6355
        info:'Paste New UUID'
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6356
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6357
    "Created: / 28-07-2007 / 13:01:16 / cg"
2676
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6358
!
cc61fa88a3fb google spelling;
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
  6359
4742
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6360
internalSpellingSuggestion
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6361
    "insert the internal-spelling suggestion for the selected text.
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6362
     Requires that the RefactoryBrowser/line/spelCheck stuff is loaded."
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6363
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6364
    |text suggestions best|
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6365
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6366
    self withWaitCursorDo:[
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6367
        text := self selection asString string withoutSeparators.
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6368
        text size == 0 ifTrue:[^ self].
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6369
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6370
        suggestions := RBSpellChecker default bestMatchesFor:text.
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6371
        suggestions size == 0 ifTrue:[
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6372
            self information:('No spelling suggestion from builtin checker for: ' , text).
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6373
            Transcript showCR:('No spelling suggestion from builtin checker for: ' , text).
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6374
            ^ self.
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6375
        ].
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6376
        Transcript showCR:suggestions.
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6377
        best := suggestions first.
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6378
    ].
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6379
    self 
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6380
        undoablePaste:best 
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6381
        info:'Spelling Suggestion'.
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6382
!
a00cb40ee392 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4738
diff changeset
  6383
2762
e29673db4ddb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2757
diff changeset
  6384
openFileBrowserOnIt
e29673db4ddb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2757
diff changeset
  6385
    "open a fileBrowser on the selected fileName"
e29673db4ddb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2757
diff changeset
  6386
4630
b043ca9e5060 class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4623
diff changeset
  6387
    |fn|
2762
e29673db4ddb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2757
diff changeset
  6388
e29673db4ddb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2757
diff changeset
  6389
    fn := self selectionAsString asFilename.
e29673db4ddb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2757
diff changeset
  6390
    fn exists ifFalse:[
4042
2dac2f89e877 changed:
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  6391
        fn := self selectionAsString withoutSeparators withoutQuotes asFilename.
2dac2f89e877 changed:
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  6392
        fn exists ifFalse:[
2dac2f89e877 changed:
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  6393
            ^ self warn:'Oops - file is gone'.
2dac2f89e877 changed:
Claus Gittinger <cg@exept.de>
parents: 4041
diff changeset
  6394
        ].
2762
e29673db4ddb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2757
diff changeset
  6395
    ].
4449
59fe55c937ea changed: #openFileBrowserOnIt
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  6396
    UserPreferences fileBrowserClass openOn:fn
59fe55c937ea changed: #openFileBrowserOnIt
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  6397
59fe55c937ea changed: #openFileBrowserOnIt
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  6398
    "Modified: / 06-09-2012 / 14:47:22 / cg"
2762
e29673db4ddb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2757
diff changeset
  6399
!
e29673db4ddb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2757
diff changeset
  6400
3483
8ef0f9a0737f +openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  6401
openWorkspaceWithIt
8ef0f9a0737f +openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  6402
    "open a workspace containing the selected text"
8ef0f9a0737f +openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  6403
8ef0f9a0737f +openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  6404
    |text|
8ef0f9a0737f +openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  6405
8ef0f9a0737f +openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  6406
    text := self selectionAsString.
8ef0f9a0737f +openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  6407
    WorkspaceApplication openWith:text selected:true
8ef0f9a0737f +openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  6408
8ef0f9a0737f +openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  6409
    "Created: / 26-05-2007 / 06:05:22 / cg"
8ef0f9a0737f +openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  6410
!
8ef0f9a0737f +openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents: 3482
diff changeset
  6411
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6412
paste
1289
e2dcc5fe612c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1287
diff changeset
  6413
    "paste the copybuffer; if there is a selection, unselect first.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6414
     Then paste at cursor position."
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6415
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  6416
    self checkModificationsAllowed ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6417
	self withSelfAndTextForPasteDo:[:me :text |
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6418
	    me unselect.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6419
	    me undoablePaste:text
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6420
	]
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  6421
    ]
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6422
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6423
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6424
paste:someText
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6425
    "paste someText at cursor"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6426
3825
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6427
    self paste:someText withCR:false
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6428
!
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6429
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6430
paste:someText withCR:withCR
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6431
    "paste someText at cursor"
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6432
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  6433
    |s nLines startLine startCol l1 l2 c1 c2 codingErrorReported|
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6434
1480
eabb1848e2fa fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
  6435
    self checkModificationsAllowed ifFalse:[^ self].
2853
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6436
    someText isNil ifTrue:[^ self].
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6437
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6438
    s := someText.
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  6439
    codingErrorReported := false.
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  6440
    CharacterEncoderError handle:[:ex |
3825
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6441
        |code msg|
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6442
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6443
        code := ex parameter.
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6444
        codingErrorReported ifFalse:[
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6445
            msg := 'Cannot represent pasted string in this Views encoding (',characterEncoding,').'.
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6446
            code notNil ifTrue:[
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6447
                msg := msg , '\\Reason: No representation for ' , (code radixPrintStringRadix:16).
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6448
            ].
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6449
            Dialog warn:(resources stringWithCRs:msg).
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6450
            codingErrorReported := true.
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6451
        ].
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6452
        ex proceedWith:ex defaultValue
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  6453
    ] do:[
3825
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6454
        s isString ifTrue:[
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6455
            s encoding ~~ characterEncoding ifTrue:[
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6456
                s := s encodeFrom:(s encoding) into:characterEncoding.
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6457
            ].
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6458
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6459
            s := s asStringCollection.
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6460
            (someText endsWith:Character cr) ifTrue:[
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6461
                "/ s := s copyWith:nil.
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6462
                s := s copyWith:'' "/ an empty line at the end
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6463
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6464
            ]
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6465
        ] ifFalse:[
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6466
            s isStringCollection ifTrue:[
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6467
                s := s encodeFrom:(s encoding) into:characterEncoding.
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6468
            ] ifFalse:[
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6469
                (self
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6470
                    confirm:(resources
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6471
                        stringWithCRs:'Selection (%1) is not convertable to Text.\\Paste storeString ?'
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6472
                        with:s class name)) ifFalse:[^ self].
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6473
                s := StringCollection with:s storeString .
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6474
                "/ ^ self
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6475
            ].
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6476
        ].
2856
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  6477
    ].
bc6bb86d4d2e character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents: 2854
diff changeset
  6478
2853
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6479
    (nLines := s size) == 0 ifTrue:[^ self].
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6480
    (nLines == 1 and:[(s at:1) size == 0]) ifTrue:[^ self].
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6481
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6482
    typeOfSelection := #paste.
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6483
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6484
    startLine := l1 := cursorLine.
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6485
    startCol := c1 := cursorCol.
3180
609f340fd96c paste - do not expand tabs!
Michael Beyl <mb@exept.de>
parents: 3161
diff changeset
  6486
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  6487
    "do not expand tabs into spaces here -
3180
609f340fd96c paste - do not expand tabs!
Michael Beyl <mb@exept.de>
parents: 3161
diff changeset
  6488
     they get expanded in basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr.
609f340fd96c paste - do not expand tabs!
Michael Beyl <mb@exept.de>
parents: 3161
diff changeset
  6489
     Some Subviews want to paste with unexpanded tabs!!"
609f340fd96c paste - do not expand tabs!
Michael Beyl <mb@exept.de>
parents: 3161
diff changeset
  6490
3825
184c9b081973 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3816
diff changeset
  6491
    self insertLines:s withCR:withCR.
2853
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6492
    l2 := cursorLine.
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6493
    c2 := (cursorCol - 1).
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6494
    self selectFromLine:l1 col:c1 toLine:l2 col:c2.
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6495
    typeOfSelection := #paste. "/ sigh - cleared by #selectFromLine:
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  6496
    "/ For Claus to support paste-cursordown-paste :-)
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  6497
    "/ Move cursor the the beggining of the selection so subsequent
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  6498
    "/ cursor move will start there.
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  6499
    self setCursorLine: l1.
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  6500
    self setCursorCol: c1.
2853
f8c1d3963b49 preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  6501
4328
ea91d179b5f0 changed:
Claus Gittinger <cg@exept.de>
parents: 4289
diff changeset
  6502
    "Modified: / 14-02-1996 / 11:14:14 / stefan"
4360
fe77e479d95a comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4328
diff changeset
  6503
    "Modified: / 25-01-2012 / 00:31:30 / cg"
4844
269a12794578 Selection refactoring, part 3: support for paste-cursordown-paste
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4843
diff changeset
  6504
    "Modified: / 30-08-2013 / 00:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6505
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6506
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6507
pasteAsStringLiteral
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6508
    "insert clipboard string as a string literal.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6509
     Almost the same as a normal paste, but single-quotes are doubled,
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6510
     to make it a legal string literal"
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6511
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6512
    typeOfSelection := nil.
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6513
    self
3786
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  6514
        undoableDo:[ self pasteOrReplace:(self getClipboardText storeString) ]
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  6515
        info:'Paste as String Literal'
3731
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6516
!
041b0c7ad557 +insert as literal
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6517
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6518
pasteOrReplace
1289
e2dcc5fe612c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1287
diff changeset
  6519
    "paste the copybuffer; if there is a selection, replace it.
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6520
     otherwise paste at cursor position.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6521
     Replace is not done for selections which were created by a paste,
2010
ca8dcc8723dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1993
diff changeset
  6522
     to allow multiple paste operations in a row."
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6523
2724
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6524
    self withSelfAndTextForPasteDo:[:me :text | me pasteOrReplace:text]
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6525
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6526
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6527
pasteOrReplace:someText
1289
e2dcc5fe612c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1287
diff changeset
  6528
    "paste someText; if there is a selection, replace it.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6529
     otherwise paste at cursor position. Replace is not done
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6530
     for originating by a paste, to allow multiple
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6531
     paste."
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6532
1480
eabb1848e2fa fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
  6533
    self checkModificationsAllowed ifFalse:[^ self].
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  6534
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  6535
    self undoableDo:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6536
	((self hasSelection == true) and:[typeOfSelection ~~ #paste]) ifTrue:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6537
	    self replace:someText
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6538
	] ifFalse:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6539
	    self paste:someText.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6540
	]
3542
30ed44ed0178 +joinLines (CTRL-j);
Claus Gittinger <cg@exept.de>
parents: 3517
diff changeset
  6541
    ] info:'Paste/Replace'.
1289
e2dcc5fe612c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1287
diff changeset
  6542
2107
9d44232af0a0 textSelection fixes (added newLine) for MSDOS;
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
  6543
    "Modified: / 30.1.2000 / 02:33:00 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6544
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6545
3474
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6546
pasteOrReplaceFromHistory
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6547
    "paste a previous item from the copybuffer history.
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6548
     (i.e. repaste some previously deleted or copied text)"
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6549
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6550
    |text|
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6551
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6552
    self checkModificationsAllowed ifFalse:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6553
	self flash.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6554
	^ self
3474
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6555
    ].
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6556
    text := self getTextSelectionFromHistory.
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6557
    text notNil ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6558
	self pasteOrReplace:text
3474
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6559
    ]
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6560
!
357e16440725 slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
  6561
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6562
replace
1289
e2dcc5fe612c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1287
diff changeset
  6563
    "replace the selection by the contents of the copybuffer"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6564
3269
03d04670a5d2 replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  6565
    self hasSelection ifFalse:[^ self].
03d04670a5d2 replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  6566
    self checkModificationsAllowed ifFalse:[^ self].
03d04670a5d2 replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  6567
03d04670a5d2 replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  6568
    self withSelfAndTextForPasteDo:[:me :text |
3786
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  6569
        me undoableDo:[ me replace:text ]
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  6570
        info:'Replace'
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  6571
    ]
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6572
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6573
121
claus
parents: 118
diff changeset
  6574
replace:someText
1289
e2dcc5fe612c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1287
diff changeset
  6575
    "replace the selection by someText"
121
claus
parents: 118
diff changeset
  6576
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6577
    |selected selectedString
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6578
     selStartLine selStartCol selEndLine selEndCol|
121
claus
parents: 118
diff changeset
  6579
1480
eabb1848e2fa fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
  6580
    self checkModificationsAllowed ifFalse:[^ self].
eabb1848e2fa fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
  6581
3130
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  6582
    self undoableDo:[
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6583
        selected := self selection.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6584
        selected isNil ifTrue:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6585
            ^ self paste:someText
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6586
        ].
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6587
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6588
        self deleteSelection.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6589
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6590
        "take care, if we replace a selection without space by a word selected
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6591
         with one - in this case we usually do not want the space.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6592
         But, if we replace a word-selected selection by something without a
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6593
         space, we DO want the space added."
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6594
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6595
        selected size == 1 ifTrue:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6596
            selectedString := selected at:1.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6597
        ].
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6598
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6599
        someText size == 1 ifTrue:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6600
            |cutOffSpace addSpace replacement replacementString|
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6601
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6602
            cutOffSpace := false.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6603
            addSpace := false.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6604
            replacement := someText copyFrom:1.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6605
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6606
            selectedString notNil ifTrue:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6607
                ((selectedString startsWith:' ') or:[selectedString endsWith:' ']) ifFalse:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6608
                   "selection has no space"
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6609
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6610
                    ((selectStyle == #wordleft) or:[selectStyle == #wordRight]) ifTrue:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6611
                        cutOffSpace := true
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6612
                    ]
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6613
                ] ifTrue:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6614
                    addSpace := true
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6615
                ]
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6616
            ].
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6617
            replacementString := replacement at:1.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6618
            cutOffSpace ifTrue:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6619
                (replacementString startsWith:' ') ifTrue:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6620
                    replacementString := replacementString withoutSpaces
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6621
                ].
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6622
            ] ifFalse:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6623
                selectStyle == #wordLeft ifTrue:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6624
                    "want a space at left"
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6625
                    (replacementString startsWith:' ') ifFalse:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6626
                        replacementString := replacementString withoutSpaces.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6627
                        replacementString := ' ' , replacementString
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6628
                    ]
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6629
                ].
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6630
                selectStyle == #wordRight ifTrue:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6631
                    "want a space at right"
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6632
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6633
                    (replacementString endsWith:' ') ifFalse:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6634
                        replacementString := replacementString withoutSpaces.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6635
                        replacementString := replacementString , ' '
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6636
                    ]
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6637
                ].
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6638
            ].
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6639
            replacement at:1 put: replacementString.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6640
            self paste:replacement.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6641
        ] ifFalse:[
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6642
            self paste:someText
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6643
        ].
4053
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  6644
        self setLastStringToReplace: selectedString.
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  6645
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  6646
        lastReplacementInfo lastReplacement: someText.
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6647
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6648
        selStartLine := selectionStartLine.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6649
        selStartCol := self selectionStartCol.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6650
        selEndLine := selectionEndLine.
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  6651
        selEndCol := self selectionEndCol.
3130
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  6652
    ]
3542
30ed44ed0178 +joinLines (CTRL-j);
Claus Gittinger <cg@exept.de>
parents: 3517
diff changeset
  6653
    info:'Replace'
362
3993ba6c31a0 Expand tabs before pasting a string.
Stefan Vogel <sv@exept.de>
parents: 331
diff changeset
  6654
1480
eabb1848e2fa fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
  6655
    "Modified: / 14.2.1996 / 10:37:02 / stefan"
eabb1848e2fa fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents: 1476
diff changeset
  6656
    "Modified: / 5.4.1998 / 16:55:28 / cg"
121
claus
parents: 118
diff changeset
  6657
!
claus
parents: 118
diff changeset
  6658
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6659
searchReplace
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6660
    "search for a string - show a box to enter searchpattern
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6661
     replace for the found searchpattern or replace all searchpattern found to a new pattern - show  a box to enter replacepattern
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6662
     - currently no regular expressions are handled."
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6663
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6664
    |searchBox patternHolder replacePatternHolder caseHolder flag ign initialString bindings bldr search modal replace action|
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6665
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6666
    modal := false "(UserPreferences current searchDialogIsModal)".
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6667
    lastSearchDirection := #forward.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6668
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6669
    caseHolder := ign asValue.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6670
    patternHolder := '' asValue.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6671
    replacePatternHolder := '' asValue.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6672
    lastSearchPattern notNil ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6673
	initialString := lastSearchPattern
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6674
    ].
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6675
    self hasSelectionWithinSingleLine ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6676
	initialString := self selectionAsString
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6677
    ].
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6678
    initialString isNil ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6679
	LastSearchPatterns size > 0 ifTrue:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6680
	    initialString := LastSearchPatterns first
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6681
	]
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6682
    ].
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6683
    initialString notNil ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6684
	patternHolder value:initialString.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6685
	replacePatternHolder value:initialString.
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6686
    ].
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6687
    flag := true.
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6688
    search := [:fwd |
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6689
	    self
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6690
		search:patternHolder value
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6691
		ignoreCase:caseHolder value
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6692
		forward:fwd.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6693
	].
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6694
    replace := [:all |
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6695
	    self
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6696
		replace:patternHolder value
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6697
		by:replacePatternHolder value
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6698
		all:all
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6699
		ignoreCase:caseHolder value
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6700
	].
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6701
    bindings := IdentityDictionary new.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6702
    bindings at:#searchPattern put:patternHolder.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6703
    bindings at:#replacePattern put:replacePatternHolder.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6704
    modal ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6705
	bindings at:#nextAction
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6706
	    put:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6707
		flag := true.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6708
		action := search.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6709
		searchBox doAccept.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6710
	    ].
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6711
	bindings at:#prevAction
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6712
	    put:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6713
		flag := false.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6714
		action := search.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6715
		searchBox doAccept.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6716
	    ].
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6717
	bindings at:#replaceAction
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6718
	    put:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6719
		flag := false.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6720
		action := replace.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6721
		searchBox doAccept.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6722
	    ].
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6723
	bindings at:#replaceAllAction
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6724
	    put:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6725
		flag := true.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6726
		action := replace.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6727
		searchBox doAccept.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6728
	    ].
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6729
    ] ifFalse:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6730
	bindings at:#nextAction put:[ search value:true. ].
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6731
	bindings at:#prevAction put:[ search value:false. ].
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6732
	bindings at:#replaceAction put:[ replace value:false. ].
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6733
	bindings at:#replaceAllAction put:[ replace value:true. ].
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6734
    ].
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6735
    bindings at:#ignoreCase put:caseHolder.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6736
    bindings at:#patternList put:LastSearchPatterns.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6737
    modal ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6738
	searchBox := SimpleDialog new.
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6739
    ] ifFalse:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6740
	searchBox := ApplicationModel new.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6741
	searchBox createBuilder.
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6742
    ].
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6743
    searchBox resources:(self resources).
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6744
    bldr := searchBox builder.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6745
    bldr addBindings:bindings.
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6746
    searchBox allButOpenFrom:(self class searchReplaceDialogSpec).
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6747
    (bldr componentAt:#nextButton) cursor:(Cursor thumbsUp).
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6748
    (bldr componentAt:#prevButton) cursor:(Cursor thumbsUp).
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6749
    (bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown).
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6750
    modal ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6751
	searchBox openDialog.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6752
	searchBox accepted ifTrue:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6753
	    action value:flag
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6754
	].
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6755
    ] ifFalse:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6756
	(bldr componentAt:#nextButton) isReturnButton:false.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6757
	(bldr componentAt:#cancelButton)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6758
	    label:(resources string:'Close');
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6759
	    action:[ searchBox closeRequest ].
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6760
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6761
	"/ searchBox masterApplication:self application.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6762
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6763
	self topView beMaster.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6764
	(searchBox window)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6765
	    beSlave;
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6766
	    openInGroup:(self windowGroup).
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6767
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6768
	"/ searchBox window open.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6769
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6770
	searchBox window assignKeyboardFocusToFirstInputField.
3430
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6771
    ]
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6772
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6773
    "Modified: / 11-07-2006 / 11:20:06 / fm"
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6774
!
1b0bc1af37e4 searchReplace
fm
parents: 3422
diff changeset
  6775
121
claus
parents: 118
diff changeset
  6776
showDeleted
claus
parents: 118
diff changeset
  6777
    "open a readonly editor on all deleted text"
claus
parents: 118
diff changeset
  6778
claus
parents: 118
diff changeset
  6779
    |v|
claus
parents: 118
diff changeset
  6780
claus
parents: 118
diff changeset
  6781
    v := EditTextView openWith:(Smalltalk at:#DeleteHistory).
1733
c5139b7402f0 use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
  6782
    v readOnly:true.
121
claus
parents: 118
diff changeset
  6783
    v topView label:'deleted text'.
2624
22d352e56c27 preps for special characters
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  6784
!
22d352e56c27 preps for special characters
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  6785
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6786
sort:how ignoreCase:ignoreCase fromLine:start toLine:end
4763
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6787
    "sort/reorder the selected lines.
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6788
     how:
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6789
        #lines
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6790
        #linesByFirstWord
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6791
        #linesByNthWord
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6792
        #linesByNthNumber
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6793
        #linesByNthHexNumber
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6794
        #words
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6795
        #linesByLength
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6796
        #reverse
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6797
    "
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6798
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6799
    |lines extractor innerExtractor fetcher operation lineWise nStr n s words|
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6800
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6801
    lineWise := true.
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6802
4763
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6803
    how == #reverse ifTrue:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6804
        operation := [:lines | lines reverse].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6805
    ] ifFalse:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6806
        operation := [:linesOrWords |
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6807
                        linesOrWords sort:[:item1 :item2 | (fetcher value:item1) < (fetcher value:item2)]
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6808
                     ].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6809
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6810
        how == #linesByLength ifTrue:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6811
            fetcher := [:l | l size].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6812
        ] ifFalse:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6813
            how == #lines ifTrue:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6814
                extractor := [:l | l withoutLeadingSeparators].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6815
            ] ifFalse:[ 
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6816
                how == #linesByFirstWord ifTrue:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6817
                    extractor := [:l | ((l asCollectionOfWords select:[:w | w isEmpty or:[w first isLetterOrDigit]]) at:1 ifAbsent:'')].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6818
                ] ifFalse:[ 
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6819
                    ((how == #linesByNthWord) or:[ how == #linesByNthNumber  or:[ how == #linesByNthHexNumber]]) ifTrue:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6820
                        nStr := Dialog request:'Word/Column (1..)' initialAnswer:(LastColumnNumberForSort ? 2).
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6821
                        nStr isEmptyOrNil ifTrue:[^ self].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6822
                        n := Integer readFrom:nStr onError:[^ self].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6823
                        LastColumnNumberForSort := n.
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6824
                        extractor := [:l | ((l string asCollectionOfWords) at:n ifAbsent:'')].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6825
                        how == #linesByNthNumber ifTrue:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6826
                            innerExtractor := extractor.
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6827
                            extractor := [:l | Integer readFrom:(innerExtractor value:l) onError:0]
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6828
                        ] ifFalse:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6829
                            how == #linesByNthHexNumber ifTrue:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6830
                                innerExtractor := extractor.
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6831
                                extractor := [:l | 
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6832
                                    |s|                                 
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6833
                                    s := innerExtractor value:l.
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6834
                                    (s startsWith:'16r') ifTrue:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6835
                                        (Integer readSmalltalkSyntaxFrom:s) ? 0
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6836
                                    ] ifFalse:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6837
                                        Integer readFrom:s radix:16 onError:[ 0 ]
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6838
                                    ]
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6839
                                ]
4753
4e4aeb12d41f class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4746
diff changeset
  6840
                            ]
4763
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6841
                        ].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6842
                    ] ifFalse:[ 
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6843
                        how == #words ifTrue:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6844
                            lineWise := false.
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6845
                            extractor := [:w | w].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6846
                        ] ifFalse:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6847
                            self error:'unknown sort criteria: ', how printString.
4753
4e4aeb12d41f class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4746
diff changeset
  6848
                        ]
4373
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6849
                    ]
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6850
                ]
4763
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6851
            ].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6852
            ignoreCase ifTrue:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6853
                fetcher := [:l | (extractor value:l) asLowercase].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6854
            ] ifFalse:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6855
                fetcher := extractor.
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6856
            ].
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6857
        ].
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6858
    ].
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6859
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6860
    lineWise ifTrue:[
4763
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6861
        "process the lines of the selection (aka a collection of lines)"
4373
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6862
        start == end ifTrue:[^ self ].
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6863
        lines := (start to:end) collect:[:lineNr | (self listAt:lineNr) ? ''].
4763
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6864
        lines := operation value:lines.
4373
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6865
        (start to:end) with:lines do:[:lineNr :line | self replaceLine:lineNr with:line].
4763
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6866
    ] ifFalse:[
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6867
        "process the whole selection as a string"
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6868
        s := self selectionAsString.
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6869
        words := s asCollectionOfWords.
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6870
        words := operation value:words.
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6871
        s := words asStringCollection asStringWith:Character space.
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6872
        self replace:s.
89bf20c2e8f5 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4753
diff changeset
  6873
    ].
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6874
    self textChanged.
4373
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6875
4414
308d40ee857b changed: #sort:ignoreCase:fromLine:toLine:
Claus Gittinger <cg@exept.de>
parents: 4396
diff changeset
  6876
    "Modified: / 31-03-2012 / 10:59:28 / cg"
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6877
!
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6878
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6879
sortSelection:how ignoreCase:ignoreCase
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6880
    "sort the selected lines"
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6881
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6882
    |start end|
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6883
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6884
    selectionStartLine isNil ifTrue:[^ self].
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6885
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6886
    start := selectionStartLine.
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6887
    end := selectionEndLine.
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6888
    (selectionEndCol == 0) ifTrue:[
3786
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  6889
        end := end - 1
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6890
    ].
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6891
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6892
    self
4373
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6893
        undoableDo:[ 
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6894
            self sort:how ignoreCase:ignoreCase fromLine:start toLine:end 
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6895
        ]
3786
11145773de65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3782
diff changeset
  6896
        info:'Sort'
4373
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6897
22fb03e6d08a class definition
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  6898
    "Modified (format): / 15-02-2012 / 16:52:53 / cg"
3221
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6899
!
12028ba1582d sort functions
Claus Gittinger <cg@exept.de>
parents: 3190
diff changeset
  6900
2624
22d352e56c27 preps for special characters
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  6901
specialCharacters
2915
8db67a5d1ccb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6902
    CharacterSetView
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6903
	openAsInputFor:self
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6904
	label:'Special Character Input'
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6905
	clickLabel:'Click to Insert Character'.
2866
9dd71df46f73 specialCharacters menu item
Claus Gittinger <cg@exept.de>
parents: 2857
diff changeset
  6906
!
9dd71df46f73 specialCharacters menu item
Claus Gittinger <cg@exept.de>
parents: 2857
diff changeset
  6907
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  6908
undoablePaste:someText
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6909
    self undoablePaste:someText info:nil.
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6910
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6911
    "Modified: / 28-07-2007 / 13:25:46 / cg"
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6912
!
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6913
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6914
undoablePaste:someText info:infoOrNil
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6915
    self
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6916
	undoableDo:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6917
	    self paste:someText.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6918
	]
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6919
	info:infoOrNil
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6920
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6921
    "Created: / 28-07-2007 / 13:25:30 / cg"
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6922
!
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6923
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6924
undoablePasteOrReplace:someText info:infoOrNil
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6925
    self
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6926
	undoableDo:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6927
	    self pasteOrReplace:someText.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6928
	]
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  6929
	info:infoOrNil
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6930
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  6931
    "Created: / 28-07-2007 / 13:26:16 / cg"
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  6932
!
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  6933
4114
321416257cc5 added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6934
undoablePasteReplacingAll:someText info:infoOrNil
321416257cc5 added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6935
    self
321416257cc5 added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6936
        undoableDo:[
321416257cc5 added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6937
            self selectAll.
321416257cc5 added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6938
            self pasteOrReplace:someText.
321416257cc5 added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6939
        ]
321416257cc5 added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6940
        info:infoOrNil
321416257cc5 added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6941
321416257cc5 added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6942
    "Created: / 28-07-2007 / 13:25:30 / cg"
321416257cc5 added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6943
!
321416257cc5 added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6944
2724
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6945
withSelfAndTextForPasteDo:aBlock
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6946
    "common code for paste/replace of the copybuffer"
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6947
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6948
    |sel|
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6949
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6950
    self checkModificationsAllowed ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6951
	self flash.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6952
	^ self
2724
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6953
    ].
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6954
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6955
    sel := self getTextSelectionOrTextSelectionFromHistory.
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6956
    sel notNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6957
	aBlock value:self value:sel.
2724
23f4e16dc4f4 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2720
diff changeset
  6958
    ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  6959
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  6960
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6961
!EditTextView methodsFor:'private'!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  6962
3880
d8882158de6b beepInEditor flag
Claus Gittinger <cg@exept.de>
parents: 3868
diff changeset
  6963
beep
d8882158de6b beepInEditor flag
Claus Gittinger <cg@exept.de>
parents: 3868
diff changeset
  6964
    UserPreferences current beepInEditor ifTrue:[                
d8882158de6b beepInEditor flag
Claus Gittinger <cg@exept.de>
parents: 3868
diff changeset
  6965
        super beep
d8882158de6b beepInEditor flag
Claus Gittinger <cg@exept.de>
parents: 3868
diff changeset
  6966
    ]
d8882158de6b beepInEditor flag
Claus Gittinger <cg@exept.de>
parents: 3868
diff changeset
  6967
!
d8882158de6b beepInEditor flag
Claus Gittinger <cg@exept.de>
parents: 3868
diff changeset
  6968
331
c58f0c52d2d7 made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
  6969
checkModificationsAllowed
1300
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  6970
    "check if the text can be modified (i.e. is not readOnly).
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  6971
     evaluate the exceptionBlock if not.
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  6972
     This block should be provided by the application or user of the textView,
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  6973
     and may show a warnBox or whatever."
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  6974
1733
c5139b7402f0 use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
  6975
    self isReadOnly ifTrue: [
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6976
	exceptionBlock isNil ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6977
	    ^ false
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6978
	].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6979
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6980
	(exceptionBlock value:'Text may not be modified') ~~ true ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6981
	    ^ false
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6982
	]
331
c58f0c52d2d7 made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
  6983
    ].
c58f0c52d2d7 made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
  6984
    ^ true
1300
be8b356b2e59 first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents: 1296
diff changeset
  6985
1577
4e487247ad33 dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  6986
    "Modified: / 17.6.1998 / 15:51:10 / cg"
331
c58f0c52d2d7 made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
  6987
!
c58f0c52d2d7 made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
  6988
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  6989
currentSelectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  6990
    typeOfSelection == #paste ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  6991
	^ DefaultAlternativeSelectionBackgroundColor ? selectionBgColor
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  6992
    ].
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  6993
    ^ super currentSelectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  6994
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  6995
    "
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  6996
     DefaultAlternativeSelectionBackgroundColor := Color yellow blendWith:Color green
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  6997
    "
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  6998
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  6999
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  7000
currentSelectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  7001
    typeOfSelection == #paste ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7002
	^ DefaultAlternativeSelectionForegroundColor ? selectionFgColor
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  7003
    ].
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  7004
    ^ super currentSelectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  7005
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2589
diff changeset
  7006
3996
d0b0d69334ed added: #resetVariablesBeforeNewSearch
fm
parents: 3982
diff changeset
  7007
resetVariablesBeforeNewSearch
4451
71e8b21c63ce comment in: #resetVariablesBeforeNewSearch
Claus Gittinger <cg@exept.de>
parents: 4449
diff changeset
  7008
    "clear the autosearch action, when the first pattern is searched for"
3996
d0b0d69334ed added: #resetVariablesBeforeNewSearch
fm
parents: 3982
diff changeset
  7009
d0b0d69334ed added: #resetVariablesBeforeNewSearch
fm
parents: 3982
diff changeset
  7010
    super resetVariablesBeforeNewSearch.
d0b0d69334ed added: #resetVariablesBeforeNewSearch
fm
parents: 3982
diff changeset
  7011
d0b0d69334ed added: #resetVariablesBeforeNewSearch
fm
parents: 3982
diff changeset
  7012
    "/ new search invalidates remembered string
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7013
    lastStringFromReplaceForNextSearch := nil.
4451
71e8b21c63ce comment in: #resetVariablesBeforeNewSearch
Claus Gittinger <cg@exept.de>
parents: 4449
diff changeset
  7014
71e8b21c63ce comment in: #resetVariablesBeforeNewSearch
Claus Gittinger <cg@exept.de>
parents: 4449
diff changeset
  7015
    "Modified (comment): / 07-03-2012 / 23:21:06 / cg"
3996
d0b0d69334ed added: #resetVariablesBeforeNewSearch
fm
parents: 3982
diff changeset
  7016
!
d0b0d69334ed added: #resetVariablesBeforeNewSearch
fm
parents: 3982
diff changeset
  7017
4053
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7018
setLastStringToReplace: aString
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7019
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7020
    "This method will set the information coming from the last replace into the replacementInfo"
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7021
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7022
    |lastReplaceIgnoredCase|
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7023
4064
140eda842f20 added: #hasSearchActionSelection
fm
parents: 4053
diff changeset
  7024
    "/ The searchAction is mantained until a cut/replace or a search with a user selection is done
140eda842f20 added: #hasSearchActionSelection
fm
parents: 4053
diff changeset
  7025
    self clearSearchAction.
140eda842f20 added: #hasSearchActionSelection
fm
parents: 4053
diff changeset
  7026
4053
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7027
    lastReplacementInfo lastStringToReplace: aString.
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7028
    lastStringFromReplaceForNextSearch := aString.
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7029
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7030
    "If the replace came after a search, the next replace will have the ignored case from that search action"
4107
3881490b98f0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4100
diff changeset
  7031
    lastReplaceIgnoredCase := (typeOfSelection == #search) 
3881490b98f0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4100
diff changeset
  7032
                                ifTrue: [lastSearchIgnoredCase] 
3881490b98f0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 4100
diff changeset
  7033
                                ifFalse: [nil].
4053
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7034
    lastReplacementInfo lastReplaceIgnoredCase: lastReplaceIgnoredCase.
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7035
!
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7036
2647
23dca8f032c3 changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
  7037
st80EditMode
23dca8f032c3 changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
  7038
    ^ st80Mode ? (UserPreferences current st80EditMode)
23dca8f032c3 changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
  7039
!
23dca8f032c3 changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
  7040
2225
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2213
diff changeset
  7041
suppressEmphasisInSelection
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2213
diff changeset
  7042
    "selection is shown without emphasis"
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2213
diff changeset
  7043
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2213
diff changeset
  7044
    ^ true
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2213
diff changeset
  7045
!
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2213
diff changeset
  7046
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7047
textChanged
522
aa9458e4643e indent/undent did not trigger a modify
ca
parents: 503
diff changeset
  7048
    "my text was modified (internally).
aa9458e4643e indent/undent did not trigger a modify
ca
parents: 503
diff changeset
  7049
     Sent whenever text has been edited (not to confuse with
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7050
     contentsChanged, which is triggered when the size has changed, and
4635
6218b92cce91 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  7051
     is used to notify scrollers, other views etc.).
6218b92cce91 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  7052
6218b92cce91 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  7053
     As some authors of this code have been very sloppy in tha past 
6218b92cce91 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  7054
     (not sending contentsChanged, but textChanged),
6218b92cce91 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  7055
     we do it here despite what is written above, to ensure that scrollers update correctly."
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7056
641
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  7057
    self contentsChanged.
1015
caf7265128b9 clear modified on accept.
Claus Gittinger <cg@exept.de>
parents: 1013
diff changeset
  7058
    self modified:true.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7059
    contentsWasSaved := false
641
a8bd4e31c060 minor cleanups
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
  7060
1015
caf7265128b9 clear modified on accept.
Claus Gittinger <cg@exept.de>
parents: 1013
diff changeset
  7061
    "Modified: 14.2.1997 / 16:58:38 / cg"
2207
80ca02ca0111 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
  7062
!
80ca02ca0111 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
  7063
2617
a9b1af787406 typo on method name
Claus Gittinger <cg@exept.de>
parents: 2606
diff changeset
  7064
textChangedButNoSizeChange
2207
80ca02ca0111 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
  7065
    "my text was modified (internally).
80ca02ca0111 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
  7066
     Sent whenever text has been edited (not to confuse with
80ca02ca0111 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
  7067
     contentsChanged, which is triggered when the size has changed, and
80ca02ca0111 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
  7068
     is used to notify scrollers, other views etc.)"
80ca02ca0111 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
  7069
80ca02ca0111 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
  7070
    self modified:true.
80ca02ca0111 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
  7071
    contentsWasSaved := false
80ca02ca0111 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
  7072
80ca02ca0111 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
  7073
    "Modified: 14.2.1997 / 16:58:38 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7074
! !
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7075
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7076
!EditTextView methodsFor:'queries'!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7077
1526
7676f301bb8f added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  7078
currentLine
7676f301bb8f added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  7079
    "the current line (for relative gotos)"
7676f301bb8f added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  7080
7676f301bb8f added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  7081
    ^ cursorLine
7676f301bb8f added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  7082
7676f301bb8f added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  7083
    "Created: / 17.5.1998 / 20:07:52 / cg"
7676f301bb8f added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  7084
!
7676f301bb8f added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  7085
4064
140eda842f20 added: #hasSearchActionSelection
fm
parents: 4053
diff changeset
  7086
hasSearchActionSelection
140eda842f20 added: #hasSearchActionSelection
fm
parents: 4053
diff changeset
  7087
140eda842f20 added: #hasSearchActionSelection
fm
parents: 4053
diff changeset
  7088
    ^ typeOfSelection == #searchAction
140eda842f20 added: #hasSearchActionSelection
fm
parents: 4053
diff changeset
  7089
!
140eda842f20 added: #hasSearchActionSelection
fm
parents: 4053
diff changeset
  7090
1878
d93809bda6c8 added #isKeyboardConsumer
Claus Gittinger <cg@exept.de>
parents: 1850
diff changeset
  7091
isKeyboardConsumer
d93809bda6c8 added #isKeyboardConsumer
Claus Gittinger <cg@exept.de>
parents: 1850
diff changeset
  7092
    "return true, if the receiver is a keyboard consumer;
d93809bda6c8 added #isKeyboardConsumer
Claus Gittinger <cg@exept.de>
parents: 1850
diff changeset
  7093
     Return true here, redefined from SimpleView."
d93809bda6c8 added #isKeyboardConsumer
Claus Gittinger <cg@exept.de>
parents: 1850
diff changeset
  7094
3476
41dde91ae706 isKeyboardConsumer: returns false if readOnly
ca
parents: 3474
diff changeset
  7095
    ^ self isReadOnly not
1878
d93809bda6c8 added #isKeyboardConsumer
Claus Gittinger <cg@exept.de>
parents: 1850
diff changeset
  7096
!
d93809bda6c8 added #isKeyboardConsumer
Claus Gittinger <cg@exept.de>
parents: 1850
diff changeset
  7097
997
615a5a19c5bf specClass
ca
parents: 991
diff changeset
  7098
specClass
1390
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  7099
    "redefined, since the name of my specClass is nonStandard (i.e. not EditTextSpec)"
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  7100
997
615a5a19c5bf specClass
ca
parents: 991
diff changeset
  7101
    self class == EditTextView ifTrue:[^ TextEditorSpec].
1049
24360c8891d6 specClass query
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  7102
    ^ super specClass
24360c8891d6 specClass query
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  7103
1390
99674e1d9c85 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  7104
    "Modified: / 31.10.1997 / 19:48:19 / cg"
997
615a5a19c5bf specClass
ca
parents: 991
diff changeset
  7105
!
615a5a19c5bf specClass
ca
parents: 991
diff changeset
  7106
324
9eec6d69e155 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
  7107
tabMeansNextField
323
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  7108
    "return true, if a Tab character should shift focus."
58102e6bc087 added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  7109
313
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  7110
    "if not readOnly, I want my tab keys ..."
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  7111
1733
c5139b7402f0 use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
  7112
    ^ self isReadOnly or:[tabMeansNextField]
324
9eec6d69e155 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
  7113
9eec6d69e155 better Tab key handling
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
  7114
    "Created: 7.2.1996 / 19:15:31 / cg"
313
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  7115
!
7c799cd68343 only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  7116
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7117
widthOfContents
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7118
    "return the width of the contents in pixels
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7119
     Redefined to add the size of a space (for the cursor).
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7120
     this enables us to scroll one position further than the longest
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7121
     line (and possibly see the cursor behind the line)"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7122
697
0f258f02e8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
  7123
    |w dev|
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7124
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7125
    w := super widthOfContents.
697
0f258f02e8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
  7126
    (dev := device) isNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7127
	"/ really dont know ...
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7128
	dev := Screen current
606
682579fa3b62 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  7129
    ].
697
0f258f02e8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
  7130
    ^ w + (font widthOn:dev)
0f258f02e8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
  7131
0f258f02e8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
  7132
    "Modified: 28.5.1996 / 19:32:25 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7133
! !
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7134
1588
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7135
!EditTextView methodsFor:'realization'!
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7136
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7137
realize
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7138
    "make the view visible - scroll to make the cursor visible."
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7139
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7140
    super realize.
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7141
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7142
    self makeCursorVisible.
1993
5ffe0b3943cd #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  7143
    cursorFgColor := cursorFgColor onDevice:device.
5ffe0b3943cd #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  7144
    cursorBgColor := cursorBgColor onDevice:device.
1588
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7145
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7146
    "Modified: 20.12.1996 / 14:16:05 / cg"
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7147
    "Created: 24.7.1997 / 18:24:12 / cg"
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7148
! !
e2e4ceeed3da category change
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  7149
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7150
!EditTextView methodsFor:'redrawing'!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7151
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7152
redrawCursorIfBetweenVisibleLine:startVisLine and:endVisLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7153
    "redraw the cursor, if it sits in a line range"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7154
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7155
    cursorShown ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7156
	cursorVisibleLine notNil ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7157
	    (cursorVisibleLine between:startVisLine and:endVisLine) ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7158
		self drawCursorCharacter
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7159
	    ]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7160
	]
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7161
    ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  7162
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  7163
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7164
redrawCursorIfInVisibleLine:visLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7165
    "redraw the cursor, if it sits in visible line"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7166
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7167
    cursorShown ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7168
	(visLine == cursorVisibleLine) ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7169
	    self drawCursorCharacter
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7170
	]
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7171
    ]
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7172
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7173
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7174
redrawFromVisibleLine:startVisLine to:endVisLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7175
    "redraw a visible line range"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7176
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7177
    super redrawFromVisibleLine:startVisLine to:endVisLine.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7178
    self redrawCursorIfBetweenVisibleLine:startVisLine and:endVisLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7179
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7180
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7181
redrawVisibleLine:visLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7182
    "redraw a visible line"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7183
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7184
    super redrawVisibleLine:visLine.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7185
    self redrawCursorIfInVisibleLine:visLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7186
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7187
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7188
redrawVisibleLine:visLine col:colNr
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7189
    "redraw the single character in visibleline at colNr"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7190
3510
4bd0b20bd05d cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents: 3495
diff changeset
  7191
    super redrawVisibleLine:visLine col:colNr.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7192
    cursorShown ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  7193
	(visLine == cursorVisibleLine) ifTrue:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  7194
	    (colNr == cursorCol) ifTrue:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  7195
		self drawCursorCharacter.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  7196
		^ self
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  7197
	    ]
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  7198
	]
3510
4bd0b20bd05d cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents: 3495
diff changeset
  7199
    ].
4bd0b20bd05d cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents: 3495
diff changeset
  7200
4bd0b20bd05d cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents: 3495
diff changeset
  7201
    "Modified: / 05-11-2007 / 17:35:53 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7202
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7203
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7204
redrawVisibleLine:visLine from:startCol
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7205
    "redraw a visible line from startCol to the end of line"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7206
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7207
    super redrawVisibleLine:visLine from:startCol.
4494
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  7208
    cursorShown ifTrue:[
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  7209
        self redrawCursorIfInVisibleLine:visLine
dfe81ebdd5d6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  7210
    ]
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7211
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7212
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7213
redrawVisibleLine:visLine from:startCol to:endCol
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7214
    "redraw a visible line from startCol to endCol"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7215
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7216
    super redrawVisibleLine:visLine from:startCol to:endCol.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7217
    self redrawCursorIfInVisibleLine:visLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7218
! !
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7219
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7220
!EditTextView methodsFor:'scrolling'!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7221
2331
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2323
diff changeset
  7222
additionalMarginForHorizontalScroll
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2323
diff changeset
  7223
    "return the number of pixels by which we may scroll more than the actual
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2323
diff changeset
  7224
     width of the document would allow.
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2323
diff changeset
  7225
     This is redefined by editable textViews, to allo for the cursor
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2323
diff changeset
  7226
     to be visible if it is positioned right behind the longest line of text.
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2323
diff changeset
  7227
     The default returned here is 10 pixels, which should be ok for most cursors"
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2323
diff changeset
  7228
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2323
diff changeset
  7229
    ^ 10 max:font width
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2323
diff changeset
  7230
!
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2323
diff changeset
  7231
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7232
halfPageDown
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7233
    "half a page down - to keep cursor on same visible line, it has to be moved
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7234
     within the real text  "
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7235
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7236
    |prevCursorLine|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7237
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7238
    prevCursorLine := cursorVisibleLine.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7239
    super halfPageDown.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7240
    self cursorVisibleLine:prevCursorLine col:cursorCol
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7241
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7242
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7243
halfPageUp
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7244
    "half a page up - to keep cursor on same visible line, it has to be moved
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7245
     within the real text  "
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7246
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7247
    |prevCursorLine|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7248
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7249
    prevCursorLine := cursorVisibleLine.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7250
    super halfPageUp.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7251
    self cursorVisibleLine:prevCursorLine col:cursorCol
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7252
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7253
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7254
originChanged:delta
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7255
    "sent after scrolling - have to show the cursor if it was on before"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7256
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7257
    super originChanged:delta.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7258
    "
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7259
     should we move the cursor with the scroll - or leave it ?
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7260
    "
2422
aaef7f02402c added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents: 2417
diff changeset
  7261
    self updateCursorVisibleLine.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7262
    prevCursorState ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7263
	self showCursor
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7264
    ]
1577
4e487247ad33 dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  7265
4e487247ad33 dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  7266
    "Modified: / 17.6.1998 / 16:13:24 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7267
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7268
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7269
originWillChange
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7270
    "sent before scrolling - have to hide the cursor"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7271
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7272
    prevCursorState := cursorShown.
1601
57dde4dfee7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  7273
    "/ cursorShown := false.
1591
d84c117e71cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1590
diff changeset
  7274
    cursorShown ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7275
	self hideCursor
1591
d84c117e71cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1590
diff changeset
  7276
    ]
d84c117e71cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1590
diff changeset
  7277
1601
57dde4dfee7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1599
diff changeset
  7278
    "Modified: / 6.7.1998 / 13:07:23 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7279
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7280
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7281
pageDown
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7282
    "page down - to keep cursor on same visible line, it has to be moved
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7283
     within the real text  "
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7284
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7285
    |prevCursorLine|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7286
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7287
    prevCursorLine := cursorVisibleLine.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7288
    super pageDown.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7289
    self cursorVisibleLine:prevCursorLine col:cursorCol
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7290
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7291
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7292
pageUp
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7293
    "page up - to keep cursor on same visible line, it has to be moved
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7294
     within the real text  "
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7295
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7296
    |prevCursorLine|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7297
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7298
    prevCursorLine := cursorVisibleLine.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7299
    super pageUp.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7300
    self cursorVisibleLine:prevCursorLine col:cursorCol
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7301
! !
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7302
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7303
!EditTextView methodsFor:'searching'!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7304
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7305
searchBwd:pattern ifAbsent:aBlock
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7306
    "do a backward search"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7307
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  7308
    self searchBwd:pattern ignoreCase:false ifAbsent:aBlock
1339
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7309
!
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7310
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7311
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7312
    "do a backward search"
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7313
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7314
    cursorLine isNil ifTrue:[^ self].
4464
bbdc850e9d93 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4458
diff changeset
  7315
    super searchBwd:pattern ignoreCase:ign ifAbsent:aBlock
3580
c9d10df2b8bc StringSearchTool
fm
parents: 3578
diff changeset
  7316
!
c9d10df2b8bc StringSearchTool
fm
parents: 3578
diff changeset
  7317
c9d10df2b8bc StringSearchTool
fm
parents: 3578
diff changeset
  7318
searchBwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock
c9d10df2b8bc StringSearchTool
fm
parents: 3578
diff changeset
  7319
    "do a backward search"
c9d10df2b8bc StringSearchTool
fm
parents: 3578
diff changeset
  7320
c9d10df2b8bc StringSearchTool
fm
parents: 3578
diff changeset
  7321
    cursorLine isNil ifTrue:[^ self].
c9d10df2b8bc StringSearchTool
fm
parents: 3578
diff changeset
  7322
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7323
    self
4119
90acc0c0d5f4 comment/format in: #again
fm
parents: 4117
diff changeset
  7324
        searchBackwardFor:pattern
90acc0c0d5f4 comment/format in: #again
fm
parents: 4117
diff changeset
  7325
        ignoreCase:ign
90acc0c0d5f4 comment/format in: #again
fm
parents: 4117
diff changeset
  7326
        startingAtLine:startLine col:startCol
90acc0c0d5f4 comment/format in: #again
fm
parents: 4117
diff changeset
  7327
        ifFound:[:line :col |
90acc0c0d5f4 comment/format in: #again
fm
parents: 4117
diff changeset
  7328
            self cursorMovementAllowed ifTrue:[
90acc0c0d5f4 comment/format in: #again
fm
parents: 4117
diff changeset
  7329
                self cursorLine:line col:col.
90acc0c0d5f4 comment/format in: #again
fm
parents: 4117
diff changeset
  7330
            ].
90acc0c0d5f4 comment/format in: #again
fm
parents: 4117
diff changeset
  7331
            self showMatch:pattern isMatch:false atLine:line col:col.
1339
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7332
"/            self makeLineVisible:cursorLine
4119
90acc0c0d5f4 comment/format in: #again
fm
parents: 4117
diff changeset
  7333
            typeOfSelection := #search]
90acc0c0d5f4 comment/format in: #again
fm
parents: 4117
diff changeset
  7334
        ifAbsent:aBlock
1339
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7335
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7336
    "Modified: 9.10.1997 / 13:02:13 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7337
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7338
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7339
searchForAndSelectMatchingParenthesis
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7340
    "select characters enclosed by matching parenthesis if one is under cusor"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7341
2554
ec6aca20825f refactored
Claus Gittinger <cg@exept.de>
parents: 2544
diff changeset
  7342
    self searchForAndSelectMatchingParenthesisFromLine:cursorLine col:cursorCol
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7343
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7344
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7345
searchForMatchingParenthesis
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7346
    "search for a matching parenthesis starting at cursor position.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7347
     Search for the corresponding character is done forward if its an opening,
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7348
     backwards if its a closing parenthesis.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7349
     Positions the cursor if found, peeps if not"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7350
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  7351
    self cursorMovementAllowed ifFalse:[^ self].
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  7352
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7353
    self
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7354
	searchForMatchingParenthesisFromLine:cursorLine col:cursorCol
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7355
	ifFound:[:line :col | self cursorLine:line col:col]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7356
	ifNotFound:[self showNotFound]
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7357
	onError:[self beep]
1339
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7358
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7359
    "Modified: 9.10.1997 / 12:56:30 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7360
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7361
3967
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7362
searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock
1339
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7363
    "do a forward search"
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7364
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7365
    cursorLine isNil ifTrue:[^ self].
3967
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7366
    self 
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7367
        searchForwardFor:pattern 
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7368
        ignoreCase:ign
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7369
        match: match
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7370
        startingAtLine:startLine col:startCol
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7371
        ifFound:[:line :col |
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7372
            self cursorMovementAllowed ifTrue:[
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7373
                self cursorLine:line col:col.
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7374
            ].
4119
90acc0c0d5f4 comment/format in: #again
fm
parents: 4117
diff changeset
  7375
            self showMatch:pattern isMatch:match atLine:line col:col.
1339
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7376
"/            self makeLineVisible:cursorLine
3967
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7377
            typeOfSelection := #search
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7378
        ]
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7379
        ifAbsent:aBlock
1339
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7380
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7381
    "Modified: 9.10.1997 / 12:57:47 / cg"
41b5e743d78a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  7382
    "Created: 9.10.1997 / 13:01:12 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7383
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7384
3967
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7385
searchFwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7386
    "do a forward search"
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7387
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7388
    self searchFwd:pattern ignoreCase:ign match: false startingAtLine:startLine col:startCol ifAbsent:aBlock
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7389
!
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7390
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7391
searchFwd:pattern startingAtLine:startLine col:startCol ifAbsent:aBlock
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7392
    "do a forward search"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7393
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  7394
    self searchFwd:pattern ignoreCase:false startingAtLine:startLine col:startCol ifAbsent:aBlock
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7395
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7396
3982
79e6af2d27b1 fixes in searchBar
fm
parents: 3976
diff changeset
  7397
searchPatternForSearchBar
79e6af2d27b1 fixes in searchBar
fm
parents: 3976
diff changeset
  7398
79e6af2d27b1 fixes in searchBar
fm
parents: 3976
diff changeset
  7399
    "Returns the next searchPattern from the user selection or from the autoSearch"
79e6af2d27b1 fixes in searchBar
fm
parents: 3976
diff changeset
  7400
79e6af2d27b1 fixes in searchBar
fm
parents: 3976
diff changeset
  7401
    |searchPattern|
79e6af2d27b1 fixes in searchBar
fm
parents: 3976
diff changeset
  7402
4138
fm
parents: 4136
diff changeset
  7403
    searchPattern := self searchPatternFromUserSelectionOrReplace.
3982
79e6af2d27b1 fixes in searchBar
fm
parents: 3976
diff changeset
  7404
    searchPattern isNil 
79e6af2d27b1 fixes in searchBar
fm
parents: 3976
diff changeset
  7405
        ifTrue: [searchPattern := lastSearchPattern]
79e6af2d27b1 fixes in searchBar
fm
parents: 3976
diff changeset
  7406
        ifFalse: [lastSearchPattern := searchPattern].
79e6af2d27b1 fixes in searchBar
fm
parents: 3976
diff changeset
  7407
    ^ searchPattern
79e6af2d27b1 fixes in searchBar
fm
parents: 3976
diff changeset
  7408
!
79e6af2d27b1 fixes in searchBar
fm
parents: 3976
diff changeset
  7409
3578
9d43beca1e85 searchForward with match argument
fm
parents: 3572
diff changeset
  7410
setSearchPatternWithMatchEscapes: match
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7411
    "set the searchpattern from the selection if there is one, and position
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7412
     cursor to start of pattern"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7413
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7414
    |sel|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7415
559
3ff87e9447c6 keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  7416
    "/
3967
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7417
    "/ if the last operation was a replace, set pattern to last
559
3ff87e9447c6 keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  7418
    "/ original string (for search after again)
4121
9232089c04c2 comment/format in: #setSearchPatternWithMatchEscapes:
fm
parents: 4119
diff changeset
  7419
    "/ for cut or delete actions allow lastReplacement with nil
559
3ff87e9447c6 keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  7420
    "/
4249
44daffb1b034 comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  7421
"/    (lastStringFromReplaceForNextSearch notNil
44daffb1b034 comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  7422
"/     and:[typeOfSelection ~~ #search]) ifTrue:[
44daffb1b034 comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  7423
"/        lastStringFromReplaceForNextSearch isString ifTrue:[
44daffb1b034 comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  7424
"/            lastSearchPattern := lastStringFromReplaceForNextSearch.
44daffb1b034 comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  7425
"/        ] ifFalse:[
44daffb1b034 comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  7426
"/            lastSearchPattern := lastStringFromReplaceForNextSearch asStringWithoutFinalCR.
44daffb1b034 comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  7427
"/        ].
44daffb1b034 comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  7428
"/        ^ self
44daffb1b034 comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  7429
"/    ].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7430
559
3ff87e9447c6 keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  7431
    "/
3ff87e9447c6 keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  7432
    "/ if there is a selection:
3ff87e9447c6 keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  7433
    "/    if there was no previous search, take it as search pattern.
3ff87e9447c6 keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  7434
    "/    if there was a previous search, only take the selection if
3967
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7435
    "/    it did not result from a paste or from the last search itself.
559
3ff87e9447c6 keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  7436
    "/    (to allow search-paste to be repeated)
3ff87e9447c6 keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  7437
    "/
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7438
    sel := self selection.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7439
    sel notNil ifTrue:[
3967
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7440
        (lastSearchPattern isNil
4484
38f88010834c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  7441
        or:[typeOfSelection ~~ #paste and:[typeOfSelection ~~ #search]]
38f88010834c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  7442
        ) ifTrue:[
3967
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7443
            self cursorLine:selectionStartLine col:selectionStartCol.
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7444
            lastSearchPattern := sel asStringWithoutFinalCR.
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7445
            match ifTrue:[lastSearchPattern := lastSearchPattern withMatchEscapes].
64bc48cd8e8b do not take search string from selection
fm
parents: 3963
diff changeset
  7446
        ]
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7447
    ]
559
3ff87e9447c6 keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents: 522
diff changeset
  7448
4249
44daffb1b034 comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents: 4248
diff changeset
  7449
    "Modified: / 07-05-2011 / 17:25:59 / cg"
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7450
!
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7451
4484
38f88010834c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  7452
showMatch:pattern isMatch:isMatch atLine:line col:col
38f88010834c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  7453
    super showMatch:pattern isMatch:isMatch atLine:line col:col.
38f88010834c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  7454
    typeOfSelection := #search.
38f88010834c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  7455
!
38f88010834c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  7456
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7457
startPositionForSearchBackward
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  7458
    ^ self startPositionForSearchBackwardBasedOnCursorOrSelection
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  7459
!
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  7460
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  7461
startPositionForSearchBackwardBasedOnCursorOrSelection
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7462
    |startLine startCol|
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7463
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7464
    selectionStartLine notNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7465
	startLine := selectionStartLine.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7466
	startCol := selectionStartCol
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7467
    ] ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7468
	cursorLine isNil ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7469
	    startLine := list size.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7470
	    startCol := self listAt:startLine size.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7471
	] ifFalse:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7472
	    startLine := cursorLine min:list size.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7473
	    startCol := cursorCol
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7474
	]
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7475
    ].
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7476
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7477
    ^ startCol @ cursorLine
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7478
!
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7479
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7480
startPositionForSearchForward
2822
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  7481
    ^ self startPositionForSearchForwardBasedOnCursorOrSelection
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  7482
!
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  7483
08ceab3fc237 search refactored;
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  7484
startPositionForSearchForwardBasedOnCursorOrSelection
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7485
    |startCol|
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7486
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7487
    "/ if there is no selection and the cursor is at the origin,
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7488
    "/ assume its the first search and do not skip the very first match
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7489
    startCol := cursorCol.
4424
b38e9e3b483b changed: #startPositionForSearchForwardBasedOnCursorOrSelection
Claus Gittinger <cg@exept.de>
parents: 4421
diff changeset
  7490
    self hasSelection ifTrue:[
b38e9e3b483b changed: #startPositionForSearchForwardBasedOnCursorOrSelection
Claus Gittinger <cg@exept.de>
parents: 4421
diff changeset
  7491
        ^ selectionEndCol @ selectionEndLine.
b38e9e3b483b changed: #startPositionForSearchForwardBasedOnCursorOrSelection
Claus Gittinger <cg@exept.de>
parents: 4421
diff changeset
  7492
    ] ifFalse:[
4064
140eda842f20 added: #hasSearchActionSelection
fm
parents: 4053
diff changeset
  7493
        (cursorLine == 1 and:[cursorCol == 1]) ifTrue:[
140eda842f20 added: #hasSearchActionSelection
fm
parents: 4053
diff changeset
  7494
            startCol := 0
140eda842f20 added: #hasSearchActionSelection
fm
parents: 4053
diff changeset
  7495
        ].
140eda842f20 added: #hasSearchActionSelection
fm
parents: 4053
diff changeset
  7496
        startCol := startCol min:(self at:cursorLine) size
2756
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7497
    ].
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7498
2bdd7ceaf05c initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  7499
    ^ startCol @ cursorLine
4424
b38e9e3b483b changed: #startPositionForSearchForwardBasedOnCursorOrSelection
Claus Gittinger <cg@exept.de>
parents: 4421
diff changeset
  7500
b38e9e3b483b changed: #startPositionForSearchForwardBasedOnCursorOrSelection
Claus Gittinger <cg@exept.de>
parents: 4421
diff changeset
  7501
    "Modified (format): / 24-05-2012 / 13:58:37 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7502
! !
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7503
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7504
!EditTextView methodsFor:'selections'!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7505
3023
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  7506
addToSelectionAfter:aBlock
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7507
    "Extends the selection accroding to cursor position
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7508
     after evaluation of `aBlock`. Used to implement
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7509
     Shift-Home & Shift-End. "
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7510
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7511
    "/ Following comment is in czech and thus now very useful.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7512
    "/ However I (JV) keep it here as this is one of the very
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7513
    "/ first fix/hack we made to Smalltalk/X ages ago, if not
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7514
    "/ the very first one. Actually, this method and comment was 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7515
    "/ written by Martin Dvorak. Yeah, being bit nostalgic...
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7516
3023
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  7517
    "Pokud existuje selekce, upravi ji
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  7518
     podle aktualni pozice kurzoru a pozice
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  7519
     po provedeni blocku.
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  7520
     Urceno k implementaci Shift-Home a Shift-End
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  7521
     Nejak nevim, jak to presneji popsat :-)"
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  7522
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7523
    | startLine startCol endLine endCol curLine curCol cursorAtTheBeginning cursorAtTheEnd cursorWasShown |
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7524
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7525
    curLine := cursorLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7526
    curCol := cursorCol.
3023
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  7527
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  7528
    self hasSelection ifTrue: [
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7529
        startLine := selectionStartLine .
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7530
        startCol := selectionStartCol .
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7531
        endLine := selectionEndLine .
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7532
        endCol := selectionEndCol .
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7533
    ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7534
        startLine := endLine := curLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7535
        startCol := curCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7536
        endCol := curCol - 1.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7537
    ].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7538
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7539
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7540
    cursorAtTheBeginning := (startLine == curLine) and:[startCol == curCol].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7541
    cursorAtTheEnd := (endLine == curLine) and:[endCol == (curCol - 1)]. 
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7542
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7543
    self assert: cursorAtTheBeginning | cursorAtTheEnd.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7544
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7545
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7546
    cursorWasShown := self hideCursor.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7547
    aBlock value.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7548
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7549
    cursorAtTheBeginning ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7550
        (cursorCol == (endCol + 1) and:[cursorLine == endLine]) ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7551
                self unselect; showCursor.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7552
                ^self
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7553
        ].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7554
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7555
        (cursorLine > endLine or:[cursorLine == endLine and:[cursorCol > endCol]]) ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7556
            startLine := endLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7557
            startCol := endCol + 1.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7558
            endLine := cursorLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7559
            endCol := cursorCol - 1
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7560
        ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7561
            startLine := cursorLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7562
            startCol := cursorCol.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7563
        ]
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7564
    ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7565
        cursorAtTheEnd ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7566
            (cursorCol == startCol and:[cursorLine == startLine]) ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7567
                self unselect; showCursor.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7568
                ^self
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7569
            ].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7570
            (cursorLine < startLine or:[cursorLine == startLine and:[cursorCol < startCol]]) ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7571
                endLine := startLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7572
                endCol := startCol - 1.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7573
                startLine := cursorLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7574
                startCol := cursorCol
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7575
            ] ifFalse:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7576
                endLine := cursorLine.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7577
                endCol := cursorCol - 1.
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7578
            ]
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7579
        ].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7580
    ].
3023
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  7581
    self selectFromLine:startLine col:startCol toLine: endLine col:endCol .
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7582
    cursorWasShown ifTrue:[self showCursor].
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7583
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7584
    "Modified: / 28-08-2013 / 01:23:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3023
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  7585
!
9a6809da7351 shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  7586
1850
82516928e791 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1849
diff changeset
  7587
autoMoveCursorToEndOfSelection
82516928e791 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1849
diff changeset
  7588
    "return true, if the cursor should be automatically moved to the
82516928e791 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1849
diff changeset
  7589
     end of a selection.
3963
c315f087d655 comment in: #autoMoveCursorToEndOfSelection
Claus Gittinger <cg@exept.de>
parents: 3945
diff changeset
  7590
     Redefined to return false in terminalViews, where the cursor should
1850
82516928e791 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1849
diff changeset
  7591
     not be affected by selecting"
82516928e791 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1849
diff changeset
  7592
82516928e791 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1849
diff changeset
  7593
    ^ true
82516928e791 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1849
diff changeset
  7594
!
82516928e791 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1849
diff changeset
  7595
2606
6a3ab90d339f redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents: 2599
diff changeset
  7596
changeTypeOfSelectionTo:newType
6a3ab90d339f redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents: 2599
diff changeset
  7597
    typeOfSelection ~~ newType ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7598
	typeOfSelection := newType.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7599
	selectionStartLine notNil ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7600
	    self
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7601
		redrawFromLine:selectionStartLine col:selectionStartCol
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7602
		toLine:selectionEndLine col:selectionEndCol
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7603
	].
2606
6a3ab90d339f redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents: 2599
diff changeset
  7604
    ].
6a3ab90d339f redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents: 2599
diff changeset
  7605
!
6a3ab90d339f redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents: 2599
diff changeset
  7606
4707
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7607
findNextWordAfterSelectionAndAddToSelection
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7608
    |selStartCol selStartLine selEndCol selEndLine|
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7609
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7610
    selectionStartCol isNil ifTrue:[
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7611
        self selectWordUnderCursor.
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7612
        ^ self
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7613
    ].
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7614
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7615
    selStartCol := selectionStartCol.
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7616
    selEndCol := selectionEndCol.
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7617
    selStartLine := selectionStartLine.
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7618
    selEndLine := selectionEndLine.
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7619
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7620
    self cursorToNextWord.
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7621
    self selectWordUnderCursor.
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7622
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7623
    self selectFromLine:selStartLine col:selStartCol toLine:selectionEndLine col:selectionEndCol.
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7624
!
f6ac835a1cf6 class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4701
diff changeset
  7625
4138
fm
parents: 4136
diff changeset
  7626
searchPatternFromUserSelectionOrReplace
fm
parents: 4136
diff changeset
  7627
fm
parents: 4136
diff changeset
  7628
    |sel searchPattern|
fm
parents: 4136
diff changeset
  7629
fm
parents: 4136
diff changeset
  7630
    "/
fm
parents: 4136
diff changeset
  7631
    "/ if the last operation was a replace, set pattern to last
fm
parents: 4136
diff changeset
  7632
    "/ original string (for search after again)
fm
parents: 4136
diff changeset
  7633
    "/
fm
parents: 4136
diff changeset
  7634
    (lastStringFromReplaceForNextSearch notNil
fm
parents: 4136
diff changeset
  7635
     and:[typeOfSelection ~~ #search]) ifTrue:[
fm
parents: 4136
diff changeset
  7636
        lastStringFromReplaceForNextSearch isString ifTrue:[
fm
parents: 4136
diff changeset
  7637
            searchPattern := lastStringFromReplaceForNextSearch.
fm
parents: 4136
diff changeset
  7638
        ] ifFalse:[
fm
parents: 4136
diff changeset
  7639
            searchPattern := lastStringFromReplaceForNextSearch asStringWithoutFinalCR.
fm
parents: 4136
diff changeset
  7640
        ].
fm
parents: 4136
diff changeset
  7641
        ^ searchPattern
fm
parents: 4136
diff changeset
  7642
    ].
fm
parents: 4136
diff changeset
  7643
fm
parents: 4136
diff changeset
  7644
    "/
fm
parents: 4136
diff changeset
  7645
    "/ if there is a selection:
fm
parents: 4136
diff changeset
  7646
    "/    if there was no previous search, take it as search pattern.
fm
parents: 4136
diff changeset
  7647
    "/    if there was a previous search, only take the selection if
fm
parents: 4136
diff changeset
  7648
    "/    it did not result from a paste.
fm
parents: 4136
diff changeset
  7649
    "/    (to allow search-paste to be repeated)
fm
parents: 4136
diff changeset
  7650
    "/
fm
parents: 4136
diff changeset
  7651
    sel := self selection.
fm
parents: 4136
diff changeset
  7652
    sel notNil ifTrue:[
fm
parents: 4136
diff changeset
  7653
        typeOfSelection ~~ #search ifTrue:[
fm
parents: 4136
diff changeset
  7654
            typeOfSelection ~~ #paste ifTrue:[
fm
parents: 4136
diff changeset
  7655
                self cursorLine:selectionStartLine col:selectionStartCol.
fm
parents: 4136
diff changeset
  7656
                searchPattern := sel asStringWithoutFinalCR.
fm
parents: 4136
diff changeset
  7657
            ]
fm
parents: 4136
diff changeset
  7658
        ].
fm
parents: 4136
diff changeset
  7659
    ].
fm
parents: 4136
diff changeset
  7660
fm
parents: 4136
diff changeset
  7661
    ^ searchPattern
fm
parents: 4136
diff changeset
  7662
!
fm
parents: 4136
diff changeset
  7663
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7664
selectAll
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7665
    "select the whole text.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7666
     redefined to send super selectFrom... since we dont want the
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7667
     cursor to be moved in this case."
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7668
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7669
    list isNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7670
	self unselect
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7671
    ] ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7672
	super selectFromLine:1 col:1 toLine:(list size + 1) col:0.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7673
	typeOfSelection := nil
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7674
    ]
1082
ccc3aa4268c1 better #selectAll
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  7675
ccc3aa4268c1 better #selectAll
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  7676
    "Modified: 28.2.1997 / 19:14:54 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7677
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7678
4117
470a3086aaa9 added: #selectAllInitially
sr
parents: 4114
diff changeset
  7679
selectAllInitially
470a3086aaa9 added: #selectAllInitially
sr
parents: 4114
diff changeset
  7680
    "select the whole text. This is called only once during the initialization
470a3086aaa9 added: #selectAllInitially
sr
parents: 4114
diff changeset
  7681
     for editFields which are shown in a table or tree.
470a3086aaa9 added: #selectAllInitially
sr
parents: 4114
diff changeset
  7682
     The selectAll is called via this method to allow for easier redefinition and
470a3086aaa9 added: #selectAllInitially
sr
parents: 4114
diff changeset
  7683
     to distinguish auto-select from user-initiated selects."
470a3086aaa9 added: #selectAllInitially
sr
parents: 4114
diff changeset
  7684
470a3086aaa9 added: #selectAllInitially
sr
parents: 4114
diff changeset
  7685
    self selectAll
470a3086aaa9 added: #selectAllInitially
sr
parents: 4114
diff changeset
  7686
!
470a3086aaa9 added: #selectAllInitially
sr
parents: 4114
diff changeset
  7687
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7688
selectCursorLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7689
    "select cursorline"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7690
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7691
    self selectFromLine:cursorLine col:1 toLine:cursorLine+1 col:0
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7692
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7693
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7694
selectCursorLineFromBeginning
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7695
    "select cursorline up to cursor position"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7696
823
fc61564f7832 escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  7697
    cursorCol > 1 ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7698
	self selectFromLine:cursorLine col:1
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7699
		     toLine:cursorLine col:(cursorCol-1)
823
fc61564f7832 escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  7700
    ]
fc61564f7832 escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  7701
fc61564f7832 escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  7702
    "Modified: 16.8.1996 / 19:14:14 / cg"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7703
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7704
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7705
selectExpandCursorLine
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7706
    "expand selection by one line or select cursorline"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7707
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7708
    selectionStartLine isNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7709
	self selectCursorLine
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7710
    ] ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7711
	self selectFromLine:selectionStartLine col:selectionStartCol
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7712
		     toLine:cursorLine+1 col:0.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7713
	self makeLineVisible:selectionEndLine
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7714
    ]
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7715
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7716
4257
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7717
selectFromBeginOfLine
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7718
    "select the text from the beginning of the current line to the current cursor position."
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7719
4430
61c074a935cf fixed: #selectFromBeginOfLine
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4424
diff changeset
  7720
    | newCursorCol ln |
4271
3ce604308987 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4258
diff changeset
  7721
4257
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7722
    list isNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7723
        self unselect
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7724
    ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7725
        cursorCol > 1 ifTrue:[
4430
61c074a935cf fixed: #selectFromBeginOfLine
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4424
diff changeset
  7726
            ln := list at: cursorLine.
61c074a935cf fixed: #selectFromBeginOfLine
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4424
diff changeset
  7727
            newCursorCol := ln notEmptyOrNil ifTrue:[ln indexOfNonSeparator] ifFalse:[1].
4271
3ce604308987 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4258
diff changeset
  7728
            self selectFromLine:cursorLine col:newCursorCol toLine:cursorLine col:cursorCol-1.
3ce604308987 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4258
diff changeset
  7729
            cursorCol := newCursorCol.
4257
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7730
            typeOfSelection := nil
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7731
        ]
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7732
    ]
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7733
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7734
    "Created: / 28-06-2011 / 22:47:04 / cg"
4430
61c074a935cf fixed: #selectFromBeginOfLine
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4424
diff changeset
  7735
    "Modified: / 18-07-2012 / 17:00:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4257
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7736
!
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7737
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7738
selectFromBeginning
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7739
    "select the text from the beginning to the current cursor position."
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7740
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7741
    |col|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7742
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7743
    list isNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7744
	self unselect
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7745
    ] ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7746
	cursorCol == 0 ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7747
	    col := 0
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7748
	] ifFalse:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7749
	    col := cursorCol - 1
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7750
	].
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7751
	super selectFromLine:1 col:1 toLine:cursorLine col:col.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7752
	typeOfSelection := nil
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7753
    ]
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7754
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7755
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7756
selectFromLine:startLine col:startCol toLine:endLine col:endCol
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7757
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7758
    super selectFromLine:startLine col:startCol toLine:endLine col:endCol.
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7759
    "JV: That's atctuall rubbish as then you loose the original positon
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7760
     and if user wants to extend/shring the selection further, you don't know
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7761
     from which end to do it!!"
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7762
"/    (selectionEndLine notNil and:[self autoMoveCursorToEndOfSelection]) ifTrue:[
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7763
"/        self cursorLine:selectionEndLine col:(selectionEndCol + 1).
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7764
"/    ].
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7765
    typeOfSelection := nil
4841
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7766
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7767
    "Modified: / 27-08-2013 / 13:28:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4fca96a61d42 Selection refactoring (part 1).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4674
diff changeset
  7768
    "Modified (comment): / 27-08-2013 / 15:58:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7769
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7770
4257
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7771
selectToEndOfLine
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7772
    "select the text from the current cursor position to the end of the current line"
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7773
4271
3ce604308987 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4258
diff changeset
  7774
    | newCursorCol line |
3ce604308987 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4258
diff changeset
  7775
4257
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7776
    list isNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7777
        self unselect
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7778
    ] ifFalse:[
4275
16c80f32c06c bug fix in #selectToEndOfLine
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4271
diff changeset
  7779
        cursorCol >= 1 ifTrue:[
4271
3ce604308987 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4258
diff changeset
  7780
            line := list at: cursorLine.
3ce604308987 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4258
diff changeset
  7781
            newCursorCol := line size.
3ce604308987 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4258
diff changeset
  7782
            [ newCursorCol > 1 and:[(line at:newCursorCol) isSeparator] ]      
3ce604308987 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4258
diff changeset
  7783
                whileTrue:[newCursorCol := newCursorCol - 1].
3ce604308987 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4258
diff changeset
  7784
3ce604308987 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4258
diff changeset
  7785
            self selectFromLine:cursorLine col:cursorCol toLine:cursorLine col: newCursorCol.
3ce604308987 changed:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4258
diff changeset
  7786
            cursorCol := newCursorCol.
4257
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7787
            typeOfSelection := nil
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7788
        ]
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7789
    ]
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7790
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7791
    "Created: / 28-06-2011 / 23:07:07 / cg"
4275
16c80f32c06c bug fix in #selectToEndOfLine
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4271
diff changeset
  7792
    "Modified: / 30-06-2011 / 19:51:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4257
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7793
!
Claus Gittinger <cg@exept.de>
parents: 4256
diff changeset
  7794
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7795
selectUpToEnd
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7796
    "select the text from the current cursor position to the end."
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7797
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7798
    list isNil ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7799
	self unselect
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7800
    ] ifFalse:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7801
	super selectFromLine:cursorLine col:cursorCol toLine:(list size + 1) col:0.
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7802
	typeOfSelection := nil
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7803
    ]
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7804
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7805
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7806
selectWordUnderCursor
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7807
    "select the word under the cursor"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7808
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7809
    self selectWordAtLine:cursorLine col:cursorCol
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7810
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7811
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7812
unselect
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7813
    "forget and unhilight selection - must take care of cursor here"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7814
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7815
    |wasOn|
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7816
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7817
    wasOn := self hideCursor.
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7818
    super unselect.
2606
6a3ab90d339f redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents: 2599
diff changeset
  7819
    typeOfSelection := nil.
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7820
    wasOn ifTrue:[self showCursor]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  7821
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  7822
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  7823
!EditTextView methodsFor:'undo & again'!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  7824
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7825
addUndo:action
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  7826
    ^ undoSupport addUndo:action.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7827
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7828
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  7829
again
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  7830
    "repeat the last action (which was a cut or replace).
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  7831
     If current selection is not last string, search forward to
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7832
     next occurrence of it before repeating the last operation."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  7833
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7834
    |s l c sel savedSelectStyle startColForSearch 
4051
4fdd00fbdc60 changed:
fm
parents: 4048
diff changeset
  7835
     lastStringToReplace lastReplaceIgnoredCase lastReplaceWasMatch|
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7836
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7837
    lastStringToReplace := lastReplacementInfo lastStringToReplace.
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  7838
    lastStringToReplace isNil ifTrue:[
3816
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7839
        ^ false
2579
74d3798f4200 do not remove separators from replacement string
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  7840
    ].
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7841
    lastReplaceIgnoredCase := lastReplacementInfo lastReplaceIgnoredCase.
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7842
    lastReplaceWasMatch := lastReplacementInfo lastReplaceWasMatch.
2579
74d3798f4200 do not remove separators from replacement string
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  7843
3127
29767bf8a215 better info of replace action (compound-undo-action has info, too)
Claus Gittinger <cg@exept.de>
parents: 3115
diff changeset
  7844
    self undoableDo:[
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  7845
        s := lastStringToReplace asString.
3816
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7846
        "remove final cr"
4566
21922c626af2 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4555
diff changeset
  7847
        (s endsWith:Character cr) ifTrue:[s := s copyButLast:1].
3127
29767bf8a215 better info of replace action (compound-undo-action has info, too)
Claus Gittinger <cg@exept.de>
parents: 3115
diff changeset
  7848
    "/        s := s withoutSpaces.        "XXX - replacing text with spaces ..."
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  7849
4053
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7850
        "set lastStringToReplace as the next search string 
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7851
         and set lastReplaceIgnoredCase as the next search ignored case flag"
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7852
        lastStringFromReplaceForNextSearch := s.
4053
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  7853
        lastSearchIgnoredCase := lastReplaceIgnoredCase.
4010
9c22bd531240 lastStringToReplace to use in again
fm
parents: 3996
diff changeset
  7854
3816
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7855
        savedSelectStyle := selectStyle.
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7856
        selectStyle := nil.
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7857
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7858
        sel := self selection.
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7859
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7860
        "if we are already there (after a find), ommit search"
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7861
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7862
        (sel notNil and:[sel asString withoutSeparators = s]) ifTrue:[
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7863
            l := selectionStartLine "cursorLine".
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7864
            c := selectionStartCol "cursorCol".
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7865
            self deleteSelection.
4051
4fdd00fbdc60 changed:
fm
parents: 4048
diff changeset
  7866
            lastReplacementInfo lastReplacement notNil ifTrue:[
4fdd00fbdc60 changed:
fm
parents: 4048
diff changeset
  7867
                self insertLines:lastReplacementInfo lastReplacement asStringCollection withCR:false.
3816
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7868
                self selectFromLine:l col:c toLine:cursorLine col:(cursorCol - 1).
4484
38f88010834c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  7869
                typeOfSelection := #paste
3816
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7870
            ].
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7871
            selectStyle := savedSelectStyle.
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7872
            ^ true
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7873
        ].
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7874
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7875
        sel isEmptyOrNil ifTrue:[
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7876
            startColForSearch := cursorCol - 1
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7877
        ] ifFalse:[
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7878
            startColForSearch := selectionEndCol ? (cursorCol - 1)
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7879
        ].
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7880
        self 
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7881
            searchForwardFor:s
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7882
            ignoreCase: lastReplaceIgnoredCase 
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7883
            match: lastReplaceWasMatch 
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7884
            startingAtLine:cursorLine col:startColForSearch
3816
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7885
            ifFound:
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7886
                [
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7887
                    :line :col |
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7888
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7889
                    |repl|
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7890
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7891
                    self selectFromLine:line col:col
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7892
                                 toLine:line col:(col + s size - 1).
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7893
                    self makeLineVisible:line.
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7894
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7895
                    self deleteSelection.
4051
4fdd00fbdc60 changed:
fm
parents: 4048
diff changeset
  7896
                    lastReplacementInfo lastReplacement notNil ifTrue:[
4fdd00fbdc60 changed:
fm
parents: 4048
diff changeset
  7897
                        lastReplacementInfo lastReplacement isString ifFalse:[
4fdd00fbdc60 changed:
fm
parents: 4048
diff changeset
  7898
                            repl := lastReplacementInfo lastReplacement asString "withoutSpaces"
3816
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7899
                        ] ifTrue:[
4051
4fdd00fbdc60 changed:
fm
parents: 4048
diff changeset
  7900
                            repl := lastReplacementInfo lastReplacement "withoutSpaces".
3816
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7901
                        ].
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7902
                        self insertLines:repl asStringCollection withCR:false.
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7903
                        self selectFromLine:line col:col toLine:cursorLine col:(cursorCol - 1).
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7904
                        undoSupport actionInfo:'replace'.
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7905
                    ].
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7906
                    selectStyle := savedSelectStyle.
4484
38f88010834c class: EditTextView
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  7907
                    typeOfSelection := #paste.
3816
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7908
                    ^ true
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7909
                ]
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  7910
            ifAbsent:
3816
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7911
                [
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7912
                    self sensor compressKeyPressEventsWithKey:#Again.
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7913
                    self showNotFound.
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7914
                    selectStyle := savedSelectStyle.
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7915
                    ^ false
3915f7b67262 again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents: 3813
diff changeset
  7916
                ].
3127
29767bf8a215 better info of replace action (compound-undo-action has info, too)
Claus Gittinger <cg@exept.de>
parents: 3115
diff changeset
  7917
    ].
2730
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2725
diff changeset
  7918
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2725
diff changeset
  7919
    ^ true.
501
13fc7b9ce5cb fixed (?) again-replace
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  7920
840
b0071cea13fd fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  7921
    "Modified: 9.10.1996 / 16:14:11 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  7922
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  7923
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7924
hasRedoAction
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  7925
    ^ undoSupport hasRedoAction.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7926
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7927
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7928
hasUndoAction
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  7929
    ^ undoSupport hasUndoAction.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7930
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7931
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7932
multipleAgain
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7933
    "repeat the last action (which was a cut or replace) until search fails"
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7934
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7935
    [self again] whileTrue:[]
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7936
!
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  7937
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7938
nonUndoableDo:aBlock
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  7939
    undoSupport nonUndoableDo:aBlock.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7940
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7941
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7942
redo
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  7943
    "undo the last undo"
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  7944
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  7945
    undoSupport hasRedoAction ifFalse:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  7946
        self beep
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  7947
    ] ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  7948
        undoSupport redo.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7949
    ]
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7950
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7951
121
claus
parents: 118
diff changeset
  7952
undo
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  7953
    "undo the last edit operation"
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  7954
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  7955
    undoSupport hasUndoAction ifFalse:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  7956
        self beep
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  7957
    ] ifTrue:[
3780
628343522da5 redo key
Claus Gittinger <cg@exept.de>
parents: 3732
diff changeset
  7958
        undoSupport undo.
121
claus
parents: 118
diff changeset
  7959
    ]
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7960
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7961
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7962
undoableDo:aBlock
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  7963
    self undoableDo:aBlock info:nil.
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  7964
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  7965
    "Modified: / 28-07-2007 / 13:20:14 / cg"
3130
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  7966
!
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  7967
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  7968
undoableDo:aBlock info:aString
3154
42bf7ebd54c8 refadctored intention revealing code:
Claus Gittinger <cg@exept.de>
parents: 3150
diff changeset
  7969
    self checkModificationsAllowed ifFalse:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  7970
	"/ will trigger an error-dialog there (no need for undo-carekeeping)
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  7971
	aBlock value.
3154
42bf7ebd54c8 refadctored intention revealing code:
Claus Gittinger <cg@exept.de>
parents: 3150
diff changeset
  7972
    ] ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  7973
	undoSupport undoableDo:aBlock info:aString.
3495
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  7974
    ].
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  7975
4ff7edbd5942 changed #dropFileObject:
Claus Gittinger <cg@exept.de>
parents: 3483
diff changeset
  7976
    "Modified: / 28-07-2007 / 13:21:00 / cg"
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7977
! !
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7978
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7979
!EditTextView::EditAction class methodsFor:'instance creation'!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7980
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7981
line1:arg1 col1:arg2 line2:arg3 col2:arg4
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7982
    ^ self new line1:arg1 col1:arg2 line2:arg3 col2:arg4
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7983
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7984
3115
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  7985
line1:arg1 col1:arg2 line2:arg3 col2:arg4 info:info
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7986
    ^ (self new line1:arg1 col1:arg2 line2:arg3 col2:arg4) info:info
3115
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  7987
!
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  7988
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7989
line:arg1 col:arg2 character:arg3
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7990
    ^ self new line:arg1 col:arg2 character:arg3
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7991
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  7992
3115
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  7993
line:arg1 col:arg2 character:arg3 info:info
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  7994
    ^ (self new line:arg1 col:arg2 character:arg3) info:info
3115
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  7995
!
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  7996
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  7997
line:arg1 col:arg2 characters:arg3 info:info
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  7998
    ^ (self new line:arg1 col:arg2 characters:arg3) info:info
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  7999
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8000
3156
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8001
line:arg1 col:arg2 info:arg3
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8002
    ^ self new line:arg1 col:arg2 info:arg3
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8003
!
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8004
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8005
line:arg1 col:arg2 string:arg3
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8006
    ^ self new line:arg1 col:arg2 string:arg3
3115
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8007
!
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8008
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8009
line:arg1 col:arg2 string:arg3 info:info
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8010
    ^ (self new line:arg1 col:arg2 string:arg3) info:info
3130
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8011
!
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8012
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8013
line:arg1 string:arg3 info:info
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8014
    ^ (self new line:arg1 string:arg3) info:info
3131
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8015
!
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8016
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8017
text:arg info:info
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8018
    ^ (self new text:arg) info:info
3115
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8019
! !
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8020
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8021
!EditTextView::EditAction methodsFor:'accessing'!
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8022
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8023
info
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8024
    ^ userFriendlyInfo
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8025
!
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8026
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8027
info:aString
b75128334006 info string in undo
Claus Gittinger <cg@exept.de>
parents: 3114
diff changeset
  8028
    userFriendlyInfo := aString
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8029
! !
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8030
3400
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8031
!EditTextView::EditAction methodsFor:'combining'!
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8032
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8033
canCombineWithPreviousPasteStringAction: aPasteStringAction
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8034
    ^ false.
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8035
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8036
    "Created: / 25-09-2006 / 12:16:25 / cg"
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8037
! !
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8038
3156
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8039
!EditTextView::EditAction methodsFor:'queries'!
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8040
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8041
canCombineWithNext:nextAction
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8042
    ^ false
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8043
! !
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8044
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8045
!EditTextView::DeleteRange methodsFor:'accessing'!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8046
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8047
line1:line1Arg col1:col1Arg line2:line2Arg col2:col2Arg
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8048
    "set instance variables (automatically generated)"
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8049
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8050
    self assert:(line1Arg notNil).
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8051
    self assert:(col1Arg notNil).
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8052
    self assert:(line2Arg notNil).
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8053
    self assert:(col2Arg notNil).
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8054
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8055
    line1 := line1Arg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8056
    col1 := col1Arg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8057
    line2 := line2Arg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8058
    col2 := col2Arg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8059
! !
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8060
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8061
!EditTextView::DeleteRange methodsFor:'execution'!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8062
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8063
executeIn:editor
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8064
    editor unselect.
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8065
    editor
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8066
	deleteFromLine:line1
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8067
	col:col1
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8068
	toLine:line2
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8069
	col:col2.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8070
    editor cursorLine:line1 col:col1.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8071
! !
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8072
3156
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8073
!EditTextView::DeleteCharacters methodsFor:'accessing'!
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8074
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8075
col1
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8076
    ^ col1
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8077
!
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8078
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8079
col2
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8080
    ^ col2
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8081
!
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8082
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8083
line
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8084
    ^ line
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8085
!
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8086
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8087
line:lineArg col1:col1Arg col2:col2Arg
3156
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8088
    "set instance variables (automatically generated)"
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8089
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8090
    self assert:(lineArg notNil).
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8091
    self assert:(col1Arg notNil).
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8092
    self assert:(col2Arg notNil).
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8093
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8094
    line := lineArg.
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8095
    col1 := col1Arg.
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8096
    col2 := col2Arg.
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8097
!
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8098
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8099
line:lineArg col:colArg info:infoArg
3156
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8100
    self assert:(lineArg notNil).
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8101
    self assert:(colArg notNil).
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8102
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8103
    line := lineArg.
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8104
    col1 := col2 := colArg.
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8105
    self info:infoArg.
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8106
! !
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8107
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8108
!EditTextView::DeleteCharacters methodsFor:'combining'!
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8109
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8110
canCombineWithNext:anotherAction
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8111
    ^ anotherAction perform:#canCombineWithPreviousDeleteCharactersAction: with:self ifNotUnderstood:false
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8112
!
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8113
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8114
canCombineWithPreviousDeleteCharactersAction:previousDeleteAction
3156
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8115
    "I will combine only if we both are single character deletes,
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8116
     and my col-to-delete is the next after anotherDeleteActions col-to-delete.
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8117
     (i.e. single-character typing)"
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8118
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8119
    previousDeleteAction line == line ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8120
	previousDeleteAction col2 == (col1-1) ifTrue:[
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8121
	    ^ true
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8122
	].
3156
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8123
    ].
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8124
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8125
    ^ false
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8126
!
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8127
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8128
combineWithNext:nextDeleteAction
3156
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8129
    self assert:(line == nextDeleteAction line).
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8130
    self assert:(col2 == (nextDeleteAction col1 - 1)).
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8131
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8132
    col2 := nextDeleteAction col2.
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8133
    userFriendlyInfo := 'insert ' , (col2 - col1 + 1) printString
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8134
! !
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8135
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8136
!EditTextView::DeleteCharacters methodsFor:'execution'!
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8137
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8138
executeIn:editor
3156
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8139
    editor unselect.
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8140
    editor
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8141
	deleteFromLine:line
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8142
	col:col1
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8143
	toLine:line
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8144
	col:col2.
3156
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8145
    editor cursorLine:line col:col1.
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8146
! !
25ef39958fd8 undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents: 3154
diff changeset
  8147
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8148
!EditTextView::EditMode class methodsFor:'constants'!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8149
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8150
insertAndSelectMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8151
    ^ InsertAndSelectMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8152
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8153
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8154
insertMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8155
    ^ InsertMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8156
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8157
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8158
overwriteMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8159
    ^ OverwriteMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8160
! !
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8161
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8162
!EditTextView::EditMode class methodsFor:'queries'!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8163
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8164
isInsertAndSelectMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8165
    ^ false
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8166
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8167
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8168
isInsertMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8169
    ^ false
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8170
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8171
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8172
symbolicName
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8173
    self subclassResponsibility
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8174
! !
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8175
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8176
!EditTextView::EditMode::InsertAndSelectMode class methodsFor:'info'!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8177
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8178
infoPrintString
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8179
    ^ 'IS'
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8180
! !
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8181
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8182
!EditTextView::EditMode::InsertAndSelectMode class methodsFor:'queries'!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8183
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8184
isInsertAndSelectMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8185
    ^ true
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8186
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8187
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8188
isInsertMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8189
    ^ true
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8190
! !
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8191
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8192
!EditTextView::EditMode::InsertMode class methodsFor:'info'!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8193
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8194
infoPrintString
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8195
    ^ 'I'
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8196
! !
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8197
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8198
!EditTextView::EditMode::InsertMode class methodsFor:'queries'!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8199
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8200
isInsertMode
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8201
    ^ true
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8202
! !
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8203
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8204
!EditTextView::EditMode::OverwriteMode class methodsFor:'info'!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8205
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8206
infoPrintString
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8207
    ^ 'O'
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8208
! !
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8209
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8210
!EditTextView::LastReplacementInfo methodsFor:'accessing'!
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8211
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8212
lastReplaceIgnoredCase
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8213
    ^ lastReplaceIgnoredCase ? false
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8214
!
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8215
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8216
lastReplaceIgnoredCase:something
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8217
    lastReplaceIgnoredCase := something.
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8218
!
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8219
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8220
lastReplaceWasMatch
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8221
    ^ lastReplaceWasMatch ? false
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8222
!
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8223
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8224
lastReplaceWasMatch:something
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8225
    lastReplaceWasMatch := something.
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8226
!
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8227
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8228
lastReplacement
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8229
    ^ lastReplacement
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8230
!
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8231
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8232
lastReplacement:something
4053
31117d801975 added: #setLastStringToReplace:
fm
parents: 4051
diff changeset
  8233
"/Transcript showCR: 'lastReplacement:', something printString.
4048
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8234
    lastReplacement := something.
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8235
!
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8236
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8237
lastStringToReplace
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8238
    ^ lastStringToReplace
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8239
!
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8240
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8241
lastStringToReplace:something
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8242
    lastStringToReplace := something.
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8243
! !
a2ec0cedffc2 LastReplacementInfo
fm
parents: 4042
diff changeset
  8244
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8245
!EditTextView::PasteString methodsFor:'accessing'!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8246
3400
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8247
col
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8248
    ^ col
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8249
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8250
    "Created: / 25-09-2006 / 12:19:59 / cg"
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8251
!
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8252
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8253
col2
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8254
    ^ col + string size - 1
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8255
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8256
    "Created: / 25-09-2006 / 12:20:18 / cg"
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8257
!
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8258
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8259
line
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8260
    ^ line
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8261
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8262
    "Created: / 25-09-2006 / 12:21:08 / cg"
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8263
!
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8264
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8265
line:lineArg col:colArg string:stringArg
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8266
    self assert:(lineArg notNil).
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8267
    self assert:(colArg notNil).
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8268
    self assert:(stringArg notNil).
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8269
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8270
    line := lineArg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8271
    col := colArg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8272
    string := stringArg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8273
!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8274
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8275
line:lineArg col:colArg string:stringArg selected:selectedArg
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8276
    self assert:(lineArg notNil).
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8277
    self assert:(colArg notNil).
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8278
    self assert:(stringArg notNil).
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8279
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8280
    line := lineArg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8281
    col := colArg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8282
    string := stringArg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8283
    selected := selectedArg.
3400
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8284
!
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8285
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8286
string
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8287
    ^ string
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8288
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8289
    "Created: / 25-09-2006 / 12:25:59 / cg"
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8290
! !
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8291
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8292
!EditTextView::PasteString methodsFor:'combining'!
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8293
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8294
canCombineWithNext:anotherAction
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8295
    ^ anotherAction canCombineWithPreviousPasteStringAction:self
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8296
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8297
    "Created: / 25-09-2006 / 12:15:59 / cg"
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8298
!
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8299
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8300
canCombineWithPreviousPasteStringAction: previousPasteAction
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8301
    "I will combine only if we both are single character inserts,
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8302
     and my col-to-insert is the next after anotherInsertActions end-col.
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8303
     (i.e. single-character deletes)"
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8304
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8305
    previousPasteAction line == line ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8306
	previousPasteAction col == (self col2+1) ifTrue:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8307
	    ^ true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8308
	].
3400
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8309
    ].
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8310
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8311
    ^ false
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8312
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8313
    "Modified: / 25-09-2006 / 12:22:21 / cg"
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8314
!
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8315
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8316
combineWithNext:nextPasteAction
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8317
    |s1 s2|
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8318
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8319
    self assert:(line == nextPasteAction line).
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8320
    self assert:((col - 1) == (nextPasteAction col2)).
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8321
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8322
    s1 := nextPasteAction string.
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8323
    s1 isString ifFalse:[s1 := s1 asStringWith:nil].
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8324
    s2 := string.
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8325
    s2 isString ifFalse:[s2 := s2 asStringWith:nil].
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8326
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8327
    string := s1, s2.
3400
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8328
    col := nextPasteAction col.
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8329
    userFriendlyInfo := 'delete ' , string size printString
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8330
c3fd4330f9ea undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents: 3326
diff changeset
  8331
    "Created: / 25-09-2006 / 12:24:10 / cg"
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8332
! !
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8333
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8334
!EditTextView::PasteString methodsFor:'execution'!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8335
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8336
executeIn:editor
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8337
    editor cursorLine:line col:col.
2989
5dcc2912bcb6 undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents: 2984
diff changeset
  8338
    editor paste:string.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8339
    selected ~~ true ifTrue:[
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8340
	editor unselect
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8341
    ].
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8342
! !
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8343
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8344
!EditTextView::ReplaceCharacter methodsFor:'accessing'!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8345
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8346
col
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8347
    ^ col
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8348
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8349
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8350
col1
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8351
    ^ col
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8352
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8353
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8354
col2
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8355
    ^ col
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8356
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8357
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8358
line
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8359
    ^ line
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8360
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8361
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8362
line:lineArg col:colArg character:characterArg
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8363
    line := lineArg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8364
    col := colArg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8365
    character := characterArg.
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8366
! !
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8367
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8368
!EditTextView::ReplaceCharacter methodsFor:'execution'!
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8369
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8370
executeIn:editor
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8371
    editor
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8372
	replace:character
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8373
	atLine:line
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8374
	col:col.
2952
08d18f507e05 first attempt for undo
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  8375
    editor cursorLine:line col:col.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  8376
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  8377
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8378
!EditTextView::ReplaceCharacters methodsFor:'accessing'!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8379
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8380
characters
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8381
    ^ characters
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8382
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8383
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8384
col1
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8385
    ^ col1
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8386
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8387
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8388
col2
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8389
    ^ col2
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8390
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8391
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8392
line
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8393
    ^ line
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8394
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8395
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8396
line:lineArg col:colArg character:characterArg
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8397
    line := lineArg.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8398
    col1 := col2 := colArg.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8399
    characters := characterArg asString.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8400
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8401
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8402
line:lineArg col:colArg characters:charactersArg
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8403
    line := lineArg.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8404
    col1 := colArg.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8405
    characters := charactersArg asString.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8406
    col2 := col1 + charactersArg size - 1
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8407
! !
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8408
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8409
!EditTextView::ReplaceCharacters methodsFor:'combining'!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8410
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8411
canCombineWithNext:anotherAction
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8412
    ^ anotherAction perform:#canCombineWithPreviousReplaceCharactersAction: with:self ifNotUnderstood:false
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8413
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8414
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8415
canCombineWithPreviousReplaceCharactersAction:previousReplaceAction
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8416
    "I will combine only if we both are single character deletes,
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8417
     and my col-to-delete is the next after anotherDeleteActions col-to-delete.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8418
     (i.e. single-character typing)"
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8419
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8420
    previousReplaceAction line == line ifTrue:[
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8421
	previousReplaceAction col2 == (col1-1) ifTrue:[
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8422
	    ^ true
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8423
	].
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8424
    ].
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8425
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8426
    ^ false
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8427
!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8428
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8429
combineWithNext:nextReplaceAction
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8430
    self assert:(line == nextReplaceAction line).
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8431
    self assert:(self col2 == (nextReplaceAction col1 - 1)).
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8432
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8433
    col2 := nextReplaceAction col2.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8434
    userFriendlyInfo := 'replace ' , (col2 - col1 + 1) printString.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8435
    characters := characters , nextReplaceAction characters.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8436
! !
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8437
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8438
!EditTextView::ReplaceCharacters methodsFor:'execution'!
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8439
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8440
executeIn:editor
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8441
    editor
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8442
	replaceString:characters
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8443
	atLine:line
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8444
	col:col1.
3235
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8445
    editor cursorLine:line col:col1.
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8446
! !
422c2db64114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3232
diff changeset
  8447
3131
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8448
!EditTextView::ReplaceContents methodsFor:'accessing'!
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8449
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8450
text:something
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8451
    text := something.
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8452
! !
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8453
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8454
!EditTextView::ReplaceContents methodsFor:'execution'!
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8455
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8456
executeIn:editor
3131
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8457
    editor contents:text
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8458
! !
8f21dba07d24 undoable format
Claus Gittinger <cg@exept.de>
parents: 3130
diff changeset
  8459
3130
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8460
!EditTextView::ReplaceLine methodsFor:'accessing'!
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8461
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8462
line:lineArg string:stringArg
3130
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8463
    line := lineArg.
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8464
    text := stringArg.
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8465
! !
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8466
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8467
!EditTextView::ReplaceLine methodsFor:'execution'!
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8468
3160
77096deedd53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3156
diff changeset
  8469
executeIn:editor
3130
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8470
    editor list at:line put:text.
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8471
    editor invalidateLine:line
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8472
! !
c0f39f9f28d6 undoable keyboard macros
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  8473
3402
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8474
!EditTextView::ReplaceLines methodsFor:'accessing'!
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8475
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8476
line:lineArg lines:lineCollectionArg
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8477
    line := lineArg.
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8478
    text := lineCollectionArg.
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8479
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8480
    "Created: / 09-10-2006 / 10:35:22 / cg"
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8481
! !
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8482
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8483
!EditTextView::ReplaceLines methodsFor:'execution'!
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8484
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8485
executeIn:editor
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8486
    |lnr|
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8487
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8488
    lnr := line.
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8489
    text do:[:eachLine |
3683
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8490
	editor list at:lnr put:eachLine.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8491
	editor invalidateLine:lnr.
5891af82a177 middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
  8492
	lnr := lnr + 1.
3402
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8493
    ].
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8494
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8495
    "Modified: / 09-10-2006 / 10:39:16 / cg"
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8496
! !
d6545009a22b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3400
diff changeset
  8497
865
d42c7c99e67d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 840
diff changeset
  8498
!EditTextView class methodsFor:'documentation'!
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  8499
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 214
diff changeset
  8500
version
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  8501
    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.587 2013-09-26 17:35:11 vrany Exp $'
3945
295e4733f3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3915
diff changeset
  8502
!
295e4733f3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3915
diff changeset
  8503
295e4733f3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3915
diff changeset
  8504
version_CVS
4801
69a5bff7b5cd Completion support refactored:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4786
diff changeset
  8505
    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.587 2013-09-26 17:35:11 vrany Exp $'
4843
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  8506
!
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  8507
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  8508
version_HG
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  8509
7cd827899263 Selection refactoring, part 2: update cursor position when selecting by mouse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4841
diff changeset
  8510
    ^ '$Changeset: <not expanded> $'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  8511
! !
4481
76c592c0ae9c class: EditTextView
Stefan Vogel <sv@exept.de>
parents: 4475
diff changeset
  8512