author | Claus Gittinger <cg@exept.de> |
Fri, 07 Oct 2011 15:56:28 +0200 | |
changeset 4328 | ea91d179b5f0 |
parent 4289 | d74f746d4c0d |
child 4360 | fe77e479d95a |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
3160 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
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 | 14 |
TextView subclass:#EditTextView |
2724 | 15 |
instanceVariableNames:'cursorLine cursorVisibleLine cursorCol cursorShown |
16 |
prevCursorState readOnly modifiedChannel fixedSize exceptionBlock |
|
17 |
cursorFgColor cursorBgColor cursorNoFocusFgColor cursorType |
|
4048 | 18 |
cursorTypeNoFocus typeOfSelection lastAction replacing |
4010 | 19 |
showMatchingParenthesis hasKeyboardFocus acceptAction lockUpdates |
20 |
tabMeansNextField autoIndent insertMode editMode trimBlankLines |
|
21 |
wordWrap replacementWordSelectStyle acceptChannel acceptEnabled |
|
22 |
st80Mode disableIfInvisible cursorMovementWhenUpdating learnMode |
|
23 |
learnedMacro cursorLineHolder cursorColHolder tabRequiresControl |
|
4048 | 24 |
undoSupport lastStringFromReplaceForNextSearch |
25 |
lastReplacementInfo' |
|
2724 | 26 |
classVariableNames:'DefaultCursorForegroundColor DefaultCursorBackgroundColor |
27 |
DefaultCursorType DefaultCursorNoFocusForegroundColor |
|
28 |
DefaultCursorTypeNoFocus' |
|
29 |
poolDictionaries:'' |
|
30 |
category:'Views-Text' |
|
0 | 31 |
! |
32 |
||
2952 | 33 |
Object subclass:#EditAction |
3115 | 34 |
instanceVariableNames:'userFriendlyInfo' |
2952 | 35 |
classVariableNames:'' |
36 |
poolDictionaries:'' |
|
37 |
privateIn:EditTextView |
|
38 |
! |
|
39 |
||
40 |
EditTextView::EditAction subclass:#DeleteRange |
|
41 |
instanceVariableNames:'line1 col1 line2 col2' |
|
42 |
classVariableNames:'' |
|
43 |
poolDictionaries:'' |
|
44 |
privateIn:EditTextView |
|
45 |
! |
|
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 | 54 |
Object subclass:#EditMode |
55 |
instanceVariableNames:'' |
|
56 |
classVariableNames:'' |
|
57 |
poolDictionaries:'' |
|
58 |
privateIn:EditTextView |
|
59 |
! |
|
60 |
||
61 |
EditTextView::EditMode subclass:#InsertAndSelectMode |
|
62 |
instanceVariableNames:'' |
|
63 |
classVariableNames:'' |
|
64 |
poolDictionaries:'' |
|
65 |
privateIn:EditTextView::EditMode |
|
66 |
! |
|
67 |
||
68 |
EditTextView::EditMode subclass:#InsertMode |
|
69 |
instanceVariableNames:'' |
|
70 |
classVariableNames:'' |
|
71 |
poolDictionaries:'' |
|
72 |
privateIn:EditTextView::EditMode |
|
73 |
! |
|
74 |
||
75 |
EditTextView::EditMode subclass:#OverwriteMode |
|
76 |
instanceVariableNames:'' |
|
77 |
classVariableNames:'InsertMode OverwriteMode InsertAndSelectMode' |
|
78 |
poolDictionaries:'' |
|
79 |
privateIn:EditTextView::EditMode |
|
80 |
! |
|
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 | 89 |
Object subclass:#LastReplacementInfo |
90 |
instanceVariableNames:'lastReplacement lastStringToReplace lastReplaceWasMatch |
|
91 |
lastReplaceIgnoredCase' |
|
92 |
classVariableNames:'' |
|
93 |
poolDictionaries:'' |
|
94 |
privateIn:EditTextView |
|
95 |
! |
|
96 |
||
2952 | 97 |
EditTextView::EditAction subclass:#PasteString |
98 |
instanceVariableNames:'line col string selected' |
|
99 |
classVariableNames:'' |
|
100 |
poolDictionaries:'' |
|
101 |
privateIn:EditTextView |
|
102 |
! |
|
103 |
||
104 |
EditTextView::EditAction subclass:#ReplaceCharacter |
|
105 |
instanceVariableNames:'line col character' |
|
106 |
classVariableNames:'' |
|
107 |
poolDictionaries:'' |
|
108 |
privateIn:EditTextView |
|
109 |
! |
|
110 |
||
3235 | 111 |
EditTextView::EditAction subclass:#ReplaceCharacters |
112 |
instanceVariableNames:'line col1 col2 characters' |
|
113 |
classVariableNames:'' |
|
114 |
poolDictionaries:'' |
|
115 |
privateIn:EditTextView |
|
116 |
! |
|
117 |
||
3131 | 118 |
EditTextView::EditAction subclass:#ReplaceContents |
119 |
instanceVariableNames:'text' |
|
120 |
classVariableNames:'' |
|
121 |
poolDictionaries:'' |
|
122 |
privateIn:EditTextView |
|
123 |
! |
|
124 |
||
3130 | 125 |
EditTextView::EditAction subclass:#ReplaceLine |
126 |
instanceVariableNames:'line text' |
|
127 |
classVariableNames:'' |
|
128 |
poolDictionaries:'' |
|
129 |
privateIn:EditTextView |
|
130 |
! |
|
131 |
||
3402 | 132 |
EditTextView::EditAction subclass:#ReplaceLines |
133 |
instanceVariableNames:'line text' |
|
134 |
classVariableNames:'' |
|
135 |
poolDictionaries:'' |
|
136 |
privateIn:EditTextView |
|
137 |
! |
|
138 |
||
865 | 139 |
!EditTextView class methodsFor:'documentation'! |
0 | 140 |
|
33 | 141 |
copyright |
142 |
" |
|
143 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
3160 | 144 |
All Rights Reserved |
33 | 145 |
|
146 |
This software is furnished under a license and may be used |
|
147 |
only in accordance with the terms of that license and with the |
|
148 |
inclusion of the above copyright notice. This software may not |
|
149 |
be provided or otherwise made available to, or used by, any |
|
150 |
other person. No title to or ownership of the software is |
|
151 |
hereby transferred. |
|
152 |
" |
|
153 |
! |
|
154 |
||
0 | 155 |
documentation |
156 |
" |
|
157 |
a view for editable text - adds editing functionality to TextView |
|
3160 | 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 | 160 |
|
161 |
If used with a model, this is informed by sending it a changeMsg with |
|
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 | 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 | 166 |
|
586 | 167 |
[Instance variables:] |
0 | 168 |
|
4010 | 169 |
cursorLine <Number> line where cursor sits (1..) |
170 |
||
171 |
cursorVisibleLine <Number> visible line where cursor sits (1..nLinesShown) |
|
172 |
||
173 |
cursorCol <Number> col where cursor sits (1..) |
|
174 |
||
175 |
cursorShown <Boolean> true, if cursor is currently shown |
|
176 |
||
177 |
readOnly <Boolean> true, if text may not be edited |
|
178 |
||
179 |
modifiedChannel <ValueHolder> holding true, if text has been modified. |
|
180 |
cleared on accept. |
|
181 |
||
182 |
acceptChannel <ValueHolder> holding true, if text has been accepted. |
|
183 |
||
184 |
fixedSize <Boolean> true, if no lines may be added/removed |
|
185 |
||
186 |
exceptionBlock <Block> block to be evaluated when readonly text is about to be modified |
|
187 |
if it returns true, the modification will be done anyway. |
|
188 |
if it returns anything else, the modification is not done. |
|
189 |
||
190 |
cursorFgColor <Color> color used for cursor drawing |
|
191 |
cursorBgColor <Color> color used for cursor drawing |
|
192 |
||
193 |
cursorType <Symbol> how the cursor is drawn; currently implemented |
|
194 |
are #block (solid-block cursor), #ibeam |
|
195 |
(vertical bar at insertion point) |
|
196 |
and #caret (caret below insertion-point) |
|
197 |
||
198 |
cursorTypeNoFocus <Symbol> like above, if view has no focus |
|
199 |
nil means: hide the cursor. |
|
200 |
||
201 |
undoAction <Block> block which undoes last cut, paste or replace |
|
202 |
(not yet fully implemented) |
|
203 |
||
204 |
typeOfSelection <Symbol> #paste, if selection created by paste, nil otherwise |
|
205 |
this affects the next keyPress: if #paste it does not |
|
206 |
replace; otherwise it replaces the selection. |
|
207 |
||
208 |
lastCut <String> last cut or replaced string |
|
209 |
||
4053 | 210 |
lastReplacementInfo <LastReplacementInfo> holds the information about the last replace action |
211 |
lastStringToReplace is the string to be replaced by lastReplacement |
|
212 |
lastReplacement is the string to replace lastStringToReplace |
|
213 |
||
214 |
lastStringFromReplaceForNextSearch <String> string to be taken be the next search action |
|
215 |
(cleared after a new selection) |
|
4010 | 216 |
|
217 |
replacing <Boolean> true if entered characters replace last selection |
|
218 |
||
219 |
showMatchingParenthesis <Boolean> if true, shows matching parenthesis |
|
220 |
when entering one; this is the default. |
|
221 |
||
222 |
hasKeyboardFocus <Boolean> true if this view has the focus |
|
223 |
||
224 |
acceptAction <Block> accept action - evaluated passing the contents as |
|
225 |
argument |
|
226 |
||
227 |
tabMeansNextField <Boolean> if true, Tab is ignored as input and shifts keyboard |
|
228 |
focus to the next field. For editTextViews, this is false |
|
229 |
by default (i.e. tabs can be entered into the text). |
|
230 |
For some subclasses (inputFields), this may be true. |
|
231 |
||
232 |
trimBlankLines <Boolean> if true, trailing blanks are |
|
233 |
removed when editing. |
|
234 |
Default is true. |
|
235 |
||
236 |
wordWrap <Boolean> Currently not used. |
|
237 |
||
238 |
lockUpdates <Boolean> internal, private |
|
239 |
||
240 |
prevCursorState <Boolean> temporary, private |
|
241 |
||
242 |
cursorMovementWhenUpdating |
|
243 |
<Symbol> defines where the cursor is to be positioned if the |
|
244 |
model changes its value by some outside activity |
|
245 |
(i.e. not by user input into the field). |
|
246 |
Can be one of: |
|
247 |
#keep / nil -> stay where it was |
|
248 |
#endOfText -> cursor to the end |
|
249 |
#endOfLine -> stay in the line, but move to end |
|
250 |
#beginOfText -> cursor to the beginning |
|
251 |
#beginOfLine -> stay in the line, but move to begin |
|
252 |
The default is #beginOfText |
|
253 |
||
254 |
||
255 |
||
256 |
dropTarget <DropTarget|nil> drop operation descriptor or nil (drop disabled) |
|
2589 | 257 |
|
258 |
||
2712
e83d71c9bdec
ST80Mode classVariables is now UserPreferences.st80EditMode
Claus Gittinger <cg@exept.de>
parents:
2707
diff
changeset
|
259 |
userPreference values: |
4010 | 260 |
userPreferences.st80EditMode |
261 |
<Boolean> if true, cursor positioning is |
|
262 |
done as in vi or ST80; i.e. |
|
263 |
wysiwyg mode is somewhat relaxed, |
|
264 |
in that the cursor cannot be |
|
265 |
positioned behind a lines end. |
|
266 |
This is not yet completely implemented. |
|
33 | 267 |
used globals: |
268 |
||
4010 | 269 |
DeleteHistory <Text> last 1000 lines of deleted text |
270 |
(but only if this variable exists already) |
|
586 | 271 |
|
272 |
[styleSheet parameters:] |
|
121 | 273 |
|
4010 | 274 |
textCursorForegroundColor <Color> cursor fg color; default: text background |
275 |
textCursorBackgroundColor <Color> cursor bg color; default: text foreground |
|
276 |
textCursorNoFocusForegroundColor |
|
277 |
<Color> cursor fg color if no focus; default: cursor fg color |
|
278 |
textCursorType <Symbol> cursor type; default: #block |
|
586 | 279 |
|
280 |
[author:] |
|
4010 | 281 |
Claus Gittinger |
586 | 282 |
|
283 |
[see also:] |
|
4010 | 284 |
CodeView Workspace TextView ListView |
285 |
EditField |
|
0 | 286 |
" |
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
287 |
! |
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 |
examples |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
290 |
" |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
291 |
non MVC operation: |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
292 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
293 |
basic setup: |
3160 | 294 |
[exBegin] |
295 |
|top textView| |
|
296 |
||
297 |
top := StandardSystemView new. |
|
298 |
top extent:300@200. |
|
299 |
||
300 |
textView := EditTextView new. |
|
301 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
302 |
top addSubView:textView. |
|
303 |
||
304 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
305 |
||
306 |
top open. |
|
307 |
[exEnd] |
|
594 | 308 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
309 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
310 |
with vertical scrollbar: |
3160 | 311 |
[exBegin] |
312 |
|top scrollView textView| |
|
313 |
||
314 |
top := StandardSystemView new. |
|
315 |
top extent:300@200. |
|
316 |
||
317 |
scrollView := ScrollableView for:EditTextView. |
|
318 |
textView := scrollView scrolledView. |
|
319 |
scrollView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
320 |
top addSubView:scrollView. |
|
321 |
||
322 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
323 |
||
324 |
top open. |
|
325 |
[exEnd] |
|
594 | 326 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
327 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
328 |
with horizontal & vertical scrollbars: |
3160 | 329 |
[exBegin] |
330 |
|top scrollView textView| |
|
331 |
||
332 |
top := StandardSystemView new. |
|
333 |
top extent:300@200. |
|
334 |
||
335 |
scrollView := HVScrollableView for:EditTextView. |
|
336 |
textView := scrollView scrolledView. |
|
337 |
scrollView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
338 |
top addSubView:scrollView. |
|
339 |
||
340 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
341 |
||
342 |
top open. |
|
343 |
[exEnd] |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
344 |
|
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 |
set the action for accept: |
3160 | 347 |
[exBegin] |
348 |
|top textView| |
|
349 |
||
350 |
top := StandardSystemView new. |
|
351 |
top extent:300@200. |
|
352 |
||
353 |
textView := EditTextView new. |
|
354 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
355 |
top addSubView:textView. |
|
356 |
||
357 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
358 |
textView acceptAction:[:contents | |
|
359 |
Transcript showCR:'will not overwrite the file with:'. |
|
360 |
Transcript showCR:contents asString |
|
361 |
]. |
|
362 |
top open. |
|
363 |
[exEnd] |
|
594 | 364 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
365 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
366 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
367 |
non-string (text) items: |
3160 | 368 |
[exBegin] |
369 |
|top textView list| |
|
370 |
||
371 |
list := '/etc/hosts' asFilename contentsOfEntireFile asStringCollection. |
|
372 |
1 to:list size by:2 do:[:nr | |
|
373 |
list at:nr put:(Text string:(list at:nr) |
|
374 |
emphasis:(Array with:#bold with:(#color->Color red))) |
|
375 |
]. |
|
376 |
||
377 |
top := StandardSystemView new. |
|
378 |
top extent:300@200. |
|
379 |
||
380 |
textView := EditTextView new. |
|
381 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
382 |
top addSubView:textView. |
|
383 |
||
384 |
textView contents:list. |
|
385 |
top open. |
|
386 |
[exEnd] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
387 |
|
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 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
390 |
MVC operation: |
594 | 391 |
(the examples model here is a plug simulating a real model; |
392 |
real world applications would not use a plug ..) |
|
3160 | 393 |
[exBegin] |
394 |
|top textView model| |
|
395 |
||
396 |
model := Plug new. |
|
397 |
model respondTo:#accepted: |
|
398 |
with:[:newContents | |
|
399 |
Transcript showCR:'will not overwrite the file with:'. |
|
400 |
Transcript showCR:newContents asString |
|
401 |
]. |
|
402 |
model respondTo:#getList |
|
403 |
with:['/etc/hosts' asFilename contentsOfEntireFile]. |
|
404 |
||
405 |
||
406 |
top := StandardSystemView new. |
|
407 |
top extent:300@200. |
|
408 |
||
409 |
textView := EditTextView new. |
|
410 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
411 |
top addSubView:textView. |
|
412 |
||
413 |
textView listMessage:#getList; |
|
414 |
model:model; |
|
415 |
changeMessage:#accepted:; |
|
416 |
aspect:#list. |
|
417 |
top open. |
|
418 |
[exEnd] |
|
594 | 419 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
420 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
421 |
two textViews on the same model: |
3160 | 422 |
[exBegin] |
423 |
|top1 textView1 top2 textView2 model currentContents| |
|
424 |
||
425 |
model := Plug new. |
|
426 |
model respondTo:#accepted: |
|
427 |
with:[:newContents | |
|
428 |
Transcript showCR:'accepted:'. |
|
429 |
Transcript showCR:newContents asString. |
|
430 |
currentContents := newContents. |
|
431 |
model changed:#contents |
|
432 |
]. |
|
433 |
model respondTo:#getList |
|
434 |
with:[Transcript showCR:'query'. |
|
435 |
currentContents]. |
|
436 |
||
437 |
||
438 |
top1 := StandardSystemView new. |
|
439 |
top1 extent:300@200. |
|
440 |
||
441 |
textView1 := EditTextView new. |
|
442 |
textView1 origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
443 |
top1 addSubView:textView1. |
|
444 |
||
445 |
textView1 listMessage:#getList; |
|
446 |
model:model; |
|
447 |
aspect:#contents; |
|
448 |
changeMessage:#accepted:. |
|
449 |
top1 open. |
|
450 |
||
451 |
top2 := StandardSystemView new. |
|
452 |
top2 extent:300@200. |
|
453 |
||
454 |
textView2 := EditTextView new. |
|
455 |
textView2 origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
456 |
top2 addSubView:textView2. |
|
457 |
||
458 |
textView2 listMessage:#getList; |
|
459 |
model:model; |
|
460 |
aspect:#contents; |
|
461 |
changeMessage:#accepted:. |
|
462 |
top2 open. |
|
463 |
[exEnd] |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
464 |
" |
0 | 465 |
! ! |
466 |
||
865 | 467 |
!EditTextView class methodsFor:'defaults'! |
59 | 468 |
|
1419 | 469 |
st80Mode |
470 |
"return true, if the st80 editing mode is turned on. |
|
471 |
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
|
472 |
beyond the end of a line or the end of the text." |
1419 | 473 |
|
2647
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
474 |
^ UserPreferences current st80EditMode |
1419 | 475 |
|
476 |
" |
|
477 |
EditTextView st80Mode:true |
|
478 |
EditTextView st80Mode:false |
|
479 |
" |
|
480 |
||
481 |
"Modified: / 16.1.1998 / 22:54:57 / cg" |
|
482 |
! |
|
483 |
||
484 |
st80Mode:aBoolean |
|
485 |
"turns on/off st80 behavior, where the cursor cannot be positioned |
|
2707 | 486 |
beyond the end of a line or the last line" |
1419 | 487 |
|
2647
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
488 |
UserPreferences current st80EditMode:aBoolean. |
1419 | 489 |
|
490 |
" |
|
491 |
EditTextView st80Mode:true |
|
492 |
EditTextView st80Mode:false |
|
493 |
" |
|
494 |
||
495 |
"Modified: / 16.1.1998 / 22:55:19 / cg" |
|
496 |
! |
|
497 |
||
59 | 498 |
updateStyleCache |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
499 |
"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
|
500 |
|
1390 | 501 |
<resource: #style (#'textCursor.foregroundColor' #'textCursor.backgroundColor' |
3160 | 502 |
#'textCursor.noFocusForegroundColor' |
503 |
#'textCursor.type' |
|
504 |
#'textCursor.typeNoFocus' |
|
505 |
#'editText.st80Mode')> |
|
1355 | 506 |
|
507 |
DefaultCursorForegroundColor := StyleSheet colorAt:'textCursor.foregroundColor'. |
|
508 |
DefaultCursorBackgroundColor := StyleSheet colorAt:'textCursor.backgroundColor'. |
|
509 |
DefaultCursorNoFocusForegroundColor := StyleSheet colorAt:'textCursor.noFocusForegroundColor'. |
|
510 |
DefaultCursorType := StyleSheet at:'textCursor.type' default:#block. |
|
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
511 |
DefaultCursorTypeNoFocus := StyleSheet at:'textCursor.typeNoFocus'. |
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
512 |
|
1419 | 513 |
" |
514 |
self updateStyleCache |
|
515 |
" |
|
516 |
||
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
517 |
"Modified: / 20.5.1998 / 04:27:41 / cg" |
59 | 518 |
! ! |
519 |
||
3431 | 520 |
!EditTextView class methodsFor:'specs'! |
521 |
||
522 |
searchReplaceDialogSpec |
|
523 |
"This resource specification was automatically generated |
|
524 |
by the UIPainter of ST/X." |
|
525 |
||
526 |
"Do not manually edit this!! If it is corrupted, |
|
527 |
the UIPainter may not be able to read the specification." |
|
528 |
||
529 |
" |
|
530 |
UIPainter new openOnClass:DAPASX::ProjectEditorTextView andSelector:#searchReplaceDialogSpec |
|
531 |
" |
|
532 |
||
533 |
<resource: #canvas> |
|
534 |
||
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
535 |
^ |
3431 | 536 |
#(FullSpec |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
537 |
name: searchReplaceDialogSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
538 |
window: |
3431 | 539 |
(WindowSpec |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
540 |
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
|
541 |
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
|
542 |
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
|
543 |
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
|
544 |
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
|
545 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
546 |
component: |
3431 | 547 |
(SpecCollection |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
548 |
collection: ( |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
549 |
(LabelSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
550 |
label: 'Search Pattern:' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
551 |
name: 'label' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
552 |
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
|
553 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
554 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
555 |
adjust: left |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
556 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
557 |
(ComboBoxSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
558 |
name: 'patternComboBox' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
559 |
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
|
560 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
561 |
model: searchPattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
562 |
immediateAccept: false |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
563 |
acceptOnLeave: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
564 |
acceptOnReturn: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
565 |
acceptOnTab: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
566 |
acceptOnLostFocus: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
567 |
acceptOnPointerLeave: false |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
568 |
autoSelectInitialText: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
569 |
comboList: patternList |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
570 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
571 |
(ComboBoxSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
572 |
name: 'replaceComboBox' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
573 |
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
|
574 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
575 |
model: replacePattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
576 |
immediateAccept: false |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
577 |
acceptOnLeave: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
578 |
acceptOnReturn: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
579 |
acceptOnTab: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
580 |
acceptOnLostFocus: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
581 |
acceptOnPointerLeave: false |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
582 |
autoSelectInitialText: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
583 |
comboList: patternList |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
584 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
585 |
(CheckBoxSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
586 |
label: 'Ignore Case' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
587 |
name: 'ignoreCaseCheckBox' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
588 |
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
|
589 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
590 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
591 |
model: ignoreCase |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
592 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
593 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
594 |
(VariableVerticalPanelSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
595 |
name: 'VariableVerticalPanel1' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
596 |
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
|
597 |
component: |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
598 |
(SpecCollection |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
599 |
collection: ( |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
600 |
(HorizontalPanelViewSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
601 |
name: 'HorizontalPanel1' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
602 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
603 |
horizontalLayout: fitSpace |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
604 |
verticalLayout: center |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
605 |
horizontalSpace: 3 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
606 |
verticalSpace: 3 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
607 |
ignoreInvisibleComponents: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
608 |
reverseOrderIfOKAtLeft: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
609 |
component: |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
610 |
(SpecCollection |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
611 |
collection: ( |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
612 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
613 |
label: 'Replace' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
614 |
name: 'replaceButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
615 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
616 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
617 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
618 |
model: replaceAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
619 |
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
|
620 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
621 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
622 |
label: 'Replace All' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
623 |
name: 'replaceAllButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
624 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
625 |
borderWidth: 1 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
626 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
627 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
628 |
model: replaceAllAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
629 |
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
|
630 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
631 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
632 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
633 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
634 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
635 |
(HorizontalPanelViewSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
636 |
name: 'horizontalPanelView' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
637 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
638 |
horizontalLayout: fitSpace |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
639 |
verticalLayout: center |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
640 |
horizontalSpace: 3 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
641 |
verticalSpace: 3 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
642 |
ignoreInvisibleComponents: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
643 |
reverseOrderIfOKAtLeft: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
644 |
component: |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
645 |
(SpecCollection |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
646 |
collection: ( |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
647 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
648 |
label: 'Cancel' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
649 |
name: 'cancelButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
650 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
651 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
652 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
653 |
model: cancel |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
654 |
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
|
655 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
656 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
657 |
label: 'Prev' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
658 |
name: 'prevButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
659 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
660 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
661 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
662 |
model: prevAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
663 |
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
|
664 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
665 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
666 |
label: 'Next' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
667 |
name: 'nextButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
668 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
669 |
borderWidth: 1 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
670 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
671 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
672 |
model: nextAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
673 |
isDefault: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
674 |
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
|
675 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
676 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
677 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
678 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
679 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
680 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
681 |
|
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 |
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
|
684 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
685 |
(LabelSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
686 |
label: 'Replace By:' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
687 |
name: 'ReplaceLabel' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
688 |
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
|
689 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
690 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
691 |
adjust: left |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
692 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
693 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
694 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
695 |
) |
3431 | 696 |
) |
697 |
||
698 |
"Modified: / 11-10-2006 / 21:05:09 / cg" |
|
699 |
! ! |
|
700 |
||
2744 | 701 |
!EditTextView methodsFor:'Compatibility-ST80'! |
1552
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
702 |
|
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
703 |
autoAccept:aBoolean |
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
704 |
"ignored for now" |
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
705 |
|
2019 | 706 |
"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
|
707 |
! |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
708 |
|
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
709 |
continuousAccept:aBoolean |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
710 |
"ignored for now" |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
711 |
|
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
712 |
"Created: / 19.6.1998 / 00:03:49 / cg" |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
713 |
! |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
714 |
|
1390 | 715 |
cutSelection |
716 |
self cut |
|
717 |
||
718 |
"Created: / 31.10.1997 / 03:29:50 / cg" |
|
719 |
! |
|
720 |
||
1590 | 721 |
deselect |
722 |
"remove the selection" |
|
723 |
||
724 |
^ self unselect |
|
725 |
||
726 |
"Created: / 19.6.1998 / 02:41:54 / cg" |
|
727 |
! |
|
728 |
||
2101 | 729 |
enabled:aBoolean |
730 |
||
731 |
self readOnly:aBoolean not |
|
732 |
||
733 |
"Created: / 30.3.1999 / 15:10:23 / stefan" |
|
734 |
"Modified: / 30.3.1999 / 15:10:53 / stefan" |
|
735 |
! |
|
736 |
||
1732
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
737 |
find:pattern |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
738 |
self searchFwd:pattern ifAbsent:nil |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
739 |
|
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
740 |
"Created: / 29.1.1999 / 19:09:42 / cg" |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
741 |
"Modified: / 29.1.1999 / 19:10:12 / cg" |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
742 |
! |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
743 |
|
1294
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
744 |
insert:aString at:aCharacterPosition |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
745 |
"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
|
746 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
747 |
|line col| |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
748 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
749 |
line := self lineOfCharacterPosition:aCharacterPosition. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
750 |
col := aCharacterPosition - (self characterPositionOfLine:line col:1) + 1. |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
751 |
col < 1 ifTrue:[ |
3160 | 752 |
col := 1 |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
753 |
]. |
1294
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
754 |
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
|
755 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
756 |
" |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
757 |
|top v| |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
758 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
759 |
top := StandardSystemView new. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
760 |
top extent:300@300. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
761 |
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
|
762 |
top openAndWait. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
763 |
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
|
764 |
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
|
765 |
" |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
766 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
767 |
"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
|
768 |
! |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
769 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
770 |
insertAndSelect:aString at:aCharacterPosition |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
771 |
"insert a selected string at aCharacterPosition." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
772 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
773 |
|line col| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
774 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
775 |
line := self lineOfCharacterPosition:aCharacterPosition. |
2310 | 776 |
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
|
777 |
self insertString:aString atLine:line col:col. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
778 |
self selectFromLine:line col:col toLine:line col:col + aString size - 1 |
125 | 779 |
" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
780 |
|v| |
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 |
v := EditTextView new openAndWait. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
783 |
v contents:'1234567890\1234567890\1234567890\' withCRs. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
784 |
v insertAndSelect:'<- hello there' at:5. |
125 | 785 |
" |
1390 | 786 |
! |
787 |
||
788 |
pasteSelection |
|
789 |
self paste |
|
790 |
||
791 |
"Created: / 31.10.1997 / 03:28:53 / cg" |
|
1590 | 792 |
! |
793 |
||
794 |
replaceSelectionWith:aString |
|
795 |
^ self replaceSelectionBy:aString |
|
796 |
||
797 |
"Created: / 19.6.1998 / 02:42:32 / cg" |
|
798 |
! |
|
799 |
||
800 |
selectAt:pos |
|
801 |
"move the cursor before cursorPosition." |
|
802 |
||
803 |
self cursorToCharacterPosition:pos |
|
804 |
||
805 |
"Modified: / 19.6.1998 / 02:41:28 / cg" |
|
806 |
"Created: / 19.6.1998 / 02:43:39 / cg" |
|
807 |
! |
|
808 |
||
809 |
selectFrom:startPos to:endPos |
|
810 |
"change the selection given two aCharacterPositions." |
|
811 |
||
812 |
|line1 col1 line2 col2| |
|
813 |
||
814 |
startPos > endPos ifTrue:[ |
|
3160 | 815 |
^ self unselect |
1590 | 816 |
]. |
817 |
||
818 |
line1 := self lineOfCharacterPosition:startPos. |
|
819 |
col1 := startPos - (self characterPositionOfLine:line1 col:1) + 1. |
|
820 |
col1 < 1 ifTrue:[ |
|
3160 | 821 |
col1 := 1 |
1590 | 822 |
]. |
823 |
line2 := self lineOfCharacterPosition:endPos. |
|
824 |
col2 := startPos - (self characterPositionOfLine:line2 col:1) + 1. |
|
825 |
col2 < 1 ifTrue:[ |
|
3160 | 826 |
col2 := 1 |
1590 | 827 |
]. |
828 |
self selectFromLine:line1 col:col1 toLine:line2 col:col2 |
|
829 |
||
830 |
"Modified: / 19.6.1998 / 02:41:28 / cg" |
|
2101 | 831 |
! |
832 |
||
833 |
textHasChanged |
|
834 |
^ self modified |
|
835 |
||
836 |
"Created: / 19.6.1998 / 00:09:43 / cg" |
|
2117
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
837 |
! |
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
838 |
|
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
839 |
textHasChanged:aBoolean |
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
840 |
"ST-80 compatibility: set/clear the modified flag." |
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
841 |
|
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
842 |
self modified:aBoolean |
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
843 |
|
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
844 |
"Created: / 5.2.2000 / 17:07:59 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
845 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
846 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
847 |
!EditTextView methodsFor:'accessing-behavior'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
848 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
849 |
acceptAction |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
850 |
"return the action to be performed on accept (or nil)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
851 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
852 |
^ acceptAction |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
853 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
854 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
855 |
acceptAction:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
856 |
"set the action to be performed on accept" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
857 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
858 |
acceptAction := aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
859 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
860 |
|
2792 | 861 |
acceptChannel |
862 |
"return the valueHolder holding true if text was accepted. |
|
863 |
By placing a true into this channel, an accept can also be forced." |
|
864 |
||
865 |
^ acceptChannel |
|
866 |
||
867 |
"Modified: / 30.1.1998 / 14:17:11 / cg" |
|
868 |
! |
|
869 |
||
870 |
acceptChannel:aValueHolder |
|
871 |
"set the valueHolder holding true if text was accepted. |
|
872 |
By placing a true into this channel, an accept can also be forced." |
|
873 |
||
874 |
|prev| |
|
875 |
||
876 |
prev := acceptChannel. |
|
877 |
acceptChannel := aValueHolder. |
|
878 |
self setupChannel:aValueHolder for:nil withOld:prev |
|
879 |
||
880 |
"Created: / 30.1.1998 / 14:51:09 / cg" |
|
881 |
! |
|
882 |
||
1108 | 883 |
acceptEnabled:aBoolean |
884 |
"enable/disable accept. This greys the corresponding item in the menu" |
|
885 |
||
886 |
acceptEnabled := aBoolean |
|
887 |
||
888 |
"Created: 7.3.1997 / 11:04:34 / cg" |
|
889 |
! |
|
890 |
||
2792 | 891 |
accepted |
892 |
"return true if text was accepted" |
|
893 |
||
894 |
^ acceptChannel value |
|
895 |
||
896 |
"Created: 14.2.1997 / 16:43:46 / cg" |
|
897 |
! |
|
898 |
||
899 |
accepted:aBoolean |
|
900 |
"set/clear the accepted flag. |
|
901 |
This may force my current contents to be placed into my model." |
|
902 |
||
903 |
acceptChannel value:aBoolean. |
|
904 |
||
905 |
"Created: / 14.2.1997 / 16:44:01 / cg" |
|
906 |
"Modified: / 30.1.1998 / 14:20:15 / cg" |
|
907 |
! |
|
908 |
||
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
909 |
autoIndent:aBoolean |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
910 |
autoIndent := aBoolean |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
911 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
912 |
"Created: 5.3.1996 / 14:37:50 / cg" |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
913 |
! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
914 |
|
2774 | 915 |
cursorMovementWhenUpdating |
3160 | 916 |
"return what is be done with the cursor, |
2774 | 917 |
when I get a new text (via the model or the #contents/#list) |
918 |
Allowed arguments are: |
|
3160 | 919 |
#keep / nil -> stay where it was |
920 |
#endOfText -> position cursor to the end |
|
921 |
#beginOfText -> position cursor to the beginning |
|
922 |
#endOfLine -> position cursor to the current lines end |
|
923 |
#beginOfLine -> position cursor to the current lines start |
|
2774 | 924 |
The default is #beginOfText. |
925 |
This may be useful for fields which get new values assigned from |
|
926 |
the program (i.e. not from the user)" |
|
927 |
||
928 |
^ cursorMovementWhenUpdating |
|
929 |
||
930 |
"Modified: 16.12.1995 / 16:27:55 / cg" |
|
931 |
! |
|
932 |
||
2133 | 933 |
cursorMovementWhenUpdating:aSymbolOrNil |
3160 | 934 |
"define what should be done with the cursor, |
2133 | 935 |
when I get a new text (via the model or the #contents/#list) |
936 |
Allowed arguments are: |
|
3160 | 937 |
#keep / nil -> stay where it was |
938 |
#endOfText -> position cursor to the end |
|
939 |
#beginOfText -> position cursor to the beginning |
|
940 |
#endOfLine -> position cursor to the current lines end |
|
941 |
#beginOfLine -> position cursor to the current lines start |
|
2133 | 942 |
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
|
943 |
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
|
944 |
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
|
945 |
|
2133 | 946 |
cursorMovementWhenUpdating := aSymbolOrNil |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
947 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
948 |
"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
|
949 |
! |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
950 |
|
2035
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
951 |
disableIfInvisible:aBoolean |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
952 |
disableIfInvisible := aBoolean |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
953 |
! |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
954 |
|
2438 | 955 |
dontReplaceSelectionOnInput |
956 |
typeOfSelection := #paste |
|
957 |
! |
|
958 |
||
3235 | 959 |
editModeHolder |
960 |
^ editMode. |
|
961 |
! |
|
962 |
||
963 |
editModeInsert |
|
964 |
editMode value:EditMode insertMode |
|
965 |
! |
|
966 |
||
967 |
editModeInsertAndSelect |
|
968 |
editMode value:EditMode insertAndSelectMode |
|
969 |
! |
|
970 |
||
971 |
editModeOverwrite |
|
972 |
editMode value:EditMode overwriteMode |
|
973 |
! |
|
974 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
975 |
exceptionBlock:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
976 |
"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
|
977 |
readonly text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
978 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
979 |
exceptionBlock := aBlock |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
980 |
! |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
981 |
|
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
982 |
fixedSize |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
983 |
"make the texts size fixed (no lines may be added). |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
984 |
OBSOLETE: use readOnly" |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
985 |
|
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
986 |
<resource:#obsolete> |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
987 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
988 |
|menu| |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
989 |
|
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
990 |
self obsoleteMethodWarning:'use #readOnly:'. |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
991 |
readOnly == true ifFalse:[ |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
992 |
readOnly := true. |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
993 |
(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
|
994 |
menu disableAll:#(cut paste replace indent) |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
995 |
] |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
996 |
] |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
997 |
|
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
998 |
"Modified: 14.2.1997 / 17:35:24 / cg" |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
999 |
! |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
1000 |
|
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
1001 |
insertMode:aBoolean |
3235 | 1002 |
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
|
1003 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
1004 |
"Created: 6.3.1996 / 12:24:05 / cg" |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
1005 |
! |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
1006 |
|
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
1007 |
insertModeHolder |
3235 | 1008 |
^ BlockValue |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1009 |
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
|
1010 |
argument:(editMode). |
3465 | 1011 |
|
1012 |
"Modified: / 08-03-2007 / 22:58:37 / cg" |
|
3235 | 1013 |
! |
1014 |
||
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1015 |
isInInsertMode |
3235 | 1016 |
^ editMode value isInsertMode |
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
1017 |
! |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
1018 |
|
2792 | 1019 |
isReadOnly |
1020 |
"return true, if the text is readonly." |
|
1021 |
||
1022 |
^ readOnly value |
|
1023 |
||
1024 |
"Modified: 14.2.1997 / 17:35:56 / cg" |
|
1025 |
! |
|
1026 |
||
2796 | 1027 |
modeLabelHolder |
1028 |
"a valueHolder, which contains 'L' (learnMode), I (insertMode) or empty" |
|
1029 |
||
3160 | 1030 |
^ BlockValue |
4041 | 1031 |
with:[:e :l | |
1032 |
self isReadOnly ifTrue:[ |
|
1033 |
'' |
|
1034 |
] ifFalse:[ |
|
1035 |
l ifTrue:[ 'L' allBold colorizeAllWith:Color red] |
|
1036 |
ifFalse:[ e infoPrintString]]] |
|
1037 |
argument:(self editModeHolder) |
|
1038 |
argument:(self learnModeHolder). |
|
3465 | 1039 |
|
1040 |
"Modified: / 08-03-2007 / 22:58:59 / cg" |
|
2796 | 1041 |
! |
1042 |
||
2792 | 1043 |
modified |
1044 |
"return true if text was modified" |
|
1045 |
||
1046 |
^ modifiedChannel value |
|
1047 |
! |
|
1048 |
||
1049 |
modified:aBoolean |
|
1050 |
"set/clear the modified flag" |
|
1051 |
||
1052 |
modifiedChannel value:aBoolean |
|
1053 |
||
1054 |
"Modified: 14.2.1997 / 16:44:05 / cg" |
|
1055 |
! |
|
1056 |
||
1057 |
modifiedChannel |
|
1058 |
"return the valueHolder holding true if text was modified" |
|
1059 |
||
1060 |
^ modifiedChannel |
|
1061 |
! |
|
1062 |
||
1063 |
modifiedChannel:aValueHolder |
|
1064 |
"set the valueHolder holding true if text was modified" |
|
1065 |
||
1066 |
|prev| |
|
1067 |
||
1068 |
prev := modifiedChannel. |
|
1069 |
modifiedChannel := aValueHolder. |
|
1070 |
self setupChannel:aValueHolder for:nil withOld:prev |
|
1071 |
||
1072 |
"Created: / 30.1.1998 / 14:51:32 / cg" |
|
1073 |
! |
|
1074 |
||
1075 |
readOnly |
|
1076 |
"make the text readonly. |
|
1077 |
Somewhat obsolete - use #readOnly:" |
|
1078 |
||
1079 |
<resource:#obsolete> |
|
1080 |
||
1081 |
self obsoleteMethodWarning:'use #readOnly:'. |
|
3705 | 1082 |
self readOnly:true. |
2792 | 1083 |
|
1084 |
"Modified: 14.2.1997 / 17:35:56 / cg" |
|
1085 |
! |
|
1086 |
||
1087 |
readOnly:aBoolean |
|
1088 |
"make the text readonly (aBoolean == true) or writable (aBoolean == false). |
|
1089 |
The argument may also be a valueHolder." |
|
1090 |
||
1091 |
readOnly := aBoolean |
|
1092 |
||
1093 |
"Created: 14.2.1997 / 17:35:39 / cg" |
|
1094 |
! |
|
1095 |
||
4192 | 1096 |
st80Mode:aBoolean |
1097 |
"set/clear the st80Mode flag. |
|
1098 |
If on, the cursor wraps at the line end (like in vi or st80); |
|
1099 |
if off, we have the Rand-editor behavior (random access)" |
|
1100 |
||
1101 |
st80Mode := aBoolean |
|
1102 |
||
1103 |
"Created: / 09-11-2010 / 13:55:50 / cg" |
|
1104 |
! |
|
1105 |
||
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1106 |
tabMeansNextField:aBoolean |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1107 |
"set/clear tabbing to the next field. |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1108 |
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
|
1109 |
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
|
1110 |
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
|
1111 |
input fields." |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1112 |
|
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1113 |
tabMeansNextField := aBoolean |
2779
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1114 |
! |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1115 |
|
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1116 |
tabRequiresControl |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1117 |
"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
|
1118 |
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
|
1119 |
to allow for easier text entry" |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1120 |
|
3160 | 1121 |
^ tabRequiresControl |
2779
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1122 |
! |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1123 |
|
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1124 |
tabRequiresControl:aBoolean |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1125 |
"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
|
1126 |
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
|
1127 |
to allow for easier text entry" |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1128 |
|
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1129 |
tabRequiresControl := aBoolean |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1130 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1131 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1132 |
!EditTextView methodsFor:'accessing-contents'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1133 |
|
1902
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1134 |
at:lineNr basicPut:aLine |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1135 |
"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
|
1136 |
|
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1137 |
(self at:lineNr) = aLine ifFalse:[ |
3160 | 1138 |
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
|
1139 |
]. |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1140 |
! |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1141 |
|
522 | 1142 |
at:lineNr put:aLine |
1143 |
(self at:lineNr) = aLine ifFalse:[ |
|
3160 | 1144 |
super at:lineNr put:aLine. |
1145 |
self textChanged |
|
522 | 1146 |
]. |
1147 |
! |
|
1148 |
||
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1149 |
characterBeforeCursor |
2707 | 1150 |
"return the character under the cursor - space if beyond line. |
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1151 |
For non-block cursors, this is the character immediately to the right |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1152 |
of the insertion-bar or caret." |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1153 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1154 |
cursorCol == 1 ifTrue:[^ nil]. |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1155 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1156 |
^ self characterAtLine:cursorLine col:cursorCol-1 |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1157 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1158 |
"Created: / 17.6.1998 / 15:16:41 / cg" |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1159 |
! |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1160 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1161 |
characterUnderCursor |
2707 | 1162 |
"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
|
1163 |
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
|
1164 |
of the insertion-bar or caret." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1165 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1166 |
^ self characterAtLine:cursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1167 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1168 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1169 |
contents |
2213 | 1170 |
"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
|
1171 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1172 |
list isNil ifTrue:[^ '']. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1173 |
self removeTrailingBlankLines. |
3707
8f6bc68b9319
changed #contents - formatting and comments
Stefan Vogel <sv@exept.de>
parents:
3705
diff
changeset
|
1174 |
^ super contents. |
3313 | 1175 |
|
1176 |
"Modified: / 04-07-2006 / 19:22:32 / fm" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1177 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1178 |
|
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1179 |
contents:something |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1180 |
self contents:something keepUndoHistory:false. |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1181 |
! |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1182 |
|
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1183 |
contents:something keepUndoHistory:keepUndoHistory |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1184 |
super contents:something. |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1185 |
keepUndoHistory ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1186 |
undoSupport resetHistories. |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1187 |
]. |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1188 |
! |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1189 |
|
2213 | 1190 |
contentsAsString |
1191 |
"return the contents as a String (i.e. without emphasis)" |
|
1192 |
||
1193 |
list isNil ifTrue:[^ '']. |
|
1194 |
self removeTrailingBlankLines. |
|
1195 |
^ (list collect:[:each | each isNil ifTrue:[''] |
|
3160 | 1196 |
ifFalse:[each string] |
1197 |
]) asStringWithCRs |
|
2213 | 1198 |
! |
1199 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1200 |
cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1201 |
"return the cursors col (1..). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1202 |
This is the absolute col; NOT the visible col" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1203 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1204 |
^ cursorCol |
125 | 1205 |
! |
1206 |
||
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1207 |
cursorColHolder |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1208 |
"return a valueHolder for the cursors column (1..)." |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1209 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1210 |
^ cursorColHolder |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1211 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1212 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1213 |
cursorLine |
3160 | 1214 |
"return the cursors line (1..). |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1215 |
This is the absolute line; NOT the visible line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1216 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1217 |
^ cursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1218 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1219 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1220 |
cursorLineHolder |
3160 | 1221 |
"return a valueHolder for the cursors line (1..). |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1222 |
This is the absolute line; NOT the visible line" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1223 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1224 |
^ cursorLineHolder |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1225 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1226 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1227 |
list:something |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1228 |
"position cursor home when setting contents" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1229 |
|
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1230 |
|prevCursorLine prevCursorCol| |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1231 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1232 |
prevCursorLine := cursorLine. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1233 |
prevCursorCol := cursorCol. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1234 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1235 |
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
|
1236 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1237 |
(cursorMovementWhenUpdating == #endOfText |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1238 |
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
|
1239 |
^ self cursorToEndOfText |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1240 |
]. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1241 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1242 |
(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
|
1243 |
^ self cursorLine:prevCursorLine col:(self listAt:cursorLine) size + 1. |
3160 | 1244 |
]. |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1245 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1246 |
(cursorMovementWhenUpdating == #beginOfText |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1247 |
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
|
1248 |
^ self cursorHome |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1249 |
]. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1250 |
(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
|
1251 |
^ 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
|
1252 |
]. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1253 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1254 |
"/ 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
|
1255 |
"/ self cursorLine:prevCursorLine col:prevCursorCol. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1256 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1257 |
|
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1258 |
setContents:something |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1259 |
|selType| |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1260 |
|
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
1261 |
undoSupport resetHistories. |
2955 | 1262 |
|
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1263 |
selType := typeOfSelection. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1264 |
super setContents:something. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1265 |
typeOfSelection := selType. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1266 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1267 |
"Created: / 31.3.1998 / 23:35:06 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1268 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1269 |
|
4271 | 1270 |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1271 |
!EditTextView methodsFor:'accessing-look'! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1272 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1273 |
cursorForegroundColor:color1 backgroundColor:color2 |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1274 |
"set both cursor foreground and cursor background colors" |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1275 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1276 |
|wasOn| |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1277 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1278 |
wasOn := self hideCursor. |
1993 | 1279 |
cursorFgColor := color1 onDevice:device. |
1280 |
cursorBgColor := color2 onDevice:device. |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1281 |
wasOn ifTrue:[self showCursor] |
1333 | 1282 |
! |
1283 |
||
1899 | 1284 |
cursorType |
1285 |
"return the style of the text cursor. |
|
1286 |
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret |
|
3160 | 1287 |
#bigCaret and #bigSolidCaret" |
1899 | 1288 |
|
1289 |
^ cursorType |
|
1290 |
||
1291 |
"Modified: / 5.5.1999 / 14:52:33 / cg" |
|
1292 |
! |
|
1293 |
||
1333 | 1294 |
cursorType:aCursorTypeSymbol |
1295 |
"set the style of the text cursor. |
|
1296 |
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret |
|
3160 | 1297 |
#bigCaret and #bigSolidCaret" |
1333 | 1298 |
|
1334 | 1299 |
cursorType := aCursorTypeSymbol. |
1333 | 1300 |
|
1301 |
"Created: 21.9.1997 / 13:42:23 / cg" |
|
1302 |
"Modified: 21.9.1997 / 13:43:35 / cg" |
|
1334 | 1303 |
! |
1304 |
||
1899 | 1305 |
cursorTypeNoFocus |
1306 |
"return the style of the text cursor when the view has no focus. |
|
1307 |
If left unspecified, this is the same as the regular cursorType." |
|
1308 |
||
1309 |
^ cursorTypeNoFocus |
|
1310 |
||
1311 |
"Created: / 5.5.1999 / 14:52:46 / cg" |
|
1312 |
! |
|
1313 |
||
1334 | 1314 |
cursorTypeNoFocus:aCursorTypeSymbol |
1315 |
"set the style of the text cursor when the view has no focus. |
|
1316 |
If left unspecified, this is the same as the regular cursorType." |
|
1317 |
||
1318 |
cursorTypeNoFocus := aCursorTypeSymbol |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1319 |
! ! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1320 |
|
4048 | 1321 |
!EditTextView methodsFor:'accessing-replace'! |
1322 |
||
1323 |
lastStringToReplace: aString |
|
1324 |
! ! |
|
1325 |
||
2119 | 1326 |
!EditTextView methodsFor:'change & update'! |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1327 |
|
125 | 1328 |
accept |
1329 |
"accept the current contents by executing the accept-action and/or |
|
1330 |
changeMessage." |
|
1331 |
||
1108 | 1332 |
acceptEnabled == false ifTrue:[ |
3945 | 1333 |
self beep. |
1334 |
^ self |
|
2035
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
1335 |
]. |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
1336 |
(disableIfInvisible == true and:[self reallyRealized not]) ifTrue:[ |
3945 | 1337 |
^ self |
1108 | 1338 |
]. |
1339 |
||
125 | 1340 |
lockUpdates := true. |
1013 | 1341 |
|
1342 |
"/ |
|
1343 |
"/ ST-80 way of doing it |
|
1344 |
"/ |
|
1345 |
model notNil ifTrue:[ |
|
4142 | 1346 |
self sendChangeMessage:changeMsg with:self argForChangeMessage. |
3945 | 1347 |
acceptChannel value:true withoutNotifying:self. |
2999 | 1348 |
]. |
1349 |
||
757
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1350 |
"/ |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1351 |
"/ ST/X way of doing things |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1352 |
"/ as a historic (and temporary) leftover, |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1353 |
"/ 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
|
1354 |
"/ - not with the actual string |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1355 |
"/ |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1356 |
acceptAction notNil ifTrue:[ |
3945 | 1357 |
acceptAction value:self list |
757
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1358 |
]. |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1359 |
|
125 | 1360 |
lockUpdates := false. |
757
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1361 |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1362 |
"Modified: / 30.1.1998 / 14:19:00 / cg" |
131 | 1363 |
! |
1364 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1365 |
argForChangeMessage |
597 | 1366 |
"return the argument to be passed with the change notification. |
1367 |
Defined as separate method for easier subclassability." |
|
1368 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1369 |
^ self contents |
597 | 1370 |
|
1371 |
"Modified: 29.4.1996 / 12:42:14 / cg" |
|
121 | 1372 |
! |
1373 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1374 |
getListFromModel |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1375 |
"get my contents from the model. |
597 | 1376 |
Redefined to ignore updates resulting from my own changes |
1377 |
(i.e. if lockUpdates is true)." |
|
121 | 1378 |
|
1379 |
" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1380 |
ignore updates from my own change |
121 | 1381 |
" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1382 |
lockUpdates ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1383 |
lockUpdates := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1384 |
^ self |
121 | 1385 |
]. |
2196
f8c955dd6eb9
validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents:
2186
diff
changeset
|
1386 |
super getListFromModel. |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1387 |
undoSupport resetHistories. |
2196
f8c955dd6eb9
validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents:
2186
diff
changeset
|
1388 |
|
f8c955dd6eb9
validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents:
2186
diff
changeset
|
1389 |
"/ validate the cursorLine |
3160 | 1390 |
(cursorLine notNil |
2310 | 1391 |
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
|
1392 |
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
|
1393 |
]. |
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1394 |
! |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1395 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1396 |
update:something with:aParameter from:changedObject |
1438
bed1564b0640
fixed update for acceptChannel
Claus Gittinger <cg@exept.de>
parents:
1437
diff
changeset
|
1397 |
changedObject == acceptChannel ifTrue:[ |
3160 | 1398 |
acceptChannel value == true ifTrue:[ |
1399 |
self accept. |
|
1400 |
]. |
|
1401 |
^ self. |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1402 |
]. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1403 |
super update:something with:aParameter from:changedObject |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1404 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1405 |
"Created: / 30.1.1998 / 14:15:56 / cg" |
1439
d1b3ca91ed8a
fixed update for acceptChannel
Claus Gittinger <cg@exept.de>
parents:
1438
diff
changeset
|
1406 |
"Modified: / 1.2.1998 / 13:15:55 / cg" |
121 | 1407 |
! ! |
1408 |
||
1409 |
!EditTextView methodsFor:'cursor handling'! |
|
1410 |
||
2406 | 1411 |
characterPositionOfCursor |
1412 |
^ self characterPositionOfLine:cursorLine col:cursorCol |
|
1413 |
! |
|
1414 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1415 |
cursorBacktab |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1416 |
"move cursor to prev tabstop" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1417 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1418 |
self cursorCol:(self prevTabBefore:cursorCol). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1419 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1420 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1421 |
cursorCol:newCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1422 |
"move cursor to some column in the current line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1423 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1424 |
|wasOn| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1425 |
|
2822 | 1426 |
(cursorCol == newCol) ifTrue:[^ self]. |
1427 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1428 |
wasOn := self hideCursor. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1429 |
self setValidatedCursorCol:newCol. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1430 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1431 |
|
1432 |
"Modified: 22.5.1996 / 14:25:53 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1433 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1434 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1435 |
cursorDown |
632
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1436 |
"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
|
1437 |
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
|
1438 |
|
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1439 |
|wasOn| |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1440 |
|
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1441 |
self cursorDown:1. |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1442 |
|
2707 | 1443 |
"/ cursor beyond text ? |
632
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1444 |
cursorLine > list size ifTrue:[ |
3160 | 1445 |
wasOn := self hideCursor. |
1446 |
self setValidatedCursorLine:(list size + 1) col:cursorCol. |
|
1447 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
1448 |
self beep. |
|
632
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1449 |
]. |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1450 |
|
1561
db5f27354172
make cursor correctly visible if in partial last line.
Claus Gittinger <cg@exept.de>
parents:
1560
diff
changeset
|
1451 |
"Modified: / 10.6.1998 / 17:00:23 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1452 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1453 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1454 |
cursorDown:n |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1455 |
"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
|
1456 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1457 |
|wasOn nv nL| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1458 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1459 |
cursorVisibleLine notNil ifTrue:[ |
3160 | 1460 |
wasOn := self hideCursor. |
1461 |
nv := cursorVisibleLine + n - 1. |
|
1462 |
(nv >= nFullLinesShown) ifTrue:[ |
|
1463 |
self scrollDown:(nv - nFullLinesShown + 1) |
|
1464 |
]. |
|
1465 |
self setValidatedCursorLine:(cursorLine + n) col:cursorCol. |
|
1466 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1467 |
] ifFalse:[ |
3160 | 1468 |
(nL := cursorLine) isNil ifTrue:[ |
1469 |
nL := firstLineShown |
|
1470 |
]. |
|
1471 |
self setValidatedCursorLine:(nL + n) col:cursorCol. |
|
1472 |
self makeCursorVisible. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1473 |
]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
1474 |
|
1561
db5f27354172
make cursor correctly visible if in partial last line.
Claus Gittinger <cg@exept.de>
parents:
1560
diff
changeset
|
1475 |
"Modified: / 10.6.1998 / 16:59:17 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1476 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1477 |
|
121 | 1478 |
cursorHome |
597 | 1479 |
"scroll to top AND move cursor to first line of text." |
121 | 1480 |
|
674 | 1481 |
self cursorLine:1 col:1 |
1482 |
||
1483 |
"/ |wasOn| |
|
1484 |
"/ |
|
1485 |
"/ wasOn := self hideCursor. |
|
1486 |
"/ self scrollToTop. |
|
1487 |
"/ cursorLine := cursorVisibleLine := 1. |
|
1488 |
"/ cursorCol := self validateCursorCol:1 inLine:cursorLine. |
|
1489 |
"/ self makeCursorVisibleAndShowCursor:wasOn. |
|
1490 |
||
1491 |
"Modified: 22.5.1996 / 18:26:42 / cg" |
|
121 | 1492 |
! |
1493 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1494 |
cursorLeft |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1495 |
"move cursor to left" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1496 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1497 |
(cursorCol ~~ 1) ifTrue:[ |
3160 | 1498 |
self cursorCol:(cursorCol - 1) |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1499 |
] ifFalse:[ |
3160 | 1500 |
cursorLine ~~ 1 ifTrue:[ |
1501 |
self st80EditMode ifTrue:[ |
|
1502 |
self cursorUp. |
|
1503 |
self cursorToEndOfLine. |
|
1504 |
] |
|
1505 |
] |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1506 |
] |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1507 |
|
1426
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1508 |
"Modified: / 23.1.1998 / 12:37:13 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1509 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1510 |
|
4126 | 1511 |
cursorLeft:n |
1512 |
"move cursor to left" |
|
1513 |
||
1514 |
n timesRepeat:[ |
|
1515 |
self cursorLeft |
|
1516 |
]. |
|
1517 |
! |
|
1518 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1519 |
cursorLine:line col:col |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1520 |
"this positions onto physical - not visible - line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1521 |
|
676 | 1522 |
|wasOn newCol| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1523 |
|
2822 | 1524 |
((line == cursorLine) and:[col == cursorCol]) ifTrue:[^ self]. |
1525 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1526 |
wasOn := self hideCursor. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1527 |
self setValidatedCursorLine:line. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1528 |
|
672 | 1529 |
(col < 1) ifTrue:[ |
3160 | 1530 |
newCol := 1 |
672 | 1531 |
] ifFalse:[ |
3160 | 1532 |
newCol := col. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1533 |
]. |
2647
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
1534 |
self st80EditMode ifTrue:[ |
3160 | 1535 |
(cursorLine == list size |
1536 |
and:[cursorLine ~~ line]) ifTrue:[ |
|
1537 |
newCol := (self listAt:(list size)) size + 1. |
|
1538 |
] |
|
1419 | 1539 |
]. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1540 |
self setValidatedCursorCol:newCol. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1541 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1542 |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1543 |
"Modified: / 20.6.1998 / 18:19:06 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1544 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1545 |
|
1580
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1546 |
cursorMovementAllowed |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1547 |
"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
|
1548 |
(via button-click, or cursor-key with selection). |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1549 |
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
|
1550 |
in special subclasses (such as a terminal view), where |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1551 |
this is not wanted" |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1552 |
|
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1553 |
^ true |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1554 |
|
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1555 |
"Created: / 18.6.1998 / 14:11:16 / cg" |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1556 |
! |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1557 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1558 |
cursorReturn |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1559 |
"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
|
1560 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1561 |
|wasOn| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1562 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1563 |
self checkForExistingLine:(cursorLine + 1). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1564 |
cursorVisibleLine notNil ifTrue:[ |
3160 | 1565 |
nFullLinesShown notNil ifTrue:[ |
1566 |
(cursorVisibleLine >= nFullLinesShown) ifTrue:[self scrollDown] |
|
1567 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1568 |
]. |
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 |
wasOn := self hideCursor. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1571 |
self setValidatedCursorLine:(cursorLine + 1) col:1. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1572 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1573 |
|
674 | 1574 |
"Modified: 22.5.1996 / 18:27:34 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1575 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1576 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1577 |
cursorRight |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1578 |
"move cursor to right" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1579 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1580 |
|l| |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1581 |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
1582 |
self st80EditMode ifTrue:[ |
3160 | 1583 |
l := (self listAt:cursorLine). |
1584 |
cursorCol >= (l size + 1) ifTrue:[ |
|
1585 |
cursorLine < list size ifTrue:[ |
|
1586 |
self cursorReturn. |
|
1587 |
]. |
|
1588 |
^ self |
|
1589 |
] |
|
1590 |
]. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1591 |
self cursorCol:(cursorCol + 1) |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1592 |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1593 |
"Modified: / 20.6.1998 / 18:19:07 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1594 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1595 |
|
4126 | 1596 |
cursorRight:n |
1597 |
"move cursor to right" |
|
1598 |
||
1599 |
n timesRepeat:[ |
|
1600 |
self cursorRight |
|
1601 |
]. |
|
1602 |
! |
|
1603 |
||
1833 | 1604 |
cursorShown:aBoolean |
1605 |
"change cursor visibility |
|
1606 |
return true if cursor was visible before." |
|
1607 |
||
1608 |
|oldState| |
|
1609 |
||
1610 |
oldState := cursorShown. |
|
1611 |
||
1612 |
aBoolean ifTrue:[ |
|
3160 | 1613 |
self drawCursor. |
1833 | 1614 |
] ifFalse:[ |
3160 | 1615 |
(cursorShown and:[shown]) ifTrue: [ |
1616 |
self undrawCursor. |
|
1617 |
]. |
|
1833 | 1618 |
]. |
1619 |
cursorShown := aBoolean. |
|
1620 |
||
1621 |
^ oldState |
|
1622 |
||
1623 |
"Modified: / 30.3.1999 / 15:32:43 / stefan" |
|
1624 |
"Created: / 30.3.1999 / 15:59:30 / stefan" |
|
1625 |
! |
|
1626 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1627 |
cursorTab |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1628 |
"move cursor to next tabstop" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1629 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1630 |
self cursorCol:(self nextTabAfter:cursorCol). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1631 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1632 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1633 |
cursorToBeginOfLine |
3020
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1634 |
"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
|
1635 |
|
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1636 |
|textStart l| |
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1637 |
|
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1638 |
l := self listAt:cursorLine. |
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1639 |
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
|
1640 |
cursorCol > textStart ifTrue:[ |
3160 | 1641 |
self cursorCol:textStart |
3020
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1642 |
] ifFalse:[ |
3160 | 1643 |
self cursorCol:1 |
3020
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1644 |
] |
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1645 |
|
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1646 |
"Created: / 8.8.2004 / 18:51:21 / janfrog" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1647 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1648 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1649 |
cursorToBottom |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1650 |
"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
|
1651 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1652 |
|wasOn newTop| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1653 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1654 |
wasOn := self hideCursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1655 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1656 |
newTop := list size - nFullLinesShown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1657 |
(newTop < 1) ifTrue:[ |
3160 | 1658 |
newTop := 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1659 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1660 |
self scrollToLine:newTop. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1661 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1662 |
self setValidatedCursorLine:(list size) col:1. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1663 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1664 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1665 |
|
674 | 1666 |
"Modified: 22.5.1996 / 18:27:45 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1667 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1668 |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1669 |
cursorToCharacterPosition:pos |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1670 |
"compute line/col from character position (1..) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1671 |
and move the cursor onto that char" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1672 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1673 |
|line col| |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1674 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1675 |
line := self lineOfCharacterPosition:pos. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1676 |
col := pos - (self characterPositionOfLine:line col:1) + 1. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1677 |
self cursorLine:line col:col |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1678 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1679 |
"Created: / 15.1.1998 / 21:55:33 / cg" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1680 |
! |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1681 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1682 |
cursorToEnd |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1683 |
"move cursor down below last line of text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1684 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1685 |
|wasOn newTop lineNr line| |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1686 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1687 |
lineNr := list size. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1688 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1689 |
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
|
1690 |
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
|
1691 |
(line isEmptyOrNil) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1692 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1693 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1694 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1695 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1696 |
wasOn := self hideCursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1697 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1698 |
lineNr := lineNr + 1. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1699 |
newTop := lineNr - nFullLinesShown. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1700 |
(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
|
1701 |
newTop := 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1702 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1703 |
self scrollToLine:newTop. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1704 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1705 |
self setValidatedCursorLine:lineNr col:1. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1706 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1707 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1708 |
|
674 | 1709 |
"Modified: 22.5.1996 / 18:27:53 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1710 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1711 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1712 |
cursorToEndOfLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1713 |
"move cursor to end of current line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1714 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1715 |
|line| |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1716 |
|
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1717 |
line := (self listAt:cursorLine). |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1718 |
self cursorCol:(line size + 1) |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1719 |
|
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1720 |
"Modified: 13.8.1997 / 15:34:02 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1721 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1722 |
|
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1723 |
cursorToEndOfText |
4288 | 1724 |
"move cursor to the end of the text (behind the last character in last line)" |
1725 |
||
1726 |
|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
|
1727 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1728 |
wasOn := self hideCursor. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1729 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1730 |
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
|
1731 |
(newTop < 1) ifTrue:[ |
4288 | 1732 |
newTop := 1 |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1733 |
]. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1734 |
self scrollToLine:newTop. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1735 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1736 |
self setValidatedCursorLine:list size. |
4288 | 1737 |
lastLineLength := (self listAt:cursorLine) size. |
1738 |
pos := (lastLineLength==0) ifTrue:[0] ifFalse:[lastLineLength+1]. |
|
1739 |
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
|
1740 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1741 |
self makeCursorVisibleAndShowCursor:wasOn. |
4288 | 1742 |
|
4289
d74f746d4c0d
comment/format in: #cursorToEndOfText
Claus Gittinger <cg@exept.de>
parents:
4288
diff
changeset
|
1743 |
"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
|
1744 |
! |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1745 |
|
3310 | 1746 |
cursorToEndOfWord |
1747 |
"move the cursor to the end of the word" |
|
1748 |
||
1749 |
(cursorLine > list size) ifTrue:[^ self]. |
|
1750 |
||
1751 |
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
|
1752 |
: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
|
1753 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1754 |
self cursorLine:endLine col:endCol+1 |
3310 | 1755 |
] |
1756 |
||
1757 |
"Created: / 28-06-2006 / 19:16:30 / cg" |
|
1758 |
! |
|
1759 |
||
131 | 1760 |
cursorToFirstVisibleLine |
1761 |
"place cursor into the first visible line; do not scroll." |
|
1762 |
||
1763 |
self cursorLine:(self visibleLineToAbsoluteLine:1) col:1 |
|
1764 |
! |
|
1765 |
||
1766 |
cursorToLastVisibleLine |
|
1767 |
"place cursor into the first visible line; do not scroll." |
|
1768 |
||
1769 |
self cursorLine:(self visibleLineToAbsoluteLine:nFullLinesShown) col:1 |
|
1770 |
! |
|
1771 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1772 |
cursorToNextWord |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1773 |
"move the cursor to the beginning of the next word" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1774 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1775 |
|col line searching| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1776 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1777 |
(cursorLine > list size) ifTrue:[^ self]. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1778 |
|
3890 | 1779 |
self |
1780 |
wordAtLine:cursorLine col:cursorCol do:[ |
|
1781 |
:beginLine :beginCol :endLine :endCol :style | |
|
1782 |
||
1783 |
line := endLine. |
|
1784 |
col := endCol + 1. |
|
1785 |
searching := true. |
|
1786 |
[searching |
|
1787 |
and:[(self characterAtLine:line col:col) isSeparator]] whileTrue:[ |
|
1788 |
self wordAtLine:line col:col do:[ |
|
1789 |
:beginLine :beginCol :endLine :endCol :style | |
|
1790 |
||
1791 |
(line > list size) ifTrue:[ |
|
1792 |
"break out" |
|
1793 |
searching := false |
|
1794 |
] ifFalse:[ |
|
1795 |
line := endLine. |
|
1796 |
col := endCol + 1. |
|
1797 |
] |
|
1798 |
] |
|
1799 |
]. |
|
1800 |
self cursorLine:line col:col |
|
1801 |
] |
|
121 | 1802 |
! |
1803 |
||
499 | 1804 |
cursorToPreviousWord |
1805 |
"move the cursor to the beginning of this or the previous word" |
|
1806 |
||
1807 |
|col line searching l| |
|
1808 |
||
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1809 |
(cursorLine > list size) ifTrue:[^ self]. "/ this is rubbish |
499 | 1810 |
|
1811 |
self wordAtLine:cursorLine col:cursorCol do:[ |
|
3160 | 1812 |
:beginLine :beginCol :endLine :endCol :style | |
1813 |
||
1814 |
line := beginLine. |
|
1815 |
col := beginCol. |
|
1816 |
style == #wordLeft ifTrue:[ |
|
1817 |
col := col + 1 |
|
1818 |
]. |
|
1819 |
||
1820 |
(cursorLine == line |
|
1821 |
and:[cursorCol == col]) ifTrue:[ |
|
1822 |
searching := true. |
|
1823 |
||
1824 |
col > 1 ifTrue:[ |
|
1825 |
col := col - 1. |
|
1826 |
]. |
|
1827 |
||
1828 |
[searching] whileTrue:[ |
|
1829 |
(col == 1) ifTrue:[ |
|
1830 |
line == 1 ifTrue:[ |
|
1831 |
searching := false |
|
1832 |
] ifFalse:[ |
|
1833 |
line := line - 1. |
|
1834 |
l := list at:line. |
|
1835 |
col := l size + 1. |
|
1836 |
] |
|
1837 |
] ifFalse:[ |
|
1838 |
(self characterAtLine:line col:col) isSeparator ifFalse:[ |
|
1839 |
self wordAtLine:line col:col do:[ |
|
1840 |
:beginLine :beginCol :endLine :endCol :style | |
|
1841 |
||
1842 |
line := beginLine. |
|
1843 |
col := beginCol. |
|
1844 |
style == #wordLeft ifTrue:[ |
|
1845 |
col := col + 1 |
|
1846 |
]. |
|
1847 |
searching := false. |
|
1848 |
] |
|
1849 |
] ifTrue:[ |
|
1850 |
col := col - 1 |
|
1851 |
] |
|
1852 |
] |
|
1853 |
] |
|
1854 |
]. |
|
1855 |
self cursorLine:line col:col |
|
499 | 1856 |
] |
1857 |
||
1858 |
"Created: 8.3.1996 / 21:52:48 / cg" |
|
1859 |
"Modified: 8.3.1996 / 22:12:45 / cg" |
|
1860 |
! |
|
1861 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1862 |
cursorToTop |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1863 |
"move cursor to absolute home" |
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 |
self cursorLine:1 col:1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1866 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1867 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1868 |
cursorUp |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1869 |
"move cursor up; scroll if at start of visible text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1870 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1871 |
self cursorUp:1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1872 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1873 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1874 |
cursorUp:n |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1875 |
"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
|
1876 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1877 |
|wasOn nv nl| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1878 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1879 |
cursorLine isNil ifTrue:[ |
3725
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1880 |
self setCursorLine:(firstLineShown + nFullLinesShown - 1). |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1881 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1882 |
nl := cursorLine - n. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1883 |
nl < 1 ifTrue:[nl := 1]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1884 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1885 |
(nl ~~ cursorLine) ifTrue: [ |
3725
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1886 |
wasOn := self hideCursor. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1887 |
cursorVisibleLine notNil ifTrue:[ |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1888 |
nv := cursorVisibleLine - n. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1889 |
nv < 1 ifTrue:[ |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1890 |
self scrollUp:(nv negated + 1) |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1891 |
]. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1892 |
]. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1893 |
self setValidatedCursorLine:nl col:cursorCol. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1894 |
"/ wasOn ifTrue:[self showCursor]. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1895 |
self makeCursorVisibleAndShowCursor:wasOn. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1896 |
] |
672 | 1897 |
|
674 | 1898 |
"Modified: 22.5.1996 / 18:28:11 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1899 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1900 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1901 |
cursorVisibleLine:visibleLineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1902 |
"put cursor to visibleline/col" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1903 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1904 |
|wasOn newCol listLine| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1905 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1906 |
wasOn := self hideCursor. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1907 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1908 |
listLine := self visibleLineToAbsoluteLine:visibleLineNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1909 |
self setValidatedCursorLine:listLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1910 |
cursorVisibleLine := visibleLineNr. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1911 |
|
676 | 1912 |
newCol := colNr. |
1913 |
(newCol < 1) ifTrue:[ |
|
3160 | 1914 |
newCol := 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1915 |
]. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1916 |
self setValidatedCursorCol:newCol. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1917 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1918 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1919 |
|
1597
5fdcfcedb91c
fixed cursor positioning after replaceStringAtCursor.
Claus Gittinger <cg@exept.de>
parents:
1596
diff
changeset
|
1920 |
"Modified: / 20.6.1998 / 18:40:28 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1921 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1922 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1923 |
cursorX:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1924 |
"put cursor to position next to x/y coordinate in view" |
121 | 1925 |
|
1926 |
|line col| |
|
1927 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1928 |
line := self visibleLineOfY:y. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1929 |
col := self colOfX:x inVisibleLine:line. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1930 |
self cursorVisibleLine:line col:col. |
121 | 1931 |
! |
1932 |
||
1933 |
drawCursor |
|
1934 |
"draw the cursor if shown and cursor is visible. |
|
1935 |
(but not, if there is a selection - to avoid confusion)" |
|
1936 |
||
1937 |
shown ifTrue:[ |
|
3160 | 1938 |
cursorVisibleLine notNil ifTrue:[ |
1939 |
self hasSelection ifFalse:[ |
|
1940 |
self drawCursorCharacter |
|
1941 |
] |
|
1942 |
] |
|
121 | 1943 |
] |
1944 |
! |
|
1945 |
||
1946 |
drawCursor:cursorType with:fgColor and:bgColor |
|
1947 |
"draw a cursor; the argument cursorType specifies what type |
|
125 | 1948 |
of cursor should be drawn. |
728
3ef81000ee8c
new cursorTypes: #bigCaret and #bigSolidCaret
Claus Gittinger <cg@exept.de>
parents:
698
diff
changeset
|
1949 |
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret |
3160 | 1950 |
#bigCaret and #bigSolidCaret" |
2085
4498b1a50d72
fixed undrawCursor, when there is italic text
Claus Gittinger <cg@exept.de>
parents:
2072
diff
changeset
|
1951 |
|
2570 | 1952 |
|x y w char y2 x1 x2 oldPaint oldClip| |
121 | 1953 |
|
1954 |
self hasSelection ifTrue:[ |
|
3160 | 1955 |
" |
1956 |
hide cursor, if there is a selection |
|
1957 |
" |
|
1958 |
^ super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
|
121 | 1959 |
]. |
1960 |
||
1334 | 1961 |
cursorType == #none ifTrue:[ |
3160 | 1962 |
^ self |
1334 | 1963 |
]. |
1964 |
||
121 | 1965 |
cursorType == #block ifTrue:[ |
3160 | 1966 |
super drawVisibleLine:cursorVisibleLine |
1967 |
col:cursorCol |
|
1968 |
with:fgColor |
|
1969 |
and:bgColor. |
|
1970 |
^ self |
|
121 | 1971 |
]. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
1972 |
x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x. |
121 | 1973 |
y := self yOfVisibleLine:cursorVisibleLine. |
1974 |
||
1449
2a54bdfff203
eliminated direct refs to paint instvar
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
1975 |
oldPaint := self paint. "/ do not clobber GC |
121 | 1976 |
cursorType == #frame ifTrue:[ |
3160 | 1977 |
super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
1978 |
||
1979 |
char := self characterUnderCursor asString. |
|
1980 |
self paint:bgColor. |
|
1981 |
self displayRectangleX:x y:y |
|
1982 |
width:(font widthOf:char) height:fontHeight. |
|
133 | 1983 |
] ifFalse:[ |
3160 | 1984 |
self paint:bgColor. |
1985 |
cursorType == #ibeam ifTrue:[ |
|
1986 |
x1 := x - 1. |
|
1987 |
y2 := y + fontHeight - 1. |
|
1988 |
self displayLineFromX:x1 y:y toX:x1 y:y2. |
|
1989 |
self displayLineFromX:x y:y toX:x y:y2. |
|
1990 |
^ self |
|
1991 |
]. |
|
1992 |
||
1993 |
cursorType == #Ibeam ifTrue:[ |
|
1994 |
x1 := x - 1. |
|
1995 |
y := y + 1. |
|
1996 |
y2 := y + fontHeight - 1. |
|
1997 |
self displayLineFromX:x1 y:y toX:x1 y:y2. |
|
1998 |
self displayLineFromX:x y:y toX:x y:y2. |
|
1999 |
self displayLineFromX:x1-2 y:y toX:x+2 y:y. |
|
2000 |
self displayLineFromX:x1-2 y:y2 toX:x+2 y:y2. |
|
2001 |
^ self |
|
2002 |
]. |
|
2003 |
||
2004 |
y := y + fontHeight - 3. |
|
2005 |
((cursorType == #bigCaret) or:[cursorType == #bigSolidCaret]) ifTrue:[ |
|
2006 |
w := (fontWidth * 2 // 3) max:4. |
|
2007 |
y2 := y + w + (w//2). |
|
2008 |
] ifFalse:[ |
|
2009 |
w := (fontWidth // 2) max:4. |
|
2010 |
y2 := y + w. |
|
2011 |
]. |
|
2012 |
x1 := x - w. |
|
2013 |
x2 := x + w. |
|
2014 |
||
2015 |
oldClip := self clippingRectangleOrNil. |
|
2016 |
self clippingRectangle:(margin@margin extent:(width-margin) @ (height-margin)). |
|
2017 |
||
2018 |
cursorType == #caret ifTrue:[ |
|
2019 |
self lineWidth:2. |
|
2020 |
self displayLineFromX:x1 y:y2 toX:x y:y. |
|
2021 |
self displayLineFromX:x y:y toX:x2 y:y2. |
|
2022 |
] ifFalse:[ |
|
2023 |
"anything else: solidCaret" |
|
2024 |
||
2025 |
self fillPolygon:(Array with:(x1 @ y2) |
|
2026 |
with:(x @ y) |
|
2027 |
with:(x2 @ y2)) |
|
2028 |
]. |
|
2029 |
||
2030 |
self clippingRectangle:oldClip |
|
121 | 2031 |
]. |
133 | 2032 |
self paint:oldPaint. |
662
4bcdf0cce3a7
dont let caret cursor become too small (with small fonts)
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
2033 |
|
2088 | 2034 |
"Modified: / 15.12.1999 / 22:24:17 / cg" |
121 | 2035 |
! |
2036 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2037 |
drawCursorCharacter |
3160 | 2038 |
"draw the cursor. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2039 |
(i.e. the cursor if no selection) |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2040 |
- helper for many cursor methods" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2041 |
|
3160 | 2042 |
(hasKeyboardFocus |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
2043 |
and:[self enabled |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
2044 |
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
|
2045 |
self drawFocusCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2046 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
2047 |
self drawNoFocusCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2048 |
] |
1817
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
2049 |
|
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
2050 |
"Modified: / 23.3.1999 / 13:52:48 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2051 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2052 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2053 |
drawFocusCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2054 |
"draw the cursor when the focus is in the view." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2055 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2056 |
self hasSelection ifTrue:[ |
3160 | 2057 |
^ super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
1334 | 2058 |
]. |
2059 |
cursorType == #none ifTrue:[ |
|
3160 | 2060 |
^ self undrawCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2061 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2062 |
self drawCursor:cursorType with:cursorFgColor and:cursorBgColor. |
1334 | 2063 |
|
2064 |
"Modified: 22.9.1997 / 00:16:38 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2065 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2066 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2067 |
drawNoFocusCursor |
3160 | 2068 |
"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
|
2069 |
|
1334 | 2070 |
|cType| |
2071 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2072 |
self hasSelection ifTrue:[ |
3160 | 2073 |
^ super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
121 | 2074 |
]. |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
2075 |
|
1334 | 2076 |
cType := cursorTypeNoFocus ? cursorType. |
2077 |
cType == #none ifTrue:[ |
|
3160 | 2078 |
^ self undrawCursor |
1334 | 2079 |
]. |
2080 |
||
2081 |
cType == #block ifTrue:[ |
|
3160 | 2082 |
^ self drawCursor:#frame with:cursorNoFocusFgColor and:cursorBgColor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2083 |
]. |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
2084 |
|
1334 | 2085 |
^ self drawCursor:cType with:cursorNoFocusFgColor and:cursorNoFocusFgColor. |
2086 |
||
2087 |
"Modified: 22.9.1997 / 00:16:13 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2088 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2089 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2090 |
gotoLine:aLineNumber |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2091 |
"position cursor onto line, aLineNumber. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2092 |
Make certain that this line is visible" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2093 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2094 |
self makeLineVisible:aLineNumber. |
2951 | 2095 |
self unselect. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2096 |
self cursorLine:aLineNumber col:1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2097 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2098 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2099 |
hideCursor |
1833 | 2100 |
"make cursor invisible if currently invisible" |
2101 |
||
2102 |
^ self cursorShown:false |
|
2103 |
||
2104 |
"Modified: / 30.3.1999 / 16:02:28 / stefan" |
|
121 | 2105 |
! |
2106 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2107 |
makeCursorVisible |
3160 | 2108 |
"scroll text to make cursorline visible |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2109 |
(i.e. to have cursorLine in visible area)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2110 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2111 |
|line col| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2112 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2113 |
cursorLine notNil ifTrue:[ |
3160 | 2114 |
line := cursorLine. |
2115 |
col := cursorCol. |
|
2116 |
" |
|
2117 |
if there is a selection, its better to |
|
2118 |
have its start being visible, instead of the end |
|
2119 |
" |
|
2120 |
(selectionStartLine notNil |
|
2121 |
and:[selectionEndLine notNil]) ifTrue:[ |
|
2122 |
expandingTop ~~ false ifTrue:[ |
|
2123 |
line := selectionStartLine. |
|
2124 |
col := selectionStartCol. |
|
2125 |
] ifFalse:[ |
|
2126 |
line := selectionEndLine. |
|
2127 |
col := selectionEndCol |
|
2128 |
] |
|
2129 |
]. |
|
2130 |
self makeLineVisible:line. |
|
2131 |
self makeColVisible:col inLine:line |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2132 |
] |
479
fae6d1251888
fixed Shift-Cursor selection & show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
2133 |
|
fae6d1251888
fixed Shift-Cursor selection & show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
2134 |
"Modified: 6.3.1996 / 13:46:46 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2135 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2136 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2137 |
makeCursorVisibleAndShowCursor:flag |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2138 |
"scroll to make cursorLine visible; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2139 |
if flag is true, draw the cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2140 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2141 |
self makeCursorVisible. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2142 |
flag ifTrue:[self showCursor] |
121 | 2143 |
! |
2144 |
||
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2145 |
setCursorCol:colNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2146 |
"strictly private: set the cursorCol" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2147 |
|
2815 | 2148 |
cursorCol := (colNr max:1). |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2149 |
cursorColHolder value:cursorCol. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2150 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2151 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2152 |
setCursorLine:lineNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2153 |
"strictly private: set the cursorLine" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2154 |
|
3303 | 2155 |
"/ self assert:(lineNr notNil). |
2156 |
||
2157 |
cursorLine := (lineNr ? 1). |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2158 |
cursorLineHolder value:cursorLine. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2159 |
self updateCursorVisibleLine. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2160 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2161 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2162 |
setCursorLine:lineNr col:colNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2163 |
"strictly private: set the cursorLine, col and update the visibleLine" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2164 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2165 |
self setCursorLine:lineNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2166 |
self setCursorCol:colNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2167 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2168 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2169 |
setValidatedCursorCol:colNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2170 |
"strictly private: set the cursorCol" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2171 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2172 |
self setCursorCol:(self validateCursorCol:colNr inLine:cursorLine). |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2173 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2174 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2175 |
setValidatedCursorLine:lineNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2176 |
"strictly private: set the cursorLine and update the visibleLine" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2177 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2178 |
self setCursorLine:(self validateCursorLine:lineNr). |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2179 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2180 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2181 |
setValidatedCursorLine:lineNr col:colNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2182 |
"strictly private: set the cursorLine, col and update the visibleLine" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2183 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2184 |
self setValidatedCursorLine:lineNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2185 |
self setValidatedCursorCol:colNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2186 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2187 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2188 |
showCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2189 |
"make cursor visible if currently invisible" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2190 |
|
1833 | 2191 |
^ self cursorShown:true |
2192 |
||
2193 |
"Modified: / 30.3.1999 / 16:02:34 / stefan" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2194 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2195 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2196 |
undrawCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2197 |
"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
|
2198 |
|
2085
4498b1a50d72
fixed undrawCursor, when there is italic text
Claus Gittinger <cg@exept.de>
parents:
2072
diff
changeset
|
2199 |
|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
|
2200 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2201 |
cursorVisibleLine notNil ifTrue:[ |
3160 | 2202 |
prevCol := cursorCol - 1. |
2203 |
||
2204 |
"/ if there is any italic stuff in the cursor line, |
|
2205 |
"/ redraw it completely (because characters overlap). |
|
2206 |
cursorCol > 1 ifTrue:[ |
|
2207 |
(line := self listAt:cursorLine) notNil ifTrue:[ |
|
2208 |
line hasChangeOfEmphasis ifTrue:[ |
|
2209 |
line size >= (cursorCol-1) ifTrue:[ |
|
2210 |
e1 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol-1). |
|
2211 |
line size >= (cursorCol) ifTrue:[ |
|
2212 |
e2 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol). |
|
2213 |
line size >= (cursorCol+1) ifTrue:[ |
|
2214 |
e3 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol+1) |
|
2215 |
]. |
|
2216 |
]. |
|
2217 |
]. |
|
2218 |
(e1 notNil or:[e2 notNil or:[e3 notNil]]) ifTrue:[ |
|
2219 |
^ super redrawVisibleLine:cursorVisibleLine |
|
2220 |
] |
|
2221 |
] |
|
2222 |
] |
|
2223 |
]. |
|
2224 |
||
2225 |
((cursorType == #caret) |
|
2226 |
or:[cursorType == #solidCaret |
|
2227 |
or:[cursorType == #bigSolidCaret |
|
2228 |
or:[cursorType == #bigCaret |
|
2229 |
or:[cursorType == #Ibeam]]]]) ifTrue:[ |
|
2230 |
"caret-cursor touches 4 characters" |
|
2231 |
((cursorCol > 1) and:[fontIsFixedWidth]) ifTrue:[ |
|
2232 |
super redrawVisibleLine:cursorVisibleLine-1 from:prevCol to:cursorCol. |
|
2233 |
super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol. |
|
2234 |
super redrawVisibleLine:cursorVisibleLine+1 from:prevCol to:cursorCol. |
|
2235 |
] ifFalse:[ |
|
2236 |
"care for left margin" |
|
2237 |
super redrawVisibleLine:cursorVisibleLine; redrawVisibleLine:cursorVisibleLine+1. |
|
2238 |
]. |
|
2239 |
^ self |
|
2240 |
]. |
|
2241 |
||
2242 |
cursorType == #ibeam ifTrue:[ |
|
2243 |
"ibeam-cursor touches 2 characters" |
|
2244 |
cursorCol > 1 ifTrue:[ |
|
2245 |
super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol. |
|
2246 |
] ifFalse:[ |
|
2247 |
"care for left margin" |
|
2248 |
super redrawVisibleLine:cursorVisibleLine. |
|
2249 |
]. |
|
2250 |
^ self |
|
2251 |
]. |
|
2252 |
||
2253 |
"block cursor is simple - just one character under cursor" |
|
2254 |
||
2255 |
"/ however, if italic characters are involved, we must care |
|
2256 |
"/ for the chars before/after the cursor. |
|
2257 |
"/ We redraw the part of the previous character which got |
|
2258 |
"/ detroyed by the block cursor. |
|
2259 |
"/ (must change the clip, to avoid destroying the prev-prev character) |
|
2260 |
||
2261 |
line := self visibleAt:cursorVisibleLine. |
|
2262 |
(line notNil and:[line isText]) ifTrue:[ |
|
2263 |
cursorCol > 1 ifTrue:[ |
|
2264 |
oldClip := self clippingRectangleOrNil. |
|
2265 |
x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x. |
|
2266 |
y := self yOfVisibleLine:cursorVisibleLine. |
|
2267 |
self clippingRectangle:(x@y extent:((font width * 2) @ fontHeight)). |
|
2268 |
super redrawVisibleLine:cursorVisibleLine from:cursorCol-1 to:cursorCol. |
|
2269 |
self clippingRectangle:oldClip. |
|
2270 |
^ self. |
|
2271 |
]. |
|
2272 |
]. |
|
2273 |
super redrawVisibleLine:cursorVisibleLine col:cursorCol |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2274 |
] |
728
3ef81000ee8c
new cursorTypes: #bigCaret and #bigSolidCaret
Claus Gittinger <cg@exept.de>
parents:
698
diff
changeset
|
2275 |
|
2088 | 2276 |
"Modified: / 15.12.1999 / 22:25:59 / cg" |
121 | 2277 |
! |
2278 |
||
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2279 |
updateCursorVisibleLine |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2280 |
"strictly private: set the visibleLine from the cursorLine. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2281 |
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
|
2282 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2283 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2284 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2285 |
|
672 | 2286 |
validateCursorCol:col inLine:line |
674 | 2287 |
"check of col is a valid cursor position; return a new col-nr if not. |
3160 | 2288 |
Here, no limits are enforced (and col is returned), |
2289 |
but it may be redefined in EditFields or views which dont like the |
|
674 | 2290 |
cursor to be positioned behind the end of a textLine (vi/st-80 behavior)" |
672 | 2291 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
2292 |
|l max| |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
2293 |
|
1419 | 2294 |
"/ in ST80 mode, |
2707 | 2295 |
"/ the cursor may not be positioned beyond the |
2296 |
"/ end of a line or beyond the last line of the text |
|
3160 | 2297 |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2298 |
self st80EditMode ifTrue:[ |
3160 | 2299 |
l := (self listAt:line). |
2300 |
max := l size + 1. |
|
2301 |
col > max ifTrue:[ |
|
2302 |
^ max |
|
2303 |
] |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
2304 |
]. |
672 | 2305 |
^ col |
2306 |
||
1419 | 2307 |
"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
|
2308 |
"Modified: / 20.6.1998 / 18:19:24 / cg" |
674 | 2309 |
! |
2310 |
||
2311 |
validateCursorLine:line |
|
2312 |
"check of line is a valid cursor line; return a fixed line-nr if not. |
|
3160 | 2313 |
Here, no limits are enforced (and line is returned), but it may be |
674 | 2314 |
redefined in views which dont like the cursor to be positioned |
2315 |
behind the end of the text (vi/st-80 behavior), or want to |
|
2316 |
skip reserved regions" |
|
2317 |
||
1419 | 2318 |
"/ |
2319 |
"/ in st80Mode, the cursor may not be positioned |
|
2707 | 2320 |
"/ beyond the last line |
1419 | 2321 |
"/ |
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2322 |
self st80EditMode ifTrue:[ |
3160 | 2323 |
^ (line min:(list size)) max:1 |
1419 | 2324 |
]. |
674 | 2325 |
^ line |
2326 |
||
1419 | 2327 |
"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
|
2328 |
"Modified: / 20.6.1998 / 18:19:26 / cg" |
672 | 2329 |
! |
2330 |
||
121 | 2331 |
withCursorOffDo:aBlock |
2332 |
"evaluate aBlock with cursor off; turn it on afterwards." |
|
2333 |
||
2334 |
(shown not or:[cursorShown not]) ifTrue:[ |
|
3160 | 2335 |
^ aBlock value |
121 | 2336 |
]. |
2337 |
self hideCursor. |
|
2522
d80496af7eaf
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2506
diff
changeset
|
2338 |
aBlock ensure:[ |
3160 | 2339 |
self showCursor |
121 | 2340 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2341 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2342 |
|
2589 | 2343 |
!EditTextView methodsFor:'drag & drop'! |
2344 |
||
2345 |
allowDrop:aBoolean |
|
3236 | 2346 |
"enable/disable drop support" |
2347 |
||
2589 | 2348 |
aBoolean ifFalse:[ |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2349 |
dropTarget := nil. |
2589 | 2350 |
] ifTrue:[ |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2351 |
dropTarget isNil ifTrue:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2352 |
dropTarget := DropTarget |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2353 |
receiver:self |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2354 |
argument:nil |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2355 |
dropSelector:#'drop:' |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2356 |
canDropSelector:#'canDrop:' |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2357 |
] |
3236 | 2358 |
]. |
2359 |
! |
|
2360 |
||
3412 | 2361 |
canDrop:aDropContext |
2362 |
"public from d&d. |
|
2363 |
I accept textObjects and fileObjects only." |
|
2364 |
||
4089
c6567fb50316
comment/format in: #canDrop:
Claus Gittinger <cg@exept.de>
parents:
4064
diff
changeset
|
2365 |
"/ cg: disabled to avoid unintended drop (is same as copy-past, anyway) |
3412 | 2366 |
aDropContext sourceWidget == self ifTrue:[^ false]. |
2367 |
^ self canDropObjects:aDropContext dropObjects |
|
2368 |
||
2369 |
"Modified: / 13-10-2006 / 17:41:09 / cg" |
|
2370 |
! |
|
2371 |
||
2372 |
canDropObjects:aCollectionOfDropObjects |
|
2373 |
"public from d&d. |
|
2374 |
I accept textObjects and fileObjects only." |
|
2589 | 2375 |
|
2376 |
self checkModificationsAllowed ifFalse:[^ false]. |
|
2377 |
||
3412 | 2378 |
aCollectionOfDropObjects isEmpty ifTrue:[ ^ false ]. |
2379 |
^ aCollectionOfDropObjects conform:[:obj| (obj isTextObject or:[obj isFileObject])] |
|
2380 |
||
2381 |
"Created: / 13-10-2006 / 15:56:57 / cg" |
|
2382 |
"Modified: / 13-10-2006 / 17:41:14 / cg" |
|
2383 |
! |
|
2384 |
||
2385 |
drop:aDropContext |
|
2386 |
"public from d&d. |
|
2387 |
drop objects (new API)" |
|
2388 |
||
2389 |
self dropObjects:(aDropContext dropObjects) |
|
2390 |
||
2391 |
"Modified: / 13-10-2006 / 17:41:19 / cg" |
|
2392 |
! |
|
2393 |
||
2394 |
dropFileObject:aDropObject |
|
2589 | 2395 |
"drop objects |
3236 | 2396 |
For bw. compatibility, also collections of drop objects are handled (may vanish)" |
2397 |
||
4136 | 2398 |
|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
|
2399 |
|
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2400 |
pasteWhat := #name. |
3412 | 2401 |
|
2402 |
fn := aDropObject asFilename. |
|
2403 |
(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
|
2404 |
enforcedDropMode := UserPreferences current enforcedDropModeForFiles. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2405 |
(enforcedDropMode notNil |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2406 |
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
|
2407 |
pasteWhat := enforcedDropMode. |
3886 | 2408 |
] ifFalse:[ |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2409 |
sensor := self sensor. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2410 |
(sensor shiftDown or:[sensor ctrlDown]) ifTrue:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2411 |
pasteWhat := #name. |
3886 | 2412 |
] ifFalse:[ |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2413 |
(sensor metaDown) ifTrue:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2414 |
pasteWhat := #contents. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2415 |
] ifFalse:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2416 |
dontAskAgainHolder := false asValue. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2417 |
answer := Dialog |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2418 |
confirmWithCancel:(resources |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2419 |
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
|
2420 |
with:fn name allBold) |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2421 |
labels:#( 'Cancel' 'Name' 'Contents' ) |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2422 |
values:#( nil #name #contents ) |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2423 |
default:#contents |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2424 |
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
|
2425 |
title:(resources string:'Drop What'). |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2426 |
answer isNil ifTrue:[ ^ self ]. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2427 |
|
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2428 |
dontAskAgainHolder value ifTrue:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2429 |
UserPreferences current enforcedDropModeForFiles:#contents |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2430 |
]. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2431 |
pasteWhat := answer. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2432 |
] |
3886 | 2433 |
] |
2434 |
]. |
|
2435 |
]. |
|
2436 |
||
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2437 |
pasteWhat == #name ifTrue:[ |
3886 | 2438 |
text := fn pathName |
2439 |
] ifFalse:[ |
|
2440 |
self withWaitCursorDo:[ |
|
3799 | 2441 |
text := fn contentsOfEntireFile |
4136 | 2442 |
]. |
2443 |
(app := self application) notNil ifTrue:[ |
|
2444 |
app droppedFile:fn in:self |
|
2445 |
]. |
|
3886 | 2446 |
]. |
2447 |
||
3799 | 2448 |
self |
2449 |
undoablePaste:text |
|
2450 |
info:'Drop File'. |
|
3412 | 2451 |
|
2452 |
"Created: / 13-10-2006 / 17:38:31 / cg" |
|
3495 | 2453 |
"Modified: / 28-07-2007 / 13:27:09 / cg" |
3412 | 2454 |
! |
2455 |
||
2456 |
dropObject:aDropObject |
|
2457 |
"drop objects |
|
2458 |
For bw. compatibility, also collections of drop objects are handled (may vanish)" |
|
2459 |
||
3415 | 2460 |
|text| |
2461 |
||
3412 | 2462 |
(aDropObject isFileObject) ifTrue:[ |
3799 | 2463 |
self dropFileObject:aDropObject |
3412 | 2464 |
] ifFalse:[ |
3799 | 2465 |
aDropObject isTextObject ifTrue:[ |
2466 |
text := aDropObject theObject. |
|
2467 |
text isStringCollection ifTrue:[ |
|
2468 |
text := text asStringWithoutFinalCR |
|
2469 |
]. |
|
2470 |
] ifFalse:[ |
|
2471 |
text := aDropObject theObject asString |
|
2472 |
]. |
|
2473 |
self |
|
2474 |
undoablePaste:text |
|
2475 |
info:'Drop'. |
|
3412 | 2476 |
]. |
2477 |
||
2478 |
"Created: / 13-10-2006 / 17:37:05 / cg" |
|
3495 | 2479 |
"Modified: / 28-07-2007 / 13:26:53 / cg" |
3412 | 2480 |
! |
2481 |
||
2482 |
dropObjects:aCollectionOfDropObjects |
|
2483 |
"public from d&d. |
|
2484 |
drop objects (old API)" |
|
2485 |
||
3868 | 2486 |
aCollectionOfDropObjects do:[:el | |
2487 |
self dropObject:el |
|
3412 | 2488 |
]. |
2489 |
||
2490 |
"Created: / 13-10-2006 / 15:59:40 / cg" |
|
2491 |
"Modified: / 13-10-2006 / 17:41:23 / cg" |
|
2589 | 2492 |
! ! |
2493 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2494 |
!EditTextView methodsFor:'editing'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2495 |
|
4286
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2496 |
convertSelectionToLowercaseOrUppercaseOrUppercaseFirst |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2497 |
"toLower/toUppercaseFirst/toUpper selected text" |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2498 |
|
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2499 |
|line1 line2| |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2500 |
|
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2501 |
line1 := self selectionStartLine. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2502 |
line2 := self selectionEndLine. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2503 |
line1 isNil ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2504 |
line1 := self perform:#cursorLine ifNotUnderstood:nil. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2505 |
line1 notNil ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2506 |
line2 := line1 |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2507 |
] |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2508 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2509 |
line1 notNil ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2510 |
line1 to:line2 do:[:lineNr | |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2511 |
|line col1 col2 isAllLower isLowerFirst isAllUpper isUpperFirst |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2512 |
makeLowercase makeUppercase makeUppercaseFirst makeLowercaseFirst| |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2513 |
|
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2514 |
line := (self listAt:lineNr) copy. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2515 |
line size > 0 ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2516 |
lineNr == line1 ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2517 |
col1 := selectionStartCol. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2518 |
] ifFalse:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2519 |
col1 := 1. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2520 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2521 |
lineNr == line2 ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2522 |
col2 := selectionEndCol. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2523 |
] ifFalse:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2524 |
col2 := (self listAt:lineNr) size. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2525 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2526 |
isAllLower := isAllUpper := isUpperFirst := isLowerFirst := true. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2527 |
col1 to:col2 do:[:col | |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2528 |
|ch| |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2529 |
|
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2530 |
ch := line at:col. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2531 |
ch isUppercase ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2532 |
isAllLower := false. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2533 |
col == col1 ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2534 |
isLowerFirst := false. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2535 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2536 |
] ifFalse:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2537 |
ch isLowercase ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2538 |
isAllUpper := false. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2539 |
col == col1 ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2540 |
isUpperFirst := false. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2541 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2542 |
] |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2543 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2544 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2545 |
|
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2546 |
makeLowercase := makeUppercase := makeUppercaseFirst := makeLowercaseFirst := false. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2547 |
isLowerFirst ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2548 |
makeUppercaseFirst := true. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2549 |
] ifFalse:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2550 |
"/ must remember where we come from - otherwise, we end up |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2551 |
"/ in upperFirst - lowerFirst cycle. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2552 |
"/ think about a good place to store this state |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2553 |
false "(isUpperFirst and:[isAllUpper not])" ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2554 |
makeLowercaseFirst := true. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2555 |
] ifFalse:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2556 |
isAllUpper ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2557 |
makeLowercase := true. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2558 |
] ifFalse:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2559 |
makeUppercase := true. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2560 |
] |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2561 |
] |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2562 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2563 |
makeUppercaseFirst ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2564 |
line at:col1 put:(line at:col1) asUppercase. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2565 |
] ifFalse:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2566 |
makeLowercaseFirst ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2567 |
line at:col1 put:(line at:col1) asLowercase. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2568 |
] ifFalse:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2569 |
col1 to:col2 do:[:col | |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2570 |
|ch| |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2571 |
|
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2572 |
ch := line at:col. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2573 |
ch := makeLowercase |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2574 |
ifTrue:[ ch asLowercase ] |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2575 |
ifFalse:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2576 |
makeUppercase |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2577 |
ifTrue:[ ch asUppercase ] |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2578 |
ifFalse:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2579 |
col == col1 |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2580 |
ifTrue:[ ch asUppercase ] |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2581 |
ifFalse:[ ch asLowercase ] |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2582 |
] |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2583 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2584 |
line at:col put:ch. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2585 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2586 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2587 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2588 |
self withoutRedrawAt:lineNr put:line. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2589 |
self invalidateLine:lineNr. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2590 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2591 |
]. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2592 |
] |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2593 |
|
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2594 |
"Created: / 14-07-2011 / 11:40:26 / cg" |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2595 |
! |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
2596 |
|
313
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2597 |
copyAndDeleteSelection |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2598 |
"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
|
2599 |
|
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2600 |
selectionStartLine notNil ifTrue:[ |
3160 | 2601 |
self setClipboardText:(self selection). |
2602 |
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
|
2603 |
]. |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2604 |
|
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2605 |
"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
|
2606 |
! |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2607 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2608 |
deleteCharAtCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2609 |
"delete single character under cursor; does not merge lines" |
121 | 2610 |
|
2611 |
|wasOn| |
|
2612 |
||
2613 |
wasOn := self hideCursor. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2614 |
self deleteCharAtLine:cursorLine col:cursorCol. |
121 | 2615 |
wasOn ifTrue:[self showCursor] |
2616 |
! |
|
2617 |
||
827 | 2618 |
deleteCharAtLine:lineNr col:colNr |
2619 |
"delete a single character at colNr in line lineNr" |
|
2620 |
||
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2621 |
self st80EditMode ifTrue:[ |
3160 | 2622 |
(self listAt:cursorLine) size + 1 = colNr ifTrue:[ |
2623 |
| wasOn | |
|
2624 |
wasOn := self hideCursor. |
|
2625 |
self |
|
2626 |
cursorReturn; |
|
2627 |
cursorCol:1; |
|
2628 |
deleteCharBeforeCursor. |
|
2629 |
wasOn ifTrue:[ self showCursor]. |
|
2630 |
^ self. |
|
2631 |
]. |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2632 |
]. |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2633 |
|
827 | 2634 |
self deleteCharsAtLine:lineNr fromCol:colNr toCol:colNr |
2635 |
! |
|
2636 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2637 |
deleteCharBeforeCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2638 |
"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
|
2639 |
|
2491 | 2640 |
|soCol wasOn lineNrAboveCursor ln prevTab| |
121 | 2641 |
|
2642 |
wasOn := self hideCursor. |
|
2491 | 2643 |
autoIndent ifTrue:[ |
3160 | 2644 |
prevTab := (self prevTabBefore:cursorCol) max:1. |
2645 |
ln := (list at:cursorLine) ? ''. |
|
2646 |
ln size < prevTab ifTrue:[ |
|
2647 |
ln := ln , (String new:prevTab withAll:Character space). |
|
2648 |
]. |
|
2649 |
(ln copyTo:prevTab) isBlank ifTrue:[ |
|
2650 |
(ln copyFrom:prevTab+1) isBlank ifTrue:[ |
|
2651 |
cursorCol > prevTab ifTrue:[ |
|
2652 |
self cursorLine:cursorLine col:prevTab. |
|
2653 |
wasOn ifTrue:[ self showCursor ]. |
|
2654 |
^ self |
|
2655 |
]. |
|
2656 |
] ifFalse:[ |
|
2657 |
self deleteFromLine:cursorLine col:prevTab toLine:cursorLine col:cursorCol-1. |
|
2658 |
self cursorLine:cursorLine col:prevTab. |
|
2659 |
wasOn ifTrue:[ self showCursor ]. |
|
2660 |
^ self. |
|
2661 |
] |
|
2662 |
]. |
|
827 | 2663 |
]. |
2664 |
||
2491 | 2665 |
"/ (autoIndent |
2666 |
"/ and:[cursorCol ~~ 1 |
|
3160 | 2667 |
"/ and:[cursorLine <= (list size)]]) |
2491 | 2668 |
"/ ifTrue:[ |
2669 |
"/ soCol := (self leftIndentForLine:cursorLine) + 1. |
|
2670 |
"/ |
|
2671 |
"/ (cursorCol == soCol and:[soCol > 1]) ifTrue:[ |
|
2672 |
"/ ln := list at:cursorLine. |
|
2673 |
"/ (ln notNil and:[(ln indexOfNonSeparatorStartingAt:1) < soCol]) ifTrue:[ |
|
2674 |
"/ soCol := 1 |
|
2675 |
"/ ] |
|
2676 |
"/ ] |
|
2677 |
"/ ] ifFalse:[ |
|
3160 | 2678 |
soCol := 1. |
2491 | 2679 |
"/ ]. |
2680 |
||
1419 | 2681 |
(cursorCol ~~ soCol and:[cursorCol ~~ 1]) ifTrue:[ |
3160 | 2682 |
" |
2683 |
somewhere in the middle of a line |
|
2684 |
" |
|
2685 |
self cursorLeft. |
|
2686 |
self deleteCharAtLine:cursorLine col:cursorCol. |
|
1419 | 2687 |
] ifFalse:[ |
3160 | 2688 |
" |
2689 |
at begin of line - merge with previous line; |
|
2690 |
except for the very first line. |
|
2691 |
" |
|
2692 |
(cursorLine == 1) ifFalse:[ |
|
2693 |
lineNrAboveCursor := self validateCursorLine:(cursorLine - 1). |
|
2694 |
lineNrAboveCursor < cursorLine ifTrue:[ |
|
2695 |
(lineNrAboveCursor > 0 and:[lineNrAboveCursor > list size]) ifTrue:[ |
|
2696 |
"/ we are beyond the end of the text. |
|
2697 |
"/ move the cursor to the previous line. |
|
2698 |
self cursorLine:lineNrAboveCursor col:1. |
|
2699 |
] ifFalse:[ |
|
2700 |
self mergeLine:lineNrAboveCursor removeBlanks:false. |
|
2701 |
] |
|
2702 |
] |
|
2703 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2704 |
]. |
827 | 2705 |
wasOn ifTrue:[ self showCursor ] |
2706 |
||
1419 | 2707 |
"Modified: / 16.1.1998 / 22:33:04 / cg" |
827 | 2708 |
! |
2709 |
||
2710 |
deleteCharsAtLine:lineNr fromCol:colNr |
|
2711 |
"delete characters from colNr up to the end in line lineNr" |
|
2712 |
||
2713 |
|line| |
|
2714 |
||
2715 |
(line := self listAt:lineNr) notNil ifTrue:[ |
|
3160 | 2716 |
self deleteCharsAtLine:lineNr fromCol:colNr toCol:(line size) |
827 | 2717 |
] |
2718 |
||
2719 |
! |
|
2720 |
||
2721 |
deleteCharsAtLine:lineNr toCol:colNr |
|
2722 |
"delete characters from start up to colNr in line lineNr" |
|
2723 |
||
2724 |
self deleteCharsAtLine:lineNr fromCol:1 toCol:colNr |
|
2725 |
||
2726 |
||
121 | 2727 |
! |
2728 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2729 |
deleteCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2730 |
"delete the line where the cursor sits" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2731 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2732 |
self deleteLine:cursorLine |
121 | 2733 |
! |
2734 |
||
2385
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2735 |
deleteFromCharacterPosition:charPos1 to:charPos2 |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2736 |
"delete a substring at a character position" |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2737 |
|
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2738 |
|line1 col1 line2 col2| |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2739 |
|
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2740 |
line1 := self lineOfCharacterPosition:charPos1. |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2741 |
col1 := charPos1 - (self characterPositionOfLine:line1 col:1) + 1. |
2725
eccf283b2efb
deleteFromCharacterPos - fixed
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
2742 |
col1 == 0 ifTrue:[ |
3160 | 2743 |
line1 := line1 - 1. |
2744 |
col1 := (self listAt:line1) size + 1. |
|
2725
eccf283b2efb
deleteFromCharacterPos - fixed
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
2745 |
]. |
2385
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2746 |
|
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2747 |
line2 := self lineOfCharacterPosition:charPos2. |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2748 |
col2 := charPos2 - (self characterPositionOfLine:line2 col:1) + 1. |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2749 |
|
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2750 |
self deleteFromLine:line1 col:col1 toLine:line2 col:col2. |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2751 |
! |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2752 |
|
2954 | 2753 |
deleteFromLine:startLine col:startCol toLine:endLine col:endCol |
2754 |
"delete all text from startLine/startCol to endLine/endCol - |
|
2755 |
joining lines if nescessary" |
|
2756 |
||
2757 |
|line newLine lineSize nMore| |
|
2758 |
||
2759 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
2760 |
list isNil ifTrue:[^ self]. |
|
2761 |
startLine > list size ifTrue:[ ^ self]. "/ deleted space below text |
|
2762 |
||
2763 |
(startLine == endLine) ifTrue:[ |
|
4225 | 2764 |
"/ delete chars within a line |
2765 |
self deleteCharsAtLine:startLine fromCol:startCol toCol:endCol. |
|
2766 |
^ self |
|
2954 | 2767 |
]. |
2768 |
||
2769 |
((startCol == 1) and:[endCol == 0]) ifTrue:[ |
|
4225 | 2770 |
"/ delete full lines only |
2771 |
endLine > startLine ifTrue:[ |
|
2772 |
self deleteFromLine:startLine toLine:(endLine - 1) |
|
2773 |
]. |
|
2774 |
^ self |
|
2954 | 2775 |
]. |
2776 |
||
2777 |
"/ delete right rest of 1st line |
|
2778 |
self deleteCharsAtLine:startLine fromCol:startCol. |
|
2779 |
||
2780 |
"/ delete the inner lines ... |
|
2781 |
endLine > (startLine + 1) ifTrue:[ |
|
4225 | 2782 |
self deleteFromLine:(startLine + 1) toLine:(endLine - 1) |
2954 | 2783 |
]. |
2784 |
||
2785 |
(endCol ~~ 0) ifTrue:[ |
|
4225 | 2786 |
"/ delete the left rest of the last line |
2787 |
||
2788 |
self deleteCharsAtLine:(startLine + 1) toCol:endCol. |
|
2789 |
||
2790 |
"/ must add blanks, if startCol lies beyond end of startLine |
|
2791 |
startLine <= list size ifTrue:[ |
|
2792 |
line := list at:startLine. |
|
2793 |
lineSize := line size. |
|
2794 |
(startCol > lineSize) ifTrue:[ |
|
2795 |
newLine := line. |
|
2796 |
line isNil ifTrue:[ |
|
2797 |
newLine := String new:(startCol - 1) |
|
2798 |
] ifFalse:[ |
|
2799 |
nMore := startCol - 1 - lineSize. |
|
2800 |
nMore > 0 ifTrue:[ |
|
2801 |
newLine := line , (line species new:nMore) |
|
2802 |
] |
|
2803 |
]. |
|
2804 |
newLine ~~ line ifTrue:[ |
|
2805 |
list at:startLine put:newLine. |
|
2806 |
]. |
|
2807 |
"/ TODO: remember old maxwidth of linerange, |
|
2808 |
"/ only clear widthOfWidestLine, if this max |
|
2809 |
"/ length was (one of) the longest. |
|
2810 |
"/ avoids slow delete with huge texts. |
|
2811 |
widthOfWidestLine := nil. "/ i.e. unknown |
|
2812 |
self textChanged. |
|
2813 |
] |
|
2814 |
] |
|
2954 | 2815 |
]. |
2816 |
||
2817 |
"/ merge the left rest of 1st line with right rest of last line into one |
|
2818 |
self mergeLine:startLine removeBlanks:false |
|
2819 |
||
4225 | 2820 |
"Modified: / 10-11-1998 / 23:52:59 / cg" |
2821 |
"Modified: / 18-03-2011 / 18:25:01 / az" |
|
2954 | 2822 |
! |
2823 |
||
827 | 2824 |
deleteLine:lineNr |
2825 |
"delete line" |
|
2826 |
||
2827 |
self deleteFromLine:lineNr toLine:lineNr |
|
2828 |
||
2829 |
||
2830 |
! |
|
2831 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2832 |
deleteLinesWithoutRedrawFrom:startLine to:endLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2833 |
"delete lines - no redraw; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2834 |
return true, if something was really deleted" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2835 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2836 |
|lastLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2837 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
2838 |
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
|
2839 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2840 |
(list isNil or:[startLine > list size]) ifTrue:[^ false]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2841 |
(endLine > list size) ifTrue:[ |
3160 | 2842 |
lastLine := list size |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2843 |
] ifFalse:[ |
3160 | 2844 |
lastLine := endLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2845 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2846 |
list removeFromIndex:startLine toIndex:lastLine. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2847 |
"/ TODO: remember old maxwidth of linerange, |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2848 |
"/ only clear widthOfWidestLine, if this max |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2849 |
"/ length was (one of) the longest. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2850 |
"/ avoids slow delete with huge texts. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2851 |
widthOfWidestLine := nil. "/ i.e. unknown |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2852 |
self textChanged. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2853 |
^ true |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2854 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2855 |
"Modified: / 10.11.1998 / 23:55:29 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2856 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2857 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2858 |
deleteSelection |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2859 |
"delete the selection" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2860 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2861 |
|wasOn startLine startCol endLine endCol| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2862 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
2863 |
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
|
2864 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2865 |
selectionStartLine notNil ifTrue:[ |
3160 | 2866 |
wasOn := self hideCursor. |
2867 |
||
2868 |
startLine := selectionStartLine. |
|
2869 |
startCol := selectionStartCol. |
|
2870 |
endLine := selectionEndLine. |
|
2871 |
endCol := selectionEndCol. |
|
2872 |
self unselectWithoutRedraw. |
|
2873 |
self deleteFromLine:startLine col:startCol toLine:endLine col:endCol. |
|
2874 |
self setCursorLine:startLine col:startCol. |
|
2875 |
||
2876 |
self makeCursorVisibleAndShowCursor:wasOn |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2877 |
] |
121 | 2878 |
! |
2879 |
||
2157
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2880 |
deleteWordBeforeCursor |
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2881 |
"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
|
2882 |
|
2952 | 2883 |
|wasOn beginCol beginLine endCol endLine| |
2157
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2884 |
|
3799 | 2885 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
2886 |
||
2157
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2887 |
wasOn := self hideCursor. |
3799 | 2888 |
self |
2889 |
undoableDo:[ |
|
2890 |
endCol := cursorCol-1. |
|
2891 |
endLine := cursorLine. |
|
2892 |
self cursorToPreviousWord. |
|
2893 |
beginCol := cursorCol. |
|
2894 |
beginLine := cursorLine. |
|
2895 |
self deleteFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
|
2896 |
] |
|
2897 |
info:'Delete Word'. |
|
2157
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2898 |
wasOn ifTrue:[ self showCursor ]. |
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2899 |
|
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2900 |
"Modified: / 22.2.2000 / 23:59:04 / cg" |
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2901 |
! |
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2902 |
|
121 | 2903 |
insertCharAtCursor:aCharacter |
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2904 |
"insert a single character at cursor-position - advance cursor." |
121 | 2905 |
|
2906 |
|wasOn| |
|
2907 |
||
2908 |
wasOn := self hideCursor. |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2909 |
aCharacter == Character tab ifTrue:[ |
3160 | 2910 |
"/ needs special care to advance cursor correctly |
2911 |
self insertTabAtCursor |
|
121 | 2912 |
] ifFalse:[ |
3160 | 2913 |
self insert:aCharacter atLine:cursorLine col:cursorCol. |
2914 |
aCharacter == (Character cr) ifTrue:[ |
|
2915 |
self cursorReturn |
|
2916 |
] ifFalse:[ |
|
2917 |
self cursorRight. |
|
2918 |
]. |
|
121 | 2919 |
]. |
2920 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2921 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2922 |
"Modified: / 12.6.1998 / 21:50:20 / cg" |
121 | 2923 |
! |
2924 |
||
641 | 2925 |
insertLine:aString before:lineNr |
2926 |
"insert the line aString before line lineNr" |
|
2927 |
||
2928 |
^ self insertLines:(Array with:aString) from:1 to:1 before:lineNr. |
|
2929 |
||
2930 |
"Modified: 14.5.1996 / 13:42:54 / cg" |
|
2931 |
! |
|
2932 |
||
155 | 2933 |
insertLines:aStringCollection before:lineNr |
2934 |
"insert a bunch before line lineNr" |
|
2935 |
||
2936 |
self insertLines:aStringCollection from:1 to:aStringCollection size before:lineNr |
|
2937 |
||
2938 |
"Modified: 6.9.1995 / 20:51:03 / claus" |
|
2939 |
! |
|
2940 |
||
654 | 2941 |
insertLines:lines withCR:withCr |
3160 | 2942 |
"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
|
2943 |
Cursor is moved behind insertion. |
641 | 2944 |
If withCr is true, append cr after last line" |
2945 |
||
2946 |
|start end nLines wasOn| |
|
2947 |
||
2948 |
lines notNil ifTrue:[ |
|
3160 | 2949 |
nLines := lines size. |
2950 |
(nLines == 1) ifTrue:[ |
|
2951 |
self insertStringAtCursor:(lines at:1). |
|
2952 |
withCr ifTrue:[ |
|
2953 |
self insertCharAtCursor:(Character cr) |
|
2954 |
] |
|
2955 |
] ifFalse:[ |
|
2956 |
(cursorCol ~~ 1) ifTrue:[ |
|
2957 |
self insertStringAtCursor:(lines at:1). |
|
2958 |
self insertCharAtCursor:(Character cr). |
|
2959 |
start := 2 |
|
2960 |
] ifFalse:[ |
|
2961 |
start := 1 |
|
2962 |
]. |
|
2963 |
withCr ifTrue:[ |
|
2964 |
end := nLines |
|
2965 |
] ifFalse:[ |
|
2966 |
end := nLines - 1 |
|
2967 |
]. |
|
2968 |
(start < nLines) ifTrue:[ |
|
2969 |
(end >= start) ifTrue:[ |
|
2970 |
wasOn := self hideCursor. |
|
2971 |
self insertLines:lines from:start to:end before:cursorLine. |
|
2972 |
self setCursorLine:(cursorLine + (end - start + 1)). |
|
2973 |
wasOn ifTrue:[self showCursor]. |
|
2974 |
] |
|
2975 |
]. |
|
2976 |
withCr ifFalse:[ |
|
2977 |
"last line without cr" |
|
2978 |
self insertStringAtCursor:(lines at:nLines) |
|
2979 |
] |
|
2980 |
] |
|
641 | 2981 |
] |
654 | 2982 |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2983 |
"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
|
2984 |
"Modified: / 12.6.1998 / 21:51:16 / cg" |
654 | 2985 |
! |
2986 |
||
2987 |
insertLines:lines withCr:withCr |
|
2988 |
"insert a bunch of lines at cursor position. Cursor |
|
2989 |
is moved behind insertion. |
|
2990 |
If withCr is true, append cr after last line" |
|
2991 |
||
2363 | 2992 |
<resource:#obsolete> |
2993 |
||
1292 | 2994 |
self obsoleteMethodWarning:'use #insertLines:withCR:'. |
2995 |
self insertLines:lines withCR:withCr. |
|
2996 |
||
2997 |
"Modified: 31.7.1997 / 23:07:22 / cg" |
|
641 | 2998 |
! |
2999 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3000 |
insertSelectedStringAtCursor:aString |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3001 |
"insert the argument, aString at cursor position and select it" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3002 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3003 |
|startLine startCol| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3004 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3005 |
startLine := cursorLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3006 |
startCol := cursorCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3007 |
self insertStringAtCursor:aString. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3008 |
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
|
3009 |
toLine:cursorLine col:(cursorCol - 1). |
3514
98e103cad51d
insertSelectedStringAtCursor: - make selection visible afterwards;
Michael Beyl <mb@exept.de>
parents:
3510
diff
changeset
|
3010 |
self makeSelectionVisible. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3011 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3012 |
|
1935
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
3013 |
insertString:aString atCharacterPosition:charPos |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
3014 |
"insert the argument, aString at a character position" |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
3015 |
|
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
3016 |
|line col| |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
3017 |
|
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
3018 |
line := self lineOfCharacterPosition:charPos. |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
3019 |
col := charPos - (self characterPositionOfLine:line col:1) + 1. |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
3020 |
self insertString:aString atLine:line col:col |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
3021 |
! |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
3022 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3023 |
insertString:aString atLine:lineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3024 |
"insert the string, aString at line/col; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3025 |
handle cr's correctly" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3026 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3027 |
|start "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3028 |
stop "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3029 |
end "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3030 |
subString c |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3031 |
l "{ Class: SmallInteger }" | |
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 |
aString isNil ifTrue:[^ self]. |
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3034 |
(aString includes:(Character cr)) ifFalse:[ |
3160 | 3035 |
^ self insertStringWithoutCRs:aString atLine:lineNr col:colNr |
121 | 3036 |
]. |
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3037 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3038 |
l := lineNr. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3039 |
c := colNr. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3040 |
start := 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3041 |
end := aString size. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3042 |
[start <= end] whileTrue:[ |
3160 | 3043 |
stop := aString indexOf:(Character cr) startingAt:start. |
3044 |
stop == 0 ifTrue:[ |
|
3045 |
stop := end + 1 |
|
3046 |
]. |
|
3047 |
subString := aString copyFrom:start to:(stop - 1). |
|
3048 |
self insertStringWithoutCRs:subString atLine:l col:c. |
|
3049 |
(stop <= end) ifTrue:[ |
|
3050 |
c := c + subString size. |
|
3051 |
self insert:(Character cr) atLine:l col:c. |
|
3052 |
l := l + 1. |
|
3053 |
c := 1 |
|
3054 |
]. |
|
3055 |
start := stop + 1 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3056 |
] |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
3057 |
|
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3058 |
"Modified: / 10.6.1998 / 19:03:59 / cg" |
121 | 3059 |
! |
3060 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3061 |
insertStringAtCursor:aString |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3062 |
"insert the argument, aString at cursor position |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3063 |
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
|
3064 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3065 |
aString isNil ifTrue:[ |
3160 | 3066 |
"new:" |
3067 |
self insertCharAtCursor:(Character cr). |
|
3068 |
^ self |
|
105 | 3069 |
]. |
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3070 |
(aString includes:(Character cr)) ifFalse:[ |
3160 | 3071 |
^ self insertStringWithoutCRsAtCursor:aString |
105 | 3072 |
]. |
3073 |
||
654 | 3074 |
self insertLines:aString asStringCollection withCR:false. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3075 |
|
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3076 |
"Modified: / 10.6.1998 / 19:03:21 / cg" |
105 | 3077 |
! |
3078 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3079 |
insertStringWithoutCRs:aString atLine:lineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3080 |
"insert aString (which has no crs) at lineNr/colNr" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3081 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3082 |
self withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr. |
4190 | 3083 |
shown ifTrue:[ |
3084 |
font hasOverlappingCharacters ifTrue:[ |
|
3085 |
self invalidateLine:lineNr. |
|
3086 |
] ifFalse:[ |
|
3087 |
self redrawLine:lineNr from:colNr |
|
3088 |
] |
|
3089 |
] |
|
3090 |
||
4191 | 3091 |
"Modified: / 09-11-2010 / 13:43:03 / cg" |
105 | 3092 |
! |
3093 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3094 |
insertStringWithoutCRsAtCursor:aString |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3095 |
"insert a string (which has no crs) at cursor position |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3096 |
- advance cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3097 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
3098 |
|wasOn oldLen newLen deltaLen| |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
3099 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
3100 |
aString size > 0 ifTrue:[ |
3160 | 3101 |
wasOn := self hideCursor. |
3102 |
(aString includes:Character tab) ifTrue:[ |
|
3103 |
self checkForExistingLine:cursorLine. |
|
3104 |
oldLen := (list at:cursorLine) size. |
|
3105 |
self insertString:aString atLine:cursorLine col:cursorCol. |
|
3106 |
newLen := (list at:cursorLine) size. |
|
3107 |
deltaLen := newLen - oldLen. |
|
3108 |
] ifFalse:[ |
|
3109 |
self insertString:aString atLine:(cursorLine ? 1) col:cursorCol. |
|
3110 |
deltaLen := aString size. |
|
3111 |
]. |
|
3112 |
self setCursorCol:(cursorCol + deltaLen). |
|
3113 |
wasOn ifTrue:[self showCursor] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3114 |
] |
1563
b4eb49efdfcd
fixed cursor positioning if inserting a string with tabs.
Claus Gittinger <cg@exept.de>
parents:
1561
diff
changeset
|
3115 |
|
b4eb49efdfcd
fixed cursor positioning if inserting a string with tabs.
Claus Gittinger <cg@exept.de>
parents:
1561
diff
changeset
|
3116 |
"Modified: / 10.6.1998 / 20:43:52 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3117 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3118 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3119 |
insertTabAtCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3120 |
"insert spaces to next tab" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3121 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3122 |
|wasOn nextTab| |
105 | 3123 |
|
121 | 3124 |
wasOn := self hideCursor. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3125 |
nextTab := self nextTabAfter:cursorCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3126 |
self insertStringAtCursor:(String new:(nextTab - cursorCol)). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3127 |
self makeCursorVisibleAndShowCursor:wasOn. |
105 | 3128 |
! |
3129 |
||
3542 | 3130 |
joinLines |
3890 | 3131 |
"join lines (remove line-break)" |
3132 |
||
3583 | 3133 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
3134 |
||
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3135 |
self |
3890 | 3136 |
undoableDo:[ |
3137 |
|line col lineLen| |
|
3138 |
||
3139 |
line := cursorLine. |
|
3140 |
col := cursorCol. |
|
3141 |
lineLen := (list at:line) size. |
|
3142 |
col > lineLen ifTrue:[ |
|
3143 |
self insertString:(String new:col-lineLen) atLine:line col:col+1. |
|
3144 |
] ifFalse:[ |
|
3145 |
self deleteCharsAtLine:line fromCol:col toCol:lineLen. |
|
3146 |
]. |
|
3147 |
self mergeLine:line removeBlanks:true. |
|
3148 |
self cursorLine:line col:col. |
|
3149 |
] |
|
3150 |
info:'Join' |
|
3542 | 3151 |
! |
3152 |
||
2952 | 3153 |
mergeLine:lineNr |
3154 |
"merge line lineNr with line lineNr+1" |
|
3155 |
||
3156 |
self mergeLine:lineNr removeBlanks:true |
|
3157 |
||
3158 |
"Modified: 9.9.1997 / 09:28:03 / cg" |
|
3159 |
! |
|
3160 |
||
2506 | 3161 |
parenthizeSelectionWith:openingCharacter and:closingCharacter |
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3162 |
|newSelectionEnd| |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3163 |
|
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3164 |
self hasSelection ifFalse:[^ self]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3165 |
|
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3166 |
newSelectionEnd := selectionEndCol. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3167 |
|
2506 | 3168 |
(self characterAtLine:selectionStartLine col:selectionStartCol) == openingCharacter ifTrue:[ |
3160 | 3169 |
(self characterAtLine:selectionEndLine col:selectionEndCol) == closingCharacter ifTrue:[ |
3170 |
self deleteCharAtLine:selectionEndLine col:selectionEndCol. |
|
3171 |
newSelectionEnd := newSelectionEnd-1. |
|
3172 |
]. |
|
3173 |
self deleteCharAtLine:selectionStartLine col:selectionStartCol. |
|
3174 |
selectionStartLine == selectionEndLine ifTrue:[ |
|
3175 |
newSelectionEnd := newSelectionEnd-1. |
|
3176 |
] |
|
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3177 |
] ifFalse:[ |
3160 | 3178 |
self insert:closingCharacter atLine:selectionEndLine col:selectionEndCol+1. |
3179 |
newSelectionEnd := newSelectionEnd+1. |
|
3180 |
self insert:openingCharacter atLine:selectionStartLine col:selectionStartCol. |
|
3181 |
selectionStartLine == selectionEndLine ifTrue:[ |
|
3182 |
newSelectionEnd := newSelectionEnd+1. |
|
3183 |
] |
|
3184 |
]. |
|
3185 |
self |
|
3186 |
selectFromLine:selectionStartLine col:selectionStartCol |
|
3187 |
toLine:selectionEndLine col:newSelectionEnd. |
|
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3188 |
! |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3189 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3190 |
removeTrailingBlankLines |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3191 |
"remove all blank lines at end of text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3192 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3193 |
|lastLine "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3194 |
line finished| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3195 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3196 |
lastLine := list size. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3197 |
finished := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3198 |
[finished] whileFalse:[ |
3160 | 3199 |
(lastLine <= 1) ifTrue:[ |
3200 |
finished := true |
|
3201 |
] ifFalse:[ |
|
3202 |
line := list at:lastLine. |
|
3203 |
line notNil ifTrue:[ |
|
3204 |
line isBlank ifTrue:[ |
|
3205 |
list at:lastLine put:nil. |
|
3206 |
line := nil |
|
3207 |
] |
|
3208 |
]. |
|
3209 |
line notNil ifTrue:[ |
|
3210 |
finished := true |
|
3211 |
] ifFalse:[ |
|
3212 |
lastLine := lastLine - 1 |
|
3213 |
] |
|
3214 |
] |
|
118 | 3215 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3216 |
(lastLine ~~ list size) ifTrue:[ |
3160 | 3217 |
list grow:lastLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3218 |
"/ self textChanged |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3219 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3220 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3221 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3222 |
replace:patternArg by:replacePatternArg all:all ignoreCase:ign |
3430 | 3223 |
|pattern replacePattern| |
3224 |
||
3225 |
pattern := patternArg string. |
|
3226 |
replacePattern := replacePatternArg string. |
|
3227 |
^ (pattern notEmpty and:[ replacePattern notEmpty ]) ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3228 |
self rememberSearchPattern:pattern. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3229 |
self rememberSearchPattern:replacePattern. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3230 |
LastSearchIgnoredCase := ign. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3231 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3232 |
undoableDo:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3233 |
all ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3234 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3235 |
replaceString:pattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3236 |
to:replacePattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3237 |
ignoreCase:ign |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3238 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3239 |
(self selectionAsString notNil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3240 |
and:[ self selectionAsString sameAs:pattern ignoreCase:ign ]) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3241 |
ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3242 |
self replaceSelectionWith:replacePattern. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3243 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3244 |
search:pattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3245 |
ignoreCase:ign |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3246 |
forward:(lastSearchDirection = #forward). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3247 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3248 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3249 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3250 |
info:'Replace' |
3430 | 3251 |
] |
3252 |
||
3253 |
"Created: / 11-07-2006 / 11:19:57 / fm" |
|
3254 |
! |
|
3255 |
||
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3256 |
replaceCharAtCursor:aCharacter |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3257 |
"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
|
3258 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3259 |
|wasOn| |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3260 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3261 |
wasOn := self hideCursor. |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3262 |
aCharacter == (Character cr) ifTrue:[ |
3160 | 3263 |
self cursorReturn |
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3264 |
] ifFalse:[ |
3160 | 3265 |
self replace:aCharacter atLine:cursorLine col:cursorCol. |
3266 |
self cursorRight. |
|
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3267 |
]. |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3268 |
self makeCursorVisibleAndShowCursor:wasOn. |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3269 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3270 |
"Created: 6.3.1996 / 12:27:42 / cg" |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3271 |
! |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3272 |
|
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3273 |
replaceFromCharacterPosition:charPos1 to:charPos2 with:newString |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3274 |
"replace a substring at a character position" |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3275 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3276 |
self insertString:newString atCharacterPosition:charPos1. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3277 |
self deleteFromCharacterPosition:charPos1+newString size to:charPos2+newString size. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3278 |
! |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3279 |
|
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3280 |
replaceLines:lines withCR:withCr |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3281 |
"replace a bunch of lines at cursor position. Cursor |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3282 |
is moved behind replacement. |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3283 |
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
|
3284 |
after the last line" |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3285 |
|
1809 | 3286 |
|line col nLines wasOn| |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3287 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3288 |
lines notNil ifTrue:[ |
3160 | 3289 |
wasOn := self hideCursor. |
3290 |
nLines := lines size. |
|
3291 |
line := cursorLine. |
|
3292 |
col := cursorCol. |
|
3293 |
lines keysAndValuesDo:[:i :l | |
|
3294 |
self replaceString:l atLine:line col:col. |
|
3295 |
(i ~~ nLines or:[withCr]) ifTrue:[ |
|
3296 |
line := line + 1. |
|
3297 |
col := 1. |
|
3298 |
] ifFalse:[ |
|
3299 |
col := col + (l size). |
|
3300 |
] |
|
3301 |
]. |
|
3302 |
self cursorLine:line col:col. |
|
3303 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
3304 |
"/ wasOn ifTrue:[self showCursor]. |
|
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3305 |
] |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3306 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3307 |
"Created: / 18.5.1996 / 15:32:06 / cg" |
1567
0eff7ca88e89
much faster multi-line replace (avoid scroll)
Claus Gittinger <cg@exept.de>
parents:
1566
diff
changeset
|
3308 |
"Modified: / 12.6.1998 / 22:05:51 / cg" |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3309 |
! |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3310 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3311 |
replaceSelectionBy:something |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3312 |
"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
|
3313 |
leave cursor after insertion" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3314 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3315 |
self replaceSelectionBy:something keepCursor:false |
105 | 3316 |
! |
3317 |
||
3318 |
replaceSelectionBy:something keepCursor:keep |
|
3319 |
"delete the selection (if any) and insert something, a character or string; |
|
3320 |
leave cursor after insertion or leave it, depending on keep" |
|
3321 |
||
4051 | 3322 |
|sel l c | |
105 | 3323 |
|
3324 |
l := cursorLine. |
|
3325 |
c := cursorCol. |
|
3326 |
||
3327 |
sel := self selection. |
|
3328 |
sel notNil ifTrue:[ |
|
4053 | 3329 |
self setLastStringToReplace: sel. |
3330 |
||
4010 | 3331 |
self deleteSelection. |
3332 |
replacing := true. |
|
4048 | 3333 |
lastReplacementInfo lastReplacement: ''. |
4010 | 3334 |
undoSupport actionInfo:'replace'. |
3161 | 3335 |
]. |
3336 |
||
3337 |
something isCharacter ifTrue:[ |
|
4051 | 3338 |
lastReplacementInfo lastReplacement notNil ifTrue:[ |
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3339 |
"/ "XXX - replacing text with spaces ..." |
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3340 |
"/ (lastReplacement endsWith:Character space) ifTrue:[ |
4051 | 3341 |
"/ lastReplacement := lastReplacementInfo lastReplacement copyWithoutLast:1 "copyTo:(lastReplacement size - 1)". |
3342 |
"/ lastReplacement := lastReplacementInfo lastReplacement copyWith:something. |
|
3343 |
"/ lastReplacement := lastReplacementInfo lastReplacement copyWith:Character space |
|
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3344 |
"/ ] ifFalse:[ |
4051 | 3345 |
lastReplacementInfo lastReplacement: (lastReplacementInfo lastReplacement copyWith:something). |
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3346 |
"/ ] |
4010 | 3347 |
]. |
3348 |
self isInInsertMode ifTrue:[ |
|
3349 |
self insertCharAtCursor:something |
|
3350 |
] ifFalse:[ |
|
3351 |
self replaceCharAtCursor:something |
|
3352 |
] |
|
105 | 3353 |
] ifFalse:[ |
4010 | 3354 |
something isString ifTrue:[ |
4048 | 3355 |
lastReplacementInfo lastReplacement: something. |
4010 | 3356 |
self isInInsertMode ifTrue:[ |
3357 |
self insertStringAtCursor:something |
|
3358 |
] ifFalse:[ |
|
3359 |
self replaceStringAtCursor:something |
|
3360 |
] |
|
3361 |
] ifFalse:[ |
|
3362 |
Transcript showCR:'EditTextView: non String-or-Character in replace'. |
|
3363 |
]. |
|
105 | 3364 |
]. |
3365 |
keep ifTrue:[ |
|
4010 | 3366 |
self cursorLine:l col:c |
105 | 3367 |
] |
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3368 |
|
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3369 |
"Modified: 9.10.1996 / 16:14:35 / cg" |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3370 |
! |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3371 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3372 |
replaceString:aString to:aNewString ignoreCase:ign |
3549 | 3373 |
|continue count| |
3374 |
||
3375 |
self cursorToTop. |
|
3376 |
self selectFromBeginning. |
|
3377 |
count := 0. |
|
3378 |
continue := true. |
|
3379 |
[ continue ] whileTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3380 |
(self selectionAsString notNil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3381 |
and:[ self selectionAsString sameAs:aString ignoreCase:ign ]) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3382 |
ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3383 |
self replaceSelectionWith:aNewString. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3384 |
count := count + 1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3385 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3386 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3387 |
searchFwd:aString |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3388 |
ignoreCase:ign |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3389 |
ifAbsent:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3390 |
Dialog |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3391 |
information:aString , ' has been replaced to ' , aNewString , ' ' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3392 |
, count printString , ' times'. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3393 |
continue := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3394 |
]. |
3549 | 3395 |
]. |
3430 | 3396 |
|
3397 |
"Created: / 10-07-2006 / 16:42:48 / fm" |
|
3398 |
! |
|
3399 |
||
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3400 |
replaceStringAtCursor:aString |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3401 |
"replace multiple characters at cursor-position - advance cursor" |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3402 |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3403 |
|wasOn i1 i2| |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3404 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3405 |
wasOn := self hideCursor. |
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3406 |
(aString includes:Character tab) ifTrue:[ |
3160 | 3407 |
"/ need special care for TAB (to move cursor correctly) |
3408 |
i1 := 1. |
|
3409 |
[i1 ~~ 0] whileTrue:[ |
|
3410 |
i2 := aString indexOf:Character tab startingAt:i1. |
|
3411 |
i2 ~~ 0 ifTrue:[ |
|
3412 |
i1 ~~ i2 ifTrue:[ |
|
3413 |
self replaceString:(aString copyFrom:i1 to:i2-1) atLine:cursorLine col:cursorCol. |
|
3414 |
self cursorCol:(cursorCol + (i2 - i1)). |
|
3415 |
]. |
|
3416 |
self replaceTABAtCursor. |
|
3417 |
i2 := i2 + 1. |
|
3418 |
] ifFalse:[ |
|
3419 |
self replaceString:(aString copyFrom:i1) atLine:cursorLine col:cursorCol. |
|
3420 |
self cursorCol:(cursorCol + (aString size - i1 + 1)). |
|
3421 |
]. |
|
3422 |
i1 := i2. |
|
3423 |
] |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3424 |
] ifFalse:[ |
3160 | 3425 |
self replaceString:aString atLine:cursorLine col:cursorCol. |
3426 |
self cursorCol:(cursorCol + aString size). |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3427 |
]. |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3428 |
self makeCursorVisibleAndShowCursor:wasOn. |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3429 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3430 |
"Created: / 9.6.1998 / 20:33:20 / cg" |
1597
5fdcfcedb91c
fixed cursor positioning after replaceStringAtCursor.
Claus Gittinger <cg@exept.de>
parents:
1596
diff
changeset
|
3431 |
"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
|
3432 |
! |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3433 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3434 |
replaceTABAtCursor |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3435 |
"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
|
3436 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3437 |
|wasOn nextTab| |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3438 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3439 |
wasOn := self hideCursor. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3440 |
nextTab := self nextTabAfter:cursorCol. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3441 |
self replaceStringAtCursor:(String new:(nextTab - cursorCol)). |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3442 |
self makeCursorVisibleAndShowCursor:wasOn. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3443 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3444 |
"Created: / 12.6.1998 / 21:53:23 / cg" |
3890 | 3445 |
! |
3446 |
||
4256
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3447 |
selectWordBeforeCursor |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3448 |
"select the word to the left of cursor" |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3449 |
|
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3450 |
|savCursorLine savCursorCol beginCol beginLine endCol endLine| |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3451 |
|
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3452 |
savCursorLine := cursorLine. |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3453 |
savCursorCol := cursorCol. |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3454 |
|
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3455 |
endCol := cursorCol-1. |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3456 |
endLine := cursorLine. |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3457 |
self cursorToPreviousWord. |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3458 |
beginCol := cursorCol. |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3459 |
beginLine := cursorLine. |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3460 |
self cursorLine:savCursorLine col:savCursorCol. |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3461 |
self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3462 |
|
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3463 |
"Created: / 14-06-2011 / 14:46:35 / cg" |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3464 |
! |
1e4bdc48136c
added: #selectWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
4253
diff
changeset
|
3465 |
|
3890 | 3466 |
wrapLines |
3467 |
"wrap lines (insert line-break)" |
|
3468 |
||
3469 |
|lineLength answerString string| |
|
3470 |
||
3471 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
3472 |
||
3473 |
self hasSelection ifFalse:[ |
|
3474 |
self selectLine:cursorLine. |
|
3475 |
]. |
|
3476 |
string := self selectionAsString. |
|
3477 |
string isEmptyOrNil ifTrue:[ |
|
3478 |
Dialog information:(resources string:'Nothing selected.'). |
|
3479 |
^ self. |
|
3480 |
]. |
|
3481 |
||
3482 |
answerString := Dialog request:(resources string:'Line length (wrap after how many chars)?') initialAnswer:80. |
|
3483 |
lineLength := Number readFrom:answerString onError:nil. |
|
3484 |
lineLength < 1 ifTrue:[ |
|
3485 |
lineLength := 1. |
|
3486 |
]. |
|
3487 |
||
3488 |
self |
|
3489 |
undoableDo:[ |
|
3490 |
|inStream line col lineLen lastGoodCol lastStartCol word| |
|
3491 |
||
3492 |
line := selectionStartLine. |
|
3493 |
col := selectionStartCol. |
|
3494 |
||
3495 |
self cutSelection. |
|
3496 |
self cursorLine:line col:col. |
|
3497 |
||
3498 |
lastGoodCol := col. |
|
3499 |
||
3500 |
inStream := string readStream. |
|
3501 |
[ inStream atEnd ] whileFalse:[ |
|
3502 |
[inStream atEnd not and:[inStream peek isSeparator]] whileTrue:[ inStream next ]. |
|
3503 |
word := WriteStream on:(String new:10). |
|
3504 |
[inStream atEnd not and:[inStream peek isSeparator not]] whileTrue:[ word nextPut:inStream next ]. |
|
3505 |
(col + 1 + word size > lineLength) ifTrue:[ |
|
3506 |
self insertCharAtCursor:(Character cr). |
|
3507 |
col := 1. |
|
3508 |
] ifFalse:[ |
|
3509 |
col ~~ 1 ifTrue:[ |
|
3510 |
self insertStringAtCursor:' '. |
|
3511 |
col := col + 1. |
|
3512 |
] |
|
3513 |
]. |
|
3514 |
self insertStringAtCursor:word contents. |
|
3515 |
col := col + word size. |
|
3516 |
]. |
|
3517 |
] |
|
3518 |
info:'Wrap' |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3519 |
! ! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3520 |
|
2752 | 3521 |
!EditTextView methodsFor:'editing-basic'! |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3522 |
|
2952 | 3523 |
basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol |
3549 | 3524 |
"delete characters from startCol to endCol in line lineNr" |
3525 |
||
1803
ac7cc1b99407
scroll left as required, if deleting characters of the longest line,
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
3526 |
|line lineSize newLine start stop prevWidth newWidth| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3527 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3528 |
line := self listAt:lineNr. |
827 | 3529 |
|
3160 | 3530 |
(self checkModificationsAllowed and:[line notNil]) ifTrue:[ |
4190 | 3531 |
lineSize := line size. |
3532 |
||
3533 |
startCol == 0 ifFalse:[ start := startCol ] |
|
3534 |
ifTrue:[ start := 1 ]. |
|
3535 |
||
3536 |
endCol > lineSize ifFalse:[ stop := endCol ] |
|
3537 |
ifTrue:[ stop := lineSize ]. |
|
3538 |
||
3539 |
stop >= start ifTrue:[ |
|
3540 |
start ~~ 1 ifTrue:[ newLine := line copyFrom:1 to:(start-1) ] |
|
3541 |
ifFalse:[ newLine := '' ]. |
|
3542 |
||
3543 |
stop == lineSize ifFalse:[ |
|
3544 |
line bitsPerCharacter > newLine bitsPerCharacter ifTrue:[ |
|
3545 |
newLine := line string species fromString:newLine. |
|
3546 |
]. |
|
3547 |
newLine := newLine, (line copyFrom:(stop + 1) to:lineSize) |
|
3548 |
]. |
|
3549 |
||
3550 |
(trimBlankLines and:[newLine isBlank]) ifTrue:[ |
|
3551 |
newLine := nil |
|
3552 |
]. |
|
3553 |
||
3554 |
prevWidth := self widthOfLine:lineNr. |
|
3555 |
||
3556 |
list at:lineNr put:newLine. |
|
3557 |
||
3558 |
(prevWidth = widthOfWidestLine) ifTrue:[ |
|
3559 |
"/ remember old width of this line, |
|
3560 |
"/ only clear widthOfWidestLine, if this lines |
|
3561 |
"/ length was (one of) the longest. |
|
3562 |
"/ avoids slow delete with huge texts. |
|
3563 |
widthOfWidestLine := nil. "i.e. unknown" |
|
3564 |
||
3565 |
"/ scroll left if reqiured |
|
3566 |
viewOrigin x > 0 ifTrue:[ |
|
3567 |
newWidth := self widthOfLine:lineNr. |
|
3568 |
newWidth < (viewOrigin x + width) ifTrue:[ |
|
3569 |
self scrollHorizontalTo:(newWidth |
|
3570 |
- width |
|
3571 |
+ margin + margin |
|
3572 |
+ (font widthOf:' ')) |
|
3573 |
] |
|
3574 |
]. |
|
3575 |
self textChanged. |
|
3576 |
] ifFalse:[ |
|
3577 |
self textChanged "/ textChangedButNoSizeChange |
|
3578 |
]. |
|
3579 |
font hasOverlappingCharacters ifTrue:[ |
|
3580 |
self invalidateLine:lineNr. |
|
3581 |
] ifFalse:[ |
|
3582 |
self redrawLine:lineNr from:start. |
|
3583 |
]. |
|
3584 |
] |
|
827 | 3585 |
] |
3586 |
||
4191 | 3587 |
"Modified: / 09-11-2010 / 13:42:45 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3588 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3589 |
|
2952 | 3590 |
basicDeleteFromLine:startLineNr toLine:endLineNr |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3591 |
"delete some lines" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3592 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3593 |
|wasOn nLines| |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3594 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3595 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3596 |
list isNil ifTrue:[^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3597 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3598 |
wasOn := self hideCursor. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3599 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3600 |
"/ isnt this the same as: |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3601 |
"/ self deleteLinesWithoutRedrawFrom:startLineNr to:endLineNr. |
4226 | 3602 |
startLineNr <= list size ifTrue:[ |
3603 |
list removeFromIndex:startLineNr toIndex:(endLineNr min:list size). |
|
3604 |
]. |
|
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3605 |
"/ TODO: remember old maxwidth of linerange, |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3606 |
"/ only clear widthOfWidestLine, if this max |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3607 |
"/ length was (one of) the longest. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3608 |
"/ avoids slow delete with huge texts. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3609 |
widthOfWidestLine := nil. "/ i.e. unknown |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3610 |
self textChanged. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3611 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3612 |
self redrawFromLine:startLineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3613 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3614 |
nLines := list size. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3615 |
(firstLineShown >= nLines) ifTrue:[ |
4226 | 3616 |
self makeLineVisible:nLines |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3617 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3618 |
wasOn ifTrue:[self showCursor]. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3619 |
|
4226 | 3620 |
"Modified: / 10-11-1998 / 23:55:05 / cg" |
3621 |
"Modified: / 18-03-2011 / 18:26:23 / az" |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3622 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3623 |
|
2952 | 3624 |
basicDeleteLineWithoutRedraw:lineNr |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3625 |
"delete line - no redraw; |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3626 |
return true, if something was really deleted" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3627 |
|
2952 | 3628 |
self checkModificationsAllowed ifFalse:[ ^ false]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3629 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3630 |
(list isNil or:[lineNr > list size]) ifTrue:[^ false]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3631 |
list removeIndex:lineNr. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3632 |
"/ TODO: remember old maxwidth of linerange, |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3633 |
"/ only clear widthOfWidestLine, if this max |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3634 |
"/ length was (one of) the longest. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3635 |
"/ avoids slow delete with huge texts. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3636 |
widthOfWidestLine := nil. "/ i.e. unknown |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3637 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3638 |
^ true |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3639 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3640 |
"Modified: / 10.11.1998 / 23:53:24 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3641 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3642 |
|
2952 | 3643 |
basicInsert:aCharacter atLine:lineNr col:colNr |
3160 | 3644 |
"insert a single character at lineNr/colNr; |
827 | 3645 |
set emphasis to character at current position" |
3646 |
||
1929
8e70fb7c9701
fixed handling of italic text when inserting
Claus Gittinger <cg@exept.de>
parents:
1928
diff
changeset
|
3647 |
|line lineSize newLine drawCharacterOnly attribute oldClip x y| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3648 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3649 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3650 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3651 |
aCharacter == (Character cr) ifTrue:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3652 |
self splitLine:lineNr before:colNr. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3653 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3654 |
]. |
827 | 3655 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3656 |
drawCharacterOnly := false. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3657 |
self checkForExistingLine:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3658 |
line := list at:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3659 |
lineSize := line size. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3660 |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
3661 |
self st80EditMode ifFalse:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3662 |
(trimBlankLines |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3663 |
and:[colNr > lineSize |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3664 |
and:[aCharacter == Character space]]) ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3665 |
^ self |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3666 |
] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3667 |
]. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3668 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3669 |
(lineSize == 0) ifTrue:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3670 |
newLine := aCharacter asString species new:colNr. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3671 |
drawCharacterOnly := true |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3672 |
] ifFalse: [ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3673 |
(colNr > lineSize) ifTrue: [ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3674 |
colNr == (lineSize +1) ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3675 |
attribute := line emphasisAt:lineSize |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3676 |
]. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3677 |
newLine := line species new:colNr. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3678 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3679 |
drawCharacterOnly := true |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3680 |
] ifFalse: [ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3681 |
attribute := line emphasisAt:colNr. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3682 |
newLine := line species new:(lineSize + 1). |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3683 |
|
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3684 |
newLine replaceFrom:1 to:(colNr - 1) with:line startingAt:1. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3685 |
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
|
3686 |
] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3687 |
]. |
827 | 3688 |
|
2869
48d830f0aea5
insertCharacter: care for wide chars
Claus Gittinger <cg@exept.de>
parents:
2866
diff
changeset
|
3689 |
aCharacter asString bitsPerCharacter > newLine bitsPerCharacter ifTrue:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3690 |
newLine := aCharacter asString species fromString:newLine. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3691 |
line isText ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3692 |
newLine := newLine asText |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3693 |
] |
2869
48d830f0aea5
insertCharacter: care for wide chars
Claus Gittinger <cg@exept.de>
parents:
2866
diff
changeset
|
3694 |
]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3695 |
newLine at:colNr put:aCharacter. |
827 | 3696 |
|
3697 |
attribute notNil ifTrue:[ |
|
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3698 |
newLine emphasisAt:colNr put:attribute. |
827 | 3699 |
]. |
3700 |
||
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3701 |
aCharacter == (Character tab) ifTrue:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3702 |
newLine := self withTabsExpanded:newLine. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3703 |
drawCharacterOnly := false |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3704 |
]. |
827 | 3705 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3706 |
list at:lineNr put:newLine. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3707 |
widthOfWidestLine notNil ifTrue:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3708 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3709 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3710 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3711 |
shown ifTrue:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3712 |
"/ care for italic text - in this case, we must also |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3713 |
"/ redraw the character before the insertion in order |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3714 |
"/ to fix the slanted piece of the character. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3715 |
"/ (but we must clip, to avoid destoying the character before) |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3716 |
(newLine notNil and:[newLine isText]) ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3717 |
colNr > 1 ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3718 |
cursorVisibleLine notNil ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3719 |
oldClip := self clippingRectangleOrNil. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3720 |
x := (self xOfCol:colNr-1 inVisibleLine:cursorVisibleLine) - viewOrigin x. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3721 |
y := self yOfVisibleLine:cursorVisibleLine. |
4190 | 3722 |
|
3723 |
font hasOverlappingCharacters ifTrue:[ |
|
3724 |
self invalidateLine:lineNr. |
|
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3725 |
] ifFalse:[ |
4190 | 3726 |
drawCharacterOnly ifTrue:[ |
3727 |
self clippingRectangle:(x@y extent:((font width * 2) @ fontHeight)). |
|
3728 |
self redrawLine:lineNr from:colNr-1 to:colNr |
|
3729 |
] ifFalse:[ |
|
3730 |
self clippingRectangle:(x@y extent:((width - x) @ fontHeight)). |
|
3731 |
self redrawLine:lineNr from:colNr-1 |
|
3732 |
]. |
|
3733 |
self clippingRectangle:oldClip. |
|
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3734 |
]. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3735 |
]. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3736 |
^ self. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3737 |
]. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3738 |
]. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3739 |
font hasOverlappingCharacters ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3740 |
self invalidateLine:lineNr. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3741 |
] ifFalse:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3742 |
drawCharacterOnly ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3743 |
self redrawLine:lineNr col:colNr |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3744 |
] ifFalse:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3745 |
self redrawLine:lineNr from:colNr |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3746 |
] |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3747 |
] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3748 |
] |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3749 |
|
4191 | 3750 |
"Modified: / 09-11-2010 / 13:43:18 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3751 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3752 |
|
2952 | 3753 |
basicMergeLine:lineNr removeBlanks:removeBlanks |
1319 | 3754 |
"merge line lineNr with line lineNr+1" |
3755 |
||
827 | 3756 |
|leftPart rightPart bothParts nextLineNr i| |
3757 |
||
2356
6416beb0f23a
backSpace if behond end of text.
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3758 |
(list notNil and:[(list size) >= lineNr]) ifFalse:[ |
3160 | 3759 |
"/ empty list or beyond end of text |
3760 |
^ self |
|
827 | 3761 |
]. |
3762 |
leftPart := self listAt:lineNr. |
|
3763 |
||
3764 |
leftPart isNil ifTrue:[ |
|
3160 | 3765 |
leftPart := ''. |
3766 |
autoIndent ifTrue:[ |
|
3767 |
(i := self leftIndentForLine:cursorLine) == 0 ifFalse:[ |
|
3768 |
leftPart := String new:i |
|
3769 |
] |
|
3770 |
] |
|
827 | 3771 |
]. |
3772 |
self cursorLine:lineNr col:((leftPart size) + 1). |
|
3773 |
nextLineNr := self validateCursorLine:(lineNr + 1). |
|
3774 |
||
3775 |
nextLineNr > (list size) ifFalse:[ |
|
3160 | 3776 |
(rightPart := self listAt:nextLineNr) isNil ifTrue:[ |
3777 |
rightPart := '' |
|
3778 |
] ifFalse:[ |
|
3779 |
removeBlanks ifTrue:[ |
|
3780 |
rightPart := rightPart withoutLeadingSeparators. |
|
3781 |
] |
|
3782 |
]. |
|
3783 |
||
3784 |
bothParts := leftPart , rightPart. |
|
3785 |
(trimBlankLines and:[bothParts isBlank]) ifTrue:[bothParts := nil]. |
|
3786 |
list at:lineNr put:bothParts. |
|
3787 |
self redrawLine:lineNr. |
|
3788 |
self deleteLine:nextLineNr |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3789 |
] |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3790 |
|
1319 | 3791 |
"Created: 9.9.1997 / 09:27:38 / cg" |
3792 |
"Modified: 9.9.1997 / 09:28:27 / cg" |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3793 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3794 |
|
2952 | 3795 |
basicReplace:aCharacter atLine:lineNr col:colNr |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3796 |
"replace a single character at lineNr/colNr" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3797 |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3798 |
|line lineSize newLine drawCharacterOnly| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3799 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3800 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3801 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3802 |
aCharacter == (Character cr) ifTrue:[ |
4190 | 3803 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3804 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3805 |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3806 |
drawCharacterOnly := true. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3807 |
self checkForExistingLine:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3808 |
line := list at:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3809 |
lineSize := line size. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3810 |
|
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3811 |
(trimBlankLines |
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3812 |
and:[colNr > lineSize |
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3813 |
and:[aCharacter == Character space]]) ifTrue:[ |
4190 | 3814 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3815 |
]. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3816 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3817 |
(lineSize == 0) ifTrue:[ |
4190 | 3818 |
newLine := aCharacter asString species new:colNr. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3819 |
] ifFalse: [ |
4190 | 3820 |
(colNr > lineSize) ifTrue: [ |
3821 |
newLine := line species new:colNr. |
|
3822 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
|
3823 |
] ifFalse: [ |
|
3824 |
newLine := line copy. |
|
3825 |
] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3826 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3827 |
newLine at:colNr put:aCharacter. |
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3828 |
aCharacter == (Character tab) ifTrue:[ |
4190 | 3829 |
newLine := self withTabsExpanded:newLine. |
3830 |
drawCharacterOnly := false |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3831 |
]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3832 |
list at:lineNr put:newLine. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3833 |
widthOfWidestLine notNil ifTrue:[ |
4190 | 3834 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3835 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3836 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3837 |
shown ifTrue:[ |
4190 | 3838 |
font hasOverlappingCharacters ifTrue:[ |
3839 |
self invalidateLine:lineNr. |
|
3840 |
] ifFalse:[ |
|
3841 |
drawCharacterOnly ifTrue:[ |
|
3842 |
self redrawLine:lineNr col:colNr |
|
3843 |
] ifFalse:[ |
|
3844 |
self redrawLine:lineNr from:colNr |
|
3845 |
] |
|
3846 |
] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3847 |
] |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3848 |
|
4190 | 3849 |
"Created: / 06-03-1996 / 12:29:20 / cg" |
4191 | 3850 |
"Modified: / 09-11-2010 / 13:42:54 / cg" |
105 | 3851 |
! |
3852 |
||
3235 | 3853 |
basicReplaceString:aString atLine:lineNr col:colNr |
3854 |
"replace multiple characters starting at lineNr/colNr. |
|
3855 |
This is not prepared to encounter special chars (except TAB) |
|
3856 |
in the string." |
|
3857 |
||
3858 |
|line lineSize newLine endCol| |
|
3859 |
||
3860 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
3861 |
||
3862 |
self checkForExistingLine:lineNr. |
|
3863 |
line := list at:lineNr. |
|
3864 |
lineSize := line size. |
|
3865 |
||
3866 |
endCol := colNr + aString size - 1. |
|
3867 |
(lineSize == 0) ifTrue:[ |
|
4190 | 3868 |
newLine := aString species new:endCol. |
3235 | 3869 |
] ifFalse: [ |
4190 | 3870 |
(endCol > lineSize) ifTrue: [ |
3871 |
aString isText ifTrue:[ |
|
3872 |
newLine := aString species new:endCol. |
|
3873 |
] ifFalse:[ |
|
3874 |
newLine := line species new:endCol. |
|
3875 |
]. |
|
3876 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
|
3877 |
] ifFalse: [ |
|
3878 |
aString isText ifTrue:[ |
|
3879 |
newLine := aString species new:line size. |
|
3880 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
|
3881 |
] ifFalse:[ |
|
3882 |
newLine := line copy. |
|
3883 |
] |
|
3884 |
] |
|
3235 | 3885 |
]. |
3886 |
newLine replaceFrom:colNr with:aString. |
|
3887 |
(aString includes:(Character tab)) ifTrue:[ |
|
4190 | 3888 |
newLine := self withTabsExpanded:newLine. |
3235 | 3889 |
]. |
3890 |
list at:lineNr put:newLine. |
|
3891 |
widthOfWidestLine notNil ifTrue:[ |
|
4190 | 3892 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
3235 | 3893 |
]. |
3894 |
self textChanged. |
|
3895 |
shown ifTrue:[ |
|
4190 | 3896 |
font hasOverlappingCharacters ifTrue:[ |
3897 |
self invalidateLine:lineNr. |
|
3898 |
] ifFalse:[ |
|
3899 |
self redrawLine:lineNr from:colNr |
|
3900 |
] |
|
3235 | 3901 |
] |
3902 |
||
4190 | 3903 |
"Created: / 11-06-1998 / 10:38:32 / cg" |
4191 | 3904 |
"Modified: / 09-11-2010 / 13:42:56 / cg" |
3235 | 3905 |
! |
3906 |
||
2952 | 3907 |
basicSplitLine:lineNr before:colNr |
3908 |
"split the line linNr before colNr; the right part (from colNr) |
|
3909 |
is cut off and inserted after lineNr; the view is redrawn" |
|
3910 |
||
3160 | 3911 |
|line lineSize leftRest rightRest visLine w h mustWait |
2952 | 3912 |
srcY "{ Class: SmallInteger }" | |
3913 |
||
3027 | 3914 |
list isNil ifTrue:[ ^ self ]. |
3915 |
lineNr > (list size) ifTrue:[ ^ self ]. |
|
3916 |
||
3917 |
(colNr == 1) ifTrue:[ |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3918 |
self nonUndoableDo:[ |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3919 |
self insertLine:nil before:lineNr. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3920 |
]. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3921 |
^ self |
3027 | 3922 |
]. |
3923 |
||
3924 |
line := list at:lineNr. |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3925 |
line notNil ifTrue:[ |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3926 |
lineSize := line size. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3927 |
(colNr <= lineSize) ifTrue:[ |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3928 |
rightRest := line copyFrom:colNr to:lineSize. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3929 |
(colNr > 1) ifTrue:[ |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3930 |
leftRest := line copyTo:(colNr - 1) |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3931 |
] |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3932 |
] ifFalse:[ |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3933 |
leftRest := line |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3934 |
] |
3027 | 3935 |
]. |
3936 |
leftRest notNil ifTrue:[ |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3937 |
(trimBlankLines and:[leftRest isBlank]) ifTrue:[leftRest := nil] |
3027 | 3938 |
]. |
3939 |
list at:lineNr put:leftRest. |
|
3940 |
self nonUndoableDo:[ |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3941 |
self withoutRedrawInsertLine:rightRest before:(lineNr + 1). |
3027 | 3942 |
]. |
3943 |
visLine := self listLineToVisibleLine:(lineNr). |
|
3944 |
visLine notNil ifTrue:[ |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3945 |
w := self widthForScrollBetween:lineNr |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3946 |
and:(firstLineShown + nLinesShown). |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3947 |
srcY := topMargin + (visLine * fontHeight). |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3948 |
h := ((nLinesShown - visLine - 1) * fontHeight). |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3949 |
(mustWait := (w > 0 and:[h > 0])) ifTrue:[ |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3950 |
self catchExpose. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3951 |
self |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3952 |
copyFrom:self |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3953 |
x:textStartLeft y:srcY |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3954 |
toX:textStartLeft y:(srcY + fontHeight) |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3955 |
width:w |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3956 |
height:((nLinesShown - visLine - 1) * fontHeight) |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3957 |
async:true. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3958 |
]. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3959 |
self redrawLine:lineNr. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3960 |
self redrawLine:(lineNr + 1). |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3961 |
mustWait ifTrue:[self waitForExpose] |
3027 | 3962 |
]. |
3963 |
widthOfWidestLine := nil. "/ unknown |
|
3964 |
self textChanged. |
|
2952 | 3965 |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3966 |
"Modified: / 06-12-2010 / 13:12:55 / cg" |
2952 | 3967 |
! |
3968 |
||
3969 |
basicWithoutRedrawInsertLine:aString before:lineNr |
|
3970 |
"insert the argument, aString before line lineNr; the string |
|
3971 |
becomes line nileNr; everything else is moved down; the view |
|
3972 |
is not redrawn" |
|
3973 |
||
3974 |
|line| |
|
3975 |
||
3976 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
3977 |
||
3978 |
line := aString. |
|
3979 |
line notNil ifTrue:[ |
|
3160 | 3980 |
line isString ifTrue:[ |
3981 |
line isBlank ifTrue:[ |
|
3982 |
line := nil |
|
3983 |
] ifFalse:[ |
|
3984 |
(line includes:(Character tab)) ifTrue:[ |
|
3985 |
line := self withTabsExpanded:line |
|
3986 |
] |
|
3987 |
] |
|
3988 |
] |
|
2952 | 3989 |
]. |
3990 |
list isNil ifTrue: [ |
|
3160 | 3991 |
list := StringCollection new:lineNr |
2952 | 3992 |
] ifFalse: [ |
3160 | 3993 |
list grow:((list size + 1) max:lineNr) |
3994 |
]. |
|
3995 |
||
3996 |
"I have changed 'replaceFrom:to:with:startingAt:' to correctly handle |
|
2952 | 3997 |
overlapping copy - if it didn't, we had to use:" |
3998 |
" |
|
3999 |
index := list size. |
|
4000 |
[index > lineNr] whileTrue: [ |
|
3160 | 4001 |
pIndex := index - 1. |
4002 |
list at:index put:(list at:pIndex). |
|
4003 |
index := pIndex |
|
2952 | 4004 |
]. |
4005 |
" |
|
4006 |
list replaceFrom:(lineNr + 1) to:(list size) with:list startingAt:lineNr. |
|
4007 |
list at:lineNr put:line. |
|
4008 |
self contentsChanged |
|
4009 |
||
4010 |
"Modified: / 10.6.1998 / 19:00:56 / cg" |
|
4011 |
! |
|
4012 |
||
2954 | 4013 |
basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr |
4328 | 4014 |
"insert a bunch of lines before line lineNr; the view is not redrawn. |
4015 |
Tabs are expanded here with a tab=8 setting (independent of any editor-setting, |
|
4016 |
because the text might have been pasted from an alien view." |
|
2954 | 4017 |
|
4018 |
|newLine newLines nLines| |
|
4019 |
||
4020 |
nLines := end - start + 1. |
|
4021 |
newLines := Array new:(lines size). |
|
4022 |
start to:end do:[:index | |
|
4328 | 4023 |
newLine := lines at:index. |
4024 |
newLine notNil ifTrue:[ |
|
4025 |
newLine isString ifTrue:[ |
|
4026 |
newLine isBlank ifTrue:[ |
|
4027 |
newLine := nil |
|
4028 |
] ifFalse:[ |
|
4029 |
(newLine includes:(Character tab)) ifTrue:[ |
|
4030 |
newLine := self withTabs:(ListView tab8Positions) expand:newLine |
|
4031 |
] |
|
4032 |
] |
|
4033 |
] |
|
4034 |
]. |
|
4035 |
newLines at:index put:newLine |
|
2954 | 4036 |
]. |
4037 |
list isNil ifTrue: [ |
|
4328 | 4038 |
list := StringCollection new:(lineNr + nLines + 1) |
2954 | 4039 |
] ifFalse: [ |
4328 | 4040 |
list grow:((list size + nLines) max:(lineNr + nLines - 1)) |
3160 | 4041 |
]. |
4042 |
||
4043 |
"I have changed 'replaceFrom:to:with:startingAt:' to correctly handle |
|
2954 | 4044 |
overlapping copy - if it didn't, we had to use:" |
4045 |
" |
|
4046 |
index := list size. |
|
4047 |
[index > lineNr] whileTrue: [ |
|
4328 | 4048 |
pIndex := index - 1. |
4049 |
list at:index put:(list at:pIndex). |
|
4050 |
index := pIndex |
|
2954 | 4051 |
]. |
4052 |
" |
|
4053 |
list replaceFrom:(lineNr + nLines) to:(list size) with:list startingAt:lineNr. |
|
4054 |
list replaceFrom:lineNr to:(lineNr + nLines - 1) with:newLines startingAt:start. |
|
4055 |
self contentsChanged |
|
4056 |
||
4328 | 4057 |
"Modified: / 07-10-2011 / 15:55:18 / cg" |
2954 | 4058 |
! |
4059 |
||
4060 |
basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr |
|
4328 | 4061 |
"insert aString (which has no crs) at lineNr/colNr. |
4062 |
Tabs are expanded here with a tab=8 setting (independent of any editor-setting, |
|
4063 |
because the text might have been pasted from an alien view." |
|
2954 | 4064 |
|
4065 |
|isText strLen line lineSize newLine stringType sz| |
|
4066 |
||
4067 |
(aString notNil) ifFalse:[ ^ self]. |
|
4068 |
||
4069 |
strLen := aString size. |
|
4070 |
self checkForExistingLine:lineNr. |
|
4071 |
||
4072 |
stringType := aString string species. |
|
4073 |
isText := aString isText. |
|
4074 |
line := list at:lineNr. |
|
4075 |
||
4076 |
line notNil ifTrue:[ |
|
4328 | 4077 |
lineSize := line size. |
4078 |
line isString ifFalse:[ |
|
4079 |
stringType := line species |
|
4080 |
] ifTrue:[ |
|
4081 |
line bitsPerCharacter > aString bitsPerCharacter ifTrue:[ |
|
4082 |
stringType := line string species |
|
4083 |
]. |
|
4084 |
line isText ifTrue:[ isText := true ] |
|
4085 |
]. |
|
2954 | 4086 |
] ifFalse:[ |
4328 | 4087 |
lineSize := 0 |
2954 | 4088 |
]. |
4089 |
||
4090 |
((colNr == 1) and:[lineSize == 0]) ifTrue: [ |
|
4328 | 4091 |
newLine := aString |
2954 | 4092 |
] ifFalse:[ |
4328 | 4093 |
(lineSize == 0 or:[colNr > lineSize]) ifTrue: [ |
4094 |
sz := colNr + strLen - 1 |
|
4095 |
] ifFalse:[ |
|
4096 |
sz := lineSize + strLen |
|
4097 |
]. |
|
4098 |
||
4099 |
isText ifFalse:[ |
|
4100 |
newLine := stringType new:sz |
|
4101 |
] ifTrue:[ |
|
4102 |
newLine := Text string:(stringType new:sz) |
|
4103 |
]. |
|
4104 |
||
4105 |
(lineSize ~~ 0) ifTrue: [ |
|
4106 |
(colNr > lineSize) ifTrue: [ |
|
4107 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1 |
|
4108 |
] ifFalse: [ |
|
4109 |
newLine replaceFrom:1 to:(colNr - 1) with:line startingAt:1. |
|
4110 |
newLine replaceFrom:(colNr + strLen) to:(lineSize + strLen) with:line startingAt:colNr |
|
4111 |
] |
|
4112 |
]. |
|
4113 |
newLine replaceFrom:(colNr max:1) to:(colNr + strLen - 1) with:aString startingAt:1 |
|
2954 | 4114 |
]. |
4115 |
||
4116 |
(aString includes:(Character tab)) ifTrue:[ |
|
4328 | 4117 |
newLine := self withTabs:(ListView tab8Positions) expand:newLine |
2954 | 4118 |
]. |
4119 |
||
4120 |
list at:lineNr put:newLine. |
|
4121 |
widthOfWidestLine notNil ifTrue:[ |
|
4328 | 4122 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:newLine). |
2954 | 4123 |
]. |
4124 |
self textChanged. |
|
4125 |
||
4328 | 4126 |
"Modified: / 07-10-2011 / 15:44:56 / cg" |
2954 | 4127 |
! |
4128 |
||
2952 | 4129 |
deleteCharsAtLine:lineNr fromCol:startCol toCol:endCol |
3549 | 4130 |
"delete characters from startCol to endCol in line lineNr" |
4131 |
||
2952 | 4132 |
|deleted| |
4133 |
||
4134 |
deleted := self textFromLine:lineNr col:startCol toLine:lineNr col:endCol. |
|
4135 |
self basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol. |
|
3115 | 4136 |
self addUndo:(PasteString line:lineNr col:startCol string:deleted info:'delete'). |
2952 | 4137 |
! |
4138 |
||
4139 |
deleteFromLine:startLineNr toLine:endLineNr |
|
4140 |
"delete some lines" |
|
4141 |
||
4142 |
|deleted| |
|
4143 |
||
4144 |
deleted := self textFromLine:startLineNr col:1 toLine:endLineNr+1 col:0. |
|
4145 |
self basicDeleteFromLine:startLineNr toLine:endLineNr. |
|
3115 | 4146 |
self addUndo:(PasteString line:startLineNr col:1 string:deleted info:'delete'). |
2952 | 4147 |
! |
4148 |
||
4149 |
deleteLineWithoutRedraw:lineNr |
|
4150 |
"delete line - no redraw; |
|
4151 |
return true, if something was really deleted" |
|
4152 |
||
4153 |
|deleted ret| |
|
4154 |
||
4155 |
deleted := self textFromLine:lineNr col:1 toLine:lineNr+1 col:0. |
|
4156 |
ret := self basicDeleteLineWithoutRedraw:lineNr. |
|
3115 | 4157 |
self addUndo:(PasteString line:lineNr col:1 string:deleted info:'delete'). |
2952 | 4158 |
^ ret. |
4159 |
! |
|
4160 |
||
4161 |
insert:aCharacter atLine:lineNr col:colNr |
|
3160 | 4162 |
"insert a single character at lineNr/colNr; |
2952 | 4163 |
set emphasis to character at current position" |
4164 |
||
4165 |
self basicInsert:aCharacter atLine:lineNr col:colNr. |
|
4166 |
aCharacter ~~ Character cr ifTrue:[ |
|
3160 | 4167 |
self addUndo:(DeleteCharacters line:lineNr col:colNr info:'insert'). |
2952 | 4168 |
] |
4169 |
! |
|
4170 |
||
4171 |
insertLines:someText from:start to:end before:lineNr |
|
4172 |
"insert a bunch of lines before line lineNr" |
|
4173 |
||
2954 | 4174 |
|text indent visLine w nLines "{ Class: SmallInteger }" |
4175 |
srcY "{ Class: SmallInteger }" |
|
4176 |
dstY "{ Class: SmallInteger }" | |
|
4177 |
||
4178 |
autoIndent ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4179 |
indent := self leftIndentForLine:lineNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4180 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4181 |
text := someText collect:[:ln||line| |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4182 |
ln notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4183 |
line := ln withoutLeadingSeparators. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4184 |
(line isEmpty or:[indent == 0]) ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4185 |
line := (String new:indent), line |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4186 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4187 |
line |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4188 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4189 |
nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4190 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4191 |
]. |
2954 | 4192 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4193 |
text := someText |
2954 | 4194 |
]. |
4195 |
||
4196 |
visLine := self listLineToVisibleLine:lineNr. |
|
4197 |
(shown not or:[visLine isNil]) ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4198 |
self withoutRedrawInsertLines:text |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4199 |
from:start to:end |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4200 |
before:lineNr. |
2954 | 4201 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4202 |
nLines := end - start + 1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4203 |
((visLine + nLines) >= nLinesShown) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4204 |
self withoutRedrawInsertLines:text |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4205 |
from:start to:end |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4206 |
before:lineNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4207 |
self redrawFromVisibleLine:visLine to:nLinesShown |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4208 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4209 |
w := self widthForScrollBetween:(lineNr + nLines) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4210 |
and:(firstLineShown + nLines + nLinesShown). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4211 |
srcY := topMargin + ((visLine - 1) * fontHeight). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4212 |
dstY := srcY + (nLines * fontHeight). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4213 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4214 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4215 |
"/ scroll ... |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4216 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4217 |
" |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4218 |
stupid: must catchExpose before inserting new |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4219 |
stuff - since catchExpose may perform redraws |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4220 |
" |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4221 |
self catchExpose. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4222 |
self withoutRedrawInsertLines:text |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4223 |
from:start to:end |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4224 |
before:lineNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4225 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4226 |
copyFrom:self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4227 |
x:textStartLeft y:srcY |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4228 |
toX:textStartLeft y:dstY |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4229 |
width:w |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4230 |
height:(height - dstY) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4231 |
async:true. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4232 |
self redrawFromVisibleLine:visLine to:(visLine + nLines - 1). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4233 |
self waitForExpose |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4234 |
]. |
2954 | 4235 |
]. |
4236 |
widthOfWidestLine notNil ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4237 |
text do:[:line | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4238 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4239 |
] |
2954 | 4240 |
]. |
4241 |
self textChanged. |
|
4242 |
||
4243 |
"Modified: 29.1.1997 / 13:02:39 / cg" |
|
2952 | 4244 |
! |
4245 |
||
4246 |
mergeLine:lineNr removeBlanks:removeBlanks |
|
4247 |
"merge line lineNr with line lineNr+1" |
|
4248 |
||
4249 |
|len| |
|
4250 |
||
3583 | 4251 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
4252 |
||
2952 | 4253 |
len := (self listAt:lineNr) size. |
4254 |
self nonUndoableDo:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4255 |
self basicMergeLine:lineNr removeBlanks:removeBlanks. |
2952 | 4256 |
]. |
4257 |
self addUndo:(PasteString new line:lineNr col:len+1 string:(Character cr asString) selected:false). |
|
4258 |
! |
|
4259 |
||
4260 |
replace:aCharacter atLine:lineNr col:colNr |
|
4261 |
"replace a single character at lineNr/colNr" |
|
4262 |
||
4263 |
|originalChar| |
|
4264 |
||
4265 |
originalChar := self characterAtLine:lineNr col:colNr. |
|
4266 |
self basicReplace:aCharacter atLine:lineNr col:colNr. |
|
3235 | 4267 |
self addUndo:(ReplaceCharacters line:lineNr col:colNr character:originalChar info:'replace'). |
2952 | 4268 |
! |
4269 |
||
3131 | 4270 |
replaceContentsWith:newContents |
4271 |
"replace everything" |
|
4272 |
||
4273 |
|originalContents| |
|
4274 |
||
4275 |
originalContents := self contents. |
|
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
4276 |
self contents:newContents keepUndoHistory:true. |
3131 | 4277 |
self addUndo:(ReplaceContents text:originalContents info:'replace'). |
4278 |
! |
|
4279 |
||
3130 | 4280 |
replaceLine:lineNr with:newText |
4281 |
"replace a line at lineNr" |
|
4282 |
||
4283 |
|originalLine| |
|
4284 |
||
4285 |
originalLine := self listAt:lineNr. |
|
3479
5f9c6ff4fe6d
care for non-existing line when replacing (i.e. comment)
Claus Gittinger <cg@exept.de>
parents:
3476
diff
changeset
|
4286 |
originalLine isNil ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4287 |
self checkForExistingLine:lineNr |
3479
5f9c6ff4fe6d
care for non-existing line when replacing (i.e. comment)
Claus Gittinger <cg@exept.de>
parents:
3476
diff
changeset
|
4288 |
]. |
3130 | 4289 |
self list at:lineNr put:newText. |
4290 |
self addUndo:(ReplaceLine line:lineNr string:originalLine info:'replace'). |
|
4291 |
self invalidateLine:lineNr. |
|
3479
5f9c6ff4fe6d
care for non-existing line when replacing (i.e. comment)
Claus Gittinger <cg@exept.de>
parents:
3476
diff
changeset
|
4292 |
|
5f9c6ff4fe6d
care for non-existing line when replacing (i.e. comment)
Claus Gittinger <cg@exept.de>
parents:
3476
diff
changeset
|
4293 |
"Modified: / 12-04-2007 / 09:31:33 / cg" |
3130 | 4294 |
! |
4295 |
||
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
4296 |
replaceString:aString atLine:lineNr col:colNr |
1557 | 4297 |
"replace multiple characters starting at lineNr/colNr. |
3235 | 4298 |
This is not prepared to encounter special chars (except TAB) in the string." |
4299 |
||
4300 |
|originalString| |
|
1557 | 4301 |
|
4302 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
4303 |
||
3235 | 4304 |
originalString := self textFromLine:lineNr col:colNr toLine:lineNr col:colNr+aString size-1. |
4305 |
||
4306 |
self basicReplaceString:aString atLine:lineNr col:colNr. |
|
4307 |
self addUndo:(ReplaceCharacters line:lineNr col:colNr characters:originalString info:'replace'). |
|
1557 | 4308 |
! |
4309 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4310 |
splitLine:lineNr before:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4311 |
"split the line linNr before colNr; the right part (from colNr) |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4312 |
is cut off and inserted after lineNr; the view is redrawn" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4313 |
|
2952 | 4314 |
self basicSplitLine:lineNr before:colNr. |
3115 | 4315 |
self addUndo:(DeleteRange line1:lineNr col1:colNr line2:lineNr+1 col2:0 info:'split'). |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4316 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4317 |
|
3130 | 4318 |
withoutRedrawAt:lineNr put:aString |
4319 |
"replace a line at lineNr" |
|
4320 |
||
4321 |
|originalLine| |
|
4322 |
||
4323 |
originalLine := self listAt:lineNr. |
|
4324 |
self addUndo:(ReplaceLine line:lineNr string:originalLine info:'replace'). |
|
4325 |
super withoutRedrawAt:lineNr put:aString. |
|
4326 |
! |
|
4327 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4328 |
withoutRedrawInsertLine:aString before:lineNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4329 |
"insert the argument, aString before line lineNr; the string |
2954 | 4330 |
becomes line lineNr; everything else is moved down; the view |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4331 |
is not redrawn" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4332 |
|
2952 | 4333 |
self basicWithoutRedrawInsertLine:aString before:lineNr. |
3115 | 4334 |
self addUndo:(DeleteRange line1:lineNr col1:1 line2:lineNr+1 col2:0 info:'insert'). |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4335 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4336 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4337 |
withoutRedrawInsertLines:lines from:start to:end before:lineNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4338 |
"insert a bunch of lines before line lineNr; the view is not redrawn" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4339 |
|
2954 | 4340 |
self basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr. |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
4341 |
self isReadOnly ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4342 |
self addUndo:(DeleteRange line1:lineNr col1:1 line2:lineNr+end-start+1 col2:0 info:'insert'). |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
4343 |
]. |
121 | 4344 |
! |
4345 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4346 |
withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4347 |
"insert aString (which has no crs) at lineNr/colNr" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4348 |
|
2954 | 4349 |
self basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr. |
3115 | 4350 |
self addUndo:(DeleteRange line1:lineNr col1:colNr line2:lineNr col2:colNr+aString size-1 info:'insert'). |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4351 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4352 |
|
2752 | 4353 |
!EditTextView methodsFor:'event handling'! |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4354 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4355 |
buttonPress:button x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4356 |
"hide the cursor when button is activated" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4357 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4358 |
hasKeyboardFocus := true. |
2589 | 4359 |
dragIsActive := false. |
4360 |
||
1817
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
4361 |
cursorShown ifTrue: [ |
3915
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4362 |
self drawCursor |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4363 |
]. |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4364 |
|
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4365 |
(button == 1) ifTrue:[ |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4366 |
self hideCursor |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4367 |
]. |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4368 |
"/ 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
|
4369 |
"/ |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4370 |
"/ (button == #paste) ifTrue:[ |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4371 |
"/ self pasteOrReplace. |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4372 |
"/ ^ self |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4373 |
"/ ]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4374 |
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
|
4375 |
|
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
4376 |
"Modified: / 23.3.1999 / 13:51:40 / cg" |
121 | 4377 |
! |
4378 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4379 |
buttonRelease:button x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4380 |
"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
|
4381 |
|
3789
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4382 |
|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
|
4383 |
|
3915
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4384 |
(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
|
4385 |
typeOfSelection := nil. |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4386 |
|
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4387 |
dragIsActive ifTrue:[ |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4388 |
self unselect |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4389 |
]. |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4390 |
selectionStartLine isNil ifTrue:[ |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4391 |
clickCol notNil ifTrue:[ |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4392 |
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
|
4393 |
newCursorCol := clickCol. |
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4394 |
|
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4395 |
cursorType ~~ #block ifTrue:[ |
3790 | 4396 |
clickPos notNil ifTrue:[ |
4397 |
"/ we do something special, if the text-cursor's type is not a block-cursor |
|
4398 |
"/ (i.e. if its an ibeam). |
|
4399 |
"/ adjust clickCol if the user clicked in the right third of a character. |
|
4400 |
x1 := self xOfCol:clickCol inVisibleLine:clickLine. |
|
4401 |
x2 := self xOfCol:clickCol+1 inVisibleLine:clickLine. |
|
4402 |
x2_3 := x1 + ((x2-x1) * (2/3)). |
|
4403 |
(clickPos x >= x2_3) ifTrue:[ newCursorCol := clickCol+1 ]. |
|
4404 |
]. |
|
3789
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4405 |
]. |
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4406 |
self cursorLine:clickLine col:newCursorCol. |
3788
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4407 |
] |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4408 |
] |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4409 |
] ifFalse:[ |
4048 | 4410 |
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
|
4411 |
]. |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4412 |
self showCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4413 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4414 |
super buttonRelease:button x:x y:y |
1580
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
4415 |
|
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
4416 |
"Modified: / 18.6.1998 / 14:14:05 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4417 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4418 |
|
2580 | 4419 |
cursorKeyPress:key shifted:shifted |
2730
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
4420 |
|n| |
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
4421 |
|
2606
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
4422 |
self changeTypeOfSelectionTo:nil. |
2580 | 4423 |
|
4424 |
(key == #CursorRight) ifTrue:[ |
|
4100
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4425 |
(shifted and:[selectionStartLine isNil]) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4426 |
selectionStartLine := selectionEndLine := clickStartLine := cursorLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4427 |
selectionStartCol := selectionEndCol := clickStartCol := cursorCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4428 |
expandingTop := false. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4429 |
self validateNewSelection. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4430 |
self selectionChanged. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4431 |
self redrawLine:selectionStartLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4432 |
^ self. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4433 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4434 |
|
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4435 |
selectionStartLine notNil ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4436 |
self cursorMovementAllowed ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4437 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4438 |
"/ treat the whole selection as cursor |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4439 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4440 |
self setCursorLine:(selectionEndLine ? selectionStartLine). |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4441 |
selectionEndCol == 0 ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4442 |
selectionEndCol := 1. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4443 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4444 |
self setCursorCol:selectionEndCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4445 |
shifted ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4446 |
self expandSelectionRight. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4447 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4448 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4449 |
self unselect; makeCursorVisible. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4450 |
cursorCol == 1 ifTrue:[^ self]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4451 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4452 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4453 |
self cursorRight. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4454 |
^ self |
2580 | 4455 |
]. |
4456 |
(key == #CursorDown) ifTrue:[ |
|
4100
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4457 |
(shifted and:[selectionStartLine isNil]) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4458 |
selectionStartLine := clickStartLine := cursorLine. selectionEndLine := cursorLine + 1. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4459 |
selectionStartCol := clickStartCol := selectionEndCol := cursorCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4460 |
selectionEndCol == 1 ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4461 |
selectionEndCol := 0. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4462 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4463 |
self validateNewSelection. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4464 |
self selectionChanged. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4465 |
self redrawLine:selectionStartLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4466 |
expandingTop := false. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4467 |
self redrawLine:selectionEndLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4468 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4469 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4470 |
|
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4471 |
selectionStartLine notNil ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4472 |
self cursorMovementAllowed ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4473 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4474 |
"/ treat the whole selection as cursor |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4475 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4476 |
self setCursorLine:(selectionEndLine ? selectionStartLine). |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4477 |
self setCursorCol:selectionStartCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4478 |
cursorCol == 0 ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4479 |
self setCursorCol:1. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4480 |
self setCursorLine:(cursorLine - 1). |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4481 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4482 |
self makeCursorVisible. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4483 |
|
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4484 |
shifted ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4485 |
clickLine := cursorLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4486 |
clickCol := cursorCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4487 |
self expandSelectionDown. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4488 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4489 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4490 |
self unselect. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4491 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4492 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4493 |
|
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4494 |
n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorDown). |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4495 |
self cursorDown:n. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4496 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4497 |
"/ flush keyboard to avoid runaway cursor |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4498 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4499 |
self sensor flushKeyboardFor:self. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4500 |
^ self |
2580 | 4501 |
]. |
4502 |
(key == #CursorLeft or:[key == #CursorUp]) ifTrue:[ |
|
4100
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4503 |
(shifted and:[selectionStartLine isNil]) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4504 |
expandingTop := true. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4505 |
key == #CursorLeft ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4506 |
cursorCol > 1 ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4507 |
selectionStartLine := selectionEndLine := clickStartLine := cursorLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4508 |
selectionEndCol := clickStartCol := cursorCol-1. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4509 |
selectionStartCol := cursorCol-1. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4510 |
self validateNewSelection. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4511 |
self selectionChanged. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4512 |
self redrawLine:selectionStartLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4513 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4514 |
] |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4515 |
] ifFalse:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4516 |
cursorLine > 1 ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4517 |
selectionEndLine := clickStartLine := cursorLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4518 |
selectionEndCol := selectionStartCol := clickStartCol := cursorCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4519 |
selectionStartLine := cursorLine - 1. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4520 |
selectionEndCol == 1 ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4521 |
selectionEndCol := 0. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4522 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4523 |
self validateNewSelection. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4524 |
self selectionChanged. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4525 |
self redrawFromLine:selectionStartLine to:cursorLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4526 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4527 |
] |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4528 |
] |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4529 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4530 |
|
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4531 |
selectionStartLine notNil ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4532 |
self cursorMovementAllowed ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4533 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4534 |
"/ treat the whole selection as cursor |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4535 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4536 |
self setCursorLine:selectionStartLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4537 |
self setCursorCol:selectionStartCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4538 |
(key == #CursorLeft) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4539 |
self setCursorCol:(cursorCol+1). "/ compensate for followup crsr-left |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4540 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4541 |
self makeCursorVisible. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4542 |
|
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4543 |
shifted ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4544 |
(key == #CursorUp) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4545 |
clickLine := cursorLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4546 |
self expandSelectionUp. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4547 |
] ifFalse:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4548 |
self expandSelectionLeft. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4549 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4550 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4551 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4552 |
self unselect. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4553 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4554 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4555 |
(key == #CursorLeft) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4556 |
self cursorLeft. ^self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4557 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4558 |
(key == #CursorUp) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4559 |
n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorUp). |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4560 |
self cursorUp:n. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4561 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4562 |
"/ flush keyboard to avoid runaway cursor |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4563 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4564 |
self sensor flushKeyboardFor:self. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4565 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4566 |
]. |
2580 | 4567 |
]. |
4568 |
! |
|
4569 |
||
2952 | 4570 |
doKeyPress:key x:x y:y |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4571 |
"handle keyboard input" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4572 |
|
3781 | 4573 |
<resource: #keyboard (#Paste #Insert #Cut #Again #AgainForAll |
4574 |
#Replace #Undo #Redo #Accept |
|
3780 | 4575 |
#Delete #BasicDelete #BackSpace #BasicBackspace |
4576 |
#SelectWord #DeleteSpaces #Join |
|
4577 |
#SearchMatchingParent #SelectMatchingParents |
|
4578 |
#SelectToEnd #SelectFromBeginning |
|
4579 |
#BeginOfLine #EndOfLine #NextWord #PreviousWord |
|
4580 |
#CursorRight #CursorDown #CursorLeft #CursorUp |
|
4581 |
#Return #Tab #BackTab #NonInsertingTab #Escape |
|
4582 |
#GotoLine #BeginOfText #EndOfText |
|
4583 |
#SelectLine #ExpandSelectionByLine |
|
4584 |
#InsertLine #DeleteLine |
|
4585 |
#SelectLineFromBeginning |
|
4586 |
#LearnKeyboardMacro #ExecuteKeyboardMacro #ToggleInsertMode |
|
4162 | 4587 |
#OpenSpecialCharacterWindow |
3780 | 4588 |
#'F*' #'f*')> |
2017 | 4589 |
|
4238 | 4590 |
|fKeyMacros shiftPressed ctrlPressed i event macroName| |
2184
fb634dc3e606
learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
4591 |
|
fb634dc3e606
learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
4592 |
event := WindowGroup lastEventQuerySignal query. |
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
4593 |
shiftPressed := event hasShift. |
3976 | 4594 |
ctrlPressed := event hasCtrl and:[(event rawKey asString startsWith:'Ctrl') not]. |
2205
230cf9cef6c3
searchPatter, if from selection (escape meta characters)
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
4595 |
|
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4596 |
(key == #LearnKeyboardMacro) ifTrue:[ |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4597 |
self toggleLearnMode. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4598 |
^ self |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4599 |
]. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4600 |
(key == #ExecuteKeyboardMacro) ifTrue:[ |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4601 |
self executeLearnedKeyboardMacro. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4602 |
^ self. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4603 |
]. |
3799 | 4604 |
(key == #Undo) ifTrue:[self undo. ^self]. |
4605 |
(key == #Redo) ifTrue:[self redo. ^self]. |
|
4606 |
||
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4607 |
self learnMode ifTrue:[ |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4608 |
learnedMacro add:event. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4609 |
]. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4610 |
|
4238 | 4611 |
(self executekeyboardMacroNamed:key) ifTrue:[ |
4612 |
"the macro named key exists" |
|
3780 | 4613 |
^ self |
2416
56acdd9e31b5
lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents:
2406
diff
changeset
|
4614 |
]. |
56acdd9e31b5
lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents:
2406
diff
changeset
|
4615 |
|
4253 | 4616 |
(key == #DeleteWordBeforeCursor) ifTrue:[ |
4617 |
self deleteWordBeforeCursor. |
|
4618 |
^ self. |
|
4619 |
]. |
|
4620 |
||
3257 | 4621 |
(key == #BackSpace or:[key == #BasicBackspace]) ifTrue:[ |
3780 | 4622 |
selectionStartLine notNil ifTrue:[ |
4623 |
((key == #BasicBackspace) |
|
4624 |
or:[ UserPreferences current deleteSetsClipboardText not ]) |
|
4625 |
ifTrue:[ |
|
4626 |
self deleteSelection. |
|
4627 |
] ifFalse: [ |
|
4628 |
self copyAndDeleteSelection. |
|
4629 |
]. |
|
4630 |
^ self |
|
4631 |
]. |
|
4632 |
||
4633 |
self makeCursorVisible. |
|
4253 | 4634 |
"/ (shiftPressed and:[ ctrlPressed ]) ifTrue:[ |
4635 |
"/ self deleteWordBeforeCursor. |
|
4636 |
"/ ] ifFalse:[ |
|
3780 | 4637 |
self deleteCharBeforeCursor. |
4253 | 4638 |
"/ ]. |
3780 | 4639 |
|
4640 |
^ self |
|
2205
230cf9cef6c3
searchPatter, if from selection (escape meta characters)
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
4641 |
]. |
2184
fb634dc3e606
learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
4642 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4643 |
(key isMemberOf:Character) ifTrue:[ |
3780 | 4644 |
self handleNonCommandKey:key. |
4645 |
^ self |
|
3235 | 4646 |
]. |
4647 |
||
3782
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4648 |
(key == #ToggleAutoIndent) ifTrue:[ |
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4649 |
self autoIndent:(autoIndent not). |
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4650 |
^ self. |
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4651 |
]. |
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4652 |
|
3235 | 4653 |
key == #ToggleInsertMode ifTrue:[ |
3782
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4654 |
self insertMode:(editMode value == EditMode insertMode) not. |
3780 | 4655 |
^ self. |
3160 | 4656 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4657 |
|
4162 | 4658 |
key == #OpenSpecialCharacterWindow ifTrue:[ |
4659 |
CharacterSetView notNil ifTrue:[ |
|
4660 |
self specialCharacters. |
|
4661 |
^ self. |
|
4662 |
] |
|
4663 |
]. |
|
4664 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4665 |
replacing := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4666 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4667 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4668 |
Fn pastes a key-sequence (but only if not overlayed with |
3780 | 4669 |
another function in the keyboard map) |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4670 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4671 |
see TextView>>:x:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4672 |
" |
1177
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
4673 |
(key at:1) asLowercase == $f ifTrue:[ |
3780 | 4674 |
(('[fF][0-9]' match:key) |
4675 |
or:['[fF][0-9][0-9]' match:key]) ifTrue:[ |
|
4676 |
shiftPressed ifFalse:[ |
|
4677 |
fKeyMacros := UserPreferences current functionKeySequences. |
|
4678 |
fKeyMacros notNil ifTrue:[ |
|
4679 |
(fKeyMacros includesKey:key) ifTrue:[ |
|
4680 |
self pasteOrReplace:(fKeyMacros at:key) asStringCollection. |
|
4681 |
^ self |
|
4682 |
] |
|
4683 |
] |
|
4684 |
] |
|
4685 |
]. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4686 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4687 |
|
2506 | 4688 |
(key == #'Ctrl8' or:[key == #'Ctrl9']) ifTrue:[ |
3780 | 4689 |
self parenthizeSelectionWith:$( and:$). |
4690 |
^ self. |
|
2506 | 4691 |
]. |
4692 |
(key == #'Ctrl2') ifTrue:[ |
|
3780 | 4693 |
self parenthizeSelectionWith:$" and:$". |
4694 |
^ self. |
|
2506 | 4695 |
]. |
4696 |
(key == #'Ctrl#') ifTrue:[ |
|
3780 | 4697 |
self parenthizeSelectionWith:$' and:$'. |
4698 |
^ self. |
|
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4699 |
]. |
4286
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
4700 |
(key == #'ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst') ifTrue:[ |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
4701 |
self convertSelectionToLowercaseOrUppercaseOrUppercaseFirst. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
4702 |
^ self. |
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
4703 |
]. |
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4704 |
|
274
6df4bb990f04
handle accept where acceptAction is define (this was a historic leftover)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
4705 |
(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
|
4706 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4707 |
((key == #Paste) or:[key == #Insert]) ifTrue:[self pasteOrReplace. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4708 |
(key == #Cut) ifTrue:[self cut. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4709 |
(key == #Again) ifTrue:[self again. ^self]. |
3781 | 4710 |
(key == #AgainForAll) ifTrue:[self multipleAgain. ^self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4711 |
|
3542 | 4712 |
(key == #Join) ifTrue:[self joinLines. ^self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4713 |
(key == #Replace) ifTrue:[self replace. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4714 |
(key == #SelectWord) ifTrue:[ |
3780 | 4715 |
self makeCursorVisible. |
4716 |
self selectWordUnderCursor. |
|
4717 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4718 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4719 |
|
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4720 |
(key == #SearchMatchingParent) ifTrue:[self searchForMatchingParenthesis. ^ self]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4721 |
(key == #SelectMatchingParents) ifTrue:[self searchForAndSelectMatchingParenthesis. ^ self]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4722 |
(key == #SelectToEnd) ifTrue:[self selectUpToEnd. ^ self]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4723 |
(key == #SelectFromBeginning) ifTrue:[self selectFromBeginning. ^ self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4724 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4725 |
" disabled - nobody liked it ... |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4726 |
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
|
4727 |
|
1304
173d00c195f9
flush pending keyboard events in cursor-up/down
Claus Gittinger <cg@exept.de>
parents:
1300
diff
changeset
|
4728 |
(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
|
4729 |
(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
|
4730 |
(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
|
4731 |
(key == #Ctrlp) ifTrue:[self unselect. self cursorUp. ^ self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4732 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4733 |
|
1675
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
4734 |
(key == #BeginOfLine) ifTrue:[ |
3780 | 4735 |
shiftPressed ifTrue: [ |
4736 |
"/ "Original St/X code - now use Ctrl modifier" |
|
4737 |
"/ self unselect. |
|
4738 |
"/ self cursorHome. |
|
4739 |
"Jan's modification" |
|
4257 | 4740 |
"/ self addToSelectionAfter:[ self cursorToBeginOfLine ]. |
4741 |
"/ Jan's modification modified by his own request ;-)) |
|
4742 |
self selectFromBeginOfLine. |
|
3780 | 4743 |
] ifFalse: [ |
4744 |
self unselect. |
|
4745 |
ctrlPressed ifTrue:[ |
|
4746 |
self cursorHome. |
|
4747 |
] ifFalse:[ |
|
4748 |
self cursorToBeginOfLine. |
|
4749 |
] |
|
4750 |
]. |
|
4751 |
^ self |
|
1675
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
4752 |
]. |
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
4753 |
(key == #EndOfLine) ifTrue:[ |
3780 | 4754 |
shiftPressed ifTrue:[ |
4755 |
"/ "Original St/X code - now use Ctrl modifier" |
|
4756 |
"/ self unselect. |
|
4757 |
"/ self cursorToBottom |
|
4257 | 4758 |
" Jan's modification" |
4759 |
"/ self addToSelectionAfter:[ self cursorToEndOfLine ] . |
|
4760 |
"/ Jan's modification modified by his own request ;-)) |
|
4761 |
self selectToEndOfLine. |
|
3780 | 4762 |
] ifFalse:[ |
4763 |
self unselect. |
|
4764 |
ctrlPressed ifTrue:[ |
|
4765 |
self cursorToBottom |
|
4766 |
] ifFalse:[ |
|
4767 |
self cursorToEndOfLine. |
|
4768 |
] |
|
4769 |
]. |
|
4770 |
^ self |
|
1675
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
4771 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4772 |
(key == #NextWord) ifTrue:[self cursorToNextWord. ^self]. |
3310 | 4773 |
(key == #EndOfWord) ifTrue:[self cursorToEndOfWord. ^self]. |
499 | 4774 |
(key == #PreviousWord) ifTrue:[self cursorToPreviousWord. ^self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4775 |
(key == #GotoLine) ifTrue:[self gotoLine. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4776 |
|
2580 | 4777 |
(key == #CursorRight |
4778 |
or:[key == #CursorDown |
|
4779 |
or:[key == #CursorLeft |
|
4780 |
or:[key == #CursorUp]]]) ifTrue:[ |
|
3780 | 4781 |
self cursorKeyPress:key shifted:shiftPressed. |
4782 |
^ self. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4783 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4784 |
|
3257 | 4785 |
(key == #NonInsertingReturn) ifTrue:[ |
3780 | 4786 |
self unselect. self cursorReturn. |
4787 |
^ self |
|
3257 | 4788 |
]. |
4789 |
||
4790 |
(key == #Return) ifTrue:[ |
|
3780 | 4791 |
shiftPressed ifTrue:[ |
4792 |
self unselect. self cursorReturn. |
|
4793 |
^ self |
|
4794 |
]. |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
4795 |
|
3780 | 4796 |
self isReadOnly ifTrue:[ |
4797 |
self unselect; makeCursorVisible. |
|
4798 |
self cursorReturn |
|
4799 |
] ifFalse:[ |
|
4800 |
self isInInsertMode ifFalse:[ |
|
4801 |
self cursorReturn. |
|
4802 |
autoIndent == true ifTrue:[ |
|
4803 |
i := self leftIndentForLine:(cursorLine + 1). |
|
4804 |
self cursorCol:(i+1 max:1) |
|
4805 |
] |
|
4806 |
] ifTrue:[ |
|
4807 |
"/ old version just unselected ... |
|
4808 |
"/ self unselect; makeCursorVisible. |
|
4809 |
||
4810 |
"/ new version deletes ... |
|
4811 |
typeOfSelection == #paste ifTrue:[ |
|
4812 |
self unselect; makeCursorVisible. |
|
4813 |
] ifFalse:[ |
|
4814 |
self copyAndDeleteSelection. |
|
4815 |
]. |
|
4816 |
self insertCharAtCursor:(Character cr). |
|
4817 |
autoIndent == true ifTrue:[ |
|
4818 |
i := self leftIndentForLine:cursorLine. |
|
4819 |
self indentFromLine:cursorLine toLine:cursorLine. |
|
4820 |
self cursorCol:(i+1 max:1) |
|
4821 |
]. |
|
4822 |
]. |
|
4823 |
]. |
|
4824 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4825 |
]. |
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
|
4826 |
|
2819
a7a41dfb9df7
BackTab / NonInsertingTab modifiers now defined in keyboard.rc
ca
parents:
2817
diff
changeset
|
4827 |
(key == #NonInsertingTab) ifTrue:[ |
3780 | 4828 |
self unselect. self cursorTab. |
4829 |
^ self |
|
2819
a7a41dfb9df7
BackTab / NonInsertingTab modifiers now defined in keyboard.rc
ca
parents:
2817
diff
changeset
|
4830 |
]. |
3422
a0c68e8bd56e
tab with line selection means: indent/undent
Claus Gittinger <cg@exept.de>
parents:
3416
diff
changeset
|
4831 |
((key == #BackTab) or:[(key == #Tab)]) ifTrue:[ |
3780 | 4832 |
self tabMeansNextField ifTrue:[^ super keyPress:key x:x y:y]. |
4833 |
||
4834 |
self hasSelection ifTrue:[ |
|
4835 |
selectStyle == #line ifTrue:[ |
|
4238 | 4836 |
((key == #Tab) and:[shiftPressed not]) ifTrue:[ |
4837 |
macroName := #IndentBy4. |
|
4838 |
] ifFalse:[ |
|
4839 |
macroName := #UndentBy4. |
|
4840 |
]. |
|
4841 |
macroName notNil ifTrue:[ |
|
4842 |
self executekeyboardMacroNamed:macroName. |
|
3780 | 4843 |
]. |
4844 |
] |
|
4845 |
]. |
|
4846 |
||
4847 |
self unselect. |
|
4848 |
(key == #Tab) ifTrue:[ |
|
4849 |
(shiftPressed or:[self isInInsertMode not]) ifTrue:[ |
|
4850 |
self cursorTab. |
|
4851 |
^ self |
|
4852 |
]. |
|
4853 |
self insertTabAtCursor. |
|
4854 |
^ self |
|
4855 |
]. |
|
4856 |
self cursorBacktab. |
|
4857 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4858 |
]. |
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
|
4859 |
|
2883
6cdb4a5a7b5e
shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents:
2880
diff
changeset
|
4860 |
"/ key == #DeleteSpaces ifTrue:[ |
6cdb4a5a7b5e
shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents:
2880
diff
changeset
|
4861 |
(key == #Delete) ifTrue:[ |
3780 | 4862 |
shiftPressed ifTrue:[ |
4863 |
[(cursorCol <= (self listAt:cursorLine) size) |
|
4864 |
and:[self characterUnderCursor isSeparator]] whileTrue:[ |
|
4865 |
self makeCursorVisible. |
|
4866 |
self deleteCharAtCursor. |
|
4867 |
]. |
|
4868 |
^ self |
|
4869 |
] |
|
2883
6cdb4a5a7b5e
shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents:
2880
diff
changeset
|
4870 |
]. |
6cdb4a5a7b5e
shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents:
2880
diff
changeset
|
4871 |
|
870 | 4872 |
(key == #Delete |
4873 |
or:[key == #BasicDelete]) ifTrue:[ |
|
4129 | 4874 |
selectionStartLine notNil ifTrue:[ |
4130 | 4875 |
"/ Again function is not supporting Delete action (on purpose, to avoid replacing the next search string) |
4876 |
"/ To remove text repetetively, use Cut instead. |
|
4877 |
"/ self setLastStringToReplace: self selection asStringWithoutFinalCR. |
|
4878 |
"/ lastReplacementInfo lastReplacement: nil. |
|
3780 | 4879 |
((key == #BasicDelete) |
4880 |
or:[UserPreferences current deleteSetsClipboardText not]) ifTrue:[ |
|
4881 |
self deleteSelection. |
|
4882 |
] ifFalse:[ |
|
4883 |
self copyAndDeleteSelection. |
|
4884 |
]. |
|
4885 |
^ self |
|
4886 |
]. |
|
4887 |
self makeCursorVisible. |
|
4888 |
self deleteCharAtCursor. |
|
4889 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4890 |
]. |
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
|
4891 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4892 |
(key == #BeginOfText) ifTrue:[ "i.e. HOME" |
3780 | 4893 |
self unselect. |
4894 |
cursorVisibleLine == 1 ifTrue:[ |
|
4895 |
self cursorHome. |
|
4896 |
] ifFalse:[ |
|
4897 |
self cursorToFirstVisibleLine |
|
4898 |
]. |
|
4899 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4900 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4901 |
(key == #EndOfText) ifTrue:[ "i.e. END" |
3780 | 4902 |
self unselect. |
4903 |
cursorVisibleLine == nFullLinesShown ifTrue:[ |
|
4904 |
self cursorToBottom. |
|
4905 |
] ifFalse:[ |
|
4906 |
self cursorToLastVisibleLine |
|
4907 |
]. |
|
4908 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4909 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4910 |
((key == #Escape) |
3257 | 4911 |
or:[key == #SelectLineFromBeginning]) ifTrue:[ |
3780 | 4912 |
self makeCursorVisible. |
4913 |
self unselect. self selectCursorLineFromBeginning. |
|
4914 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4915 |
]. |
3257 | 4916 |
(key == #SelectLine) ifTrue:[ |
3780 | 4917 |
self makeCursorVisible. |
4918 |
self unselect. self selectCursorLine. |
|
4919 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4920 |
]. |
3257 | 4921 |
(key == #ExpandSelectionByLine) ifTrue:[ |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4922 |
"/ self makeCursorVisible. |
3780 | 4923 |
self selectExpandCursorLine. |
4924 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4925 |
]. |
3257 | 4926 |
(key == #DeleteLine) ifTrue:[ |
3780 | 4927 |
self makeCursorVisible. |
4928 |
self unselect. self deleteCursorLine. |
|
4929 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4930 |
]. |
3257 | 4931 |
(key == #InsertLine) ifTrue:[ |
3780 | 4932 |
self makeCursorVisible. |
4933 |
self unselect. self insertLine:nil before:cursorLine. |
|
4934 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4935 |
]. |
3781 | 4936 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4937 |
super keyPress:key x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4938 |
|
3310 | 4939 |
"Modified: / 06-02-1998 / 11:59:59 / stefan" |
4286
83ef1d9faf6d
added: #convertSelectionToLowercaseOrUppercaseOrUppercaseFirst
Claus Gittinger <cg@exept.de>
parents:
4285
diff
changeset
|
4940 |
"Modified: / 14-07-2011 / 12:08:28 / cg" |
121 | 4941 |
! |
4942 |
||
2952 | 4943 |
executeKeyboardMacro:cmdMacro |
4944 |
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
|
4945 |
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
|
4946 |
ex return. |
2952 | 4947 |
] do:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4948 |
AbortOperationRequest handle:[:ex | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4949 |
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
|
4950 |
ex return. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4951 |
] do:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4952 |
Parser |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4953 |
evaluate:cmdMacro asString |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4954 |
receiver:self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4955 |
notifying:nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4956 |
compile:false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4957 |
]. |
2952 | 4958 |
]. |
4959 |
! |
|
4960 |
||
4961 |
handleNonCommandKey:keyArg |
|
4962 |
|selStartLine selStartCol selEndLine selEndCol sel key| |
|
4963 |
||
4964 |
self isReadOnly ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4965 |
self flash. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4966 |
^ self. |
2952 | 4967 |
]. |
4968 |
||
4969 |
key := keyArg. |
|
4970 |
||
4971 |
typeOfSelection == #paste ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4972 |
"pasted selection will NOT be replaced by keystroke" |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4973 |
self unselect |
2952 | 4974 |
]. |
4975 |
||
4976 |
selStartLine := selectionStartLine. |
|
4977 |
selStartCol := self selectionStartCol. |
|
4978 |
selEndLine := selectionEndLine. |
|
4979 |
selEndCol := self selectionEndCol. |
|
4980 |
sel := self selection. |
|
4981 |
||
4982 |
(characterEncoding ? #'iso10646-1') ~~ #'iso10646-1' ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4983 |
key := CharacterEncoder encode:key from:#'iso10646-1' into:characterEncoding. |
2952 | 4984 |
]. |
4985 |
||
4986 |
"replace selection by what is typed in - |
|
3235 | 4987 |
if word was selected with a space, keep it. |
4988 |
if there was no selection, the keys character is inserted" |
|
4989 |
||
4990 |
editMode value isInsertAndSelectMode ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4991 |
selectionStartLine := selectionStartCol := selectionEndLine := selectionEndCol := nil. |
3235 | 4992 |
]. |
2952 | 4993 |
|
4994 |
(selectStyle == #wordLeft) ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4995 |
self replaceSelectionBy:(' ' , key asString) |
2952 | 4996 |
] ifFalse:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4997 |
(selectStyle == #wordRight) ifTrue:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4998 |
self replaceSelectionBy:(key asString , ' '). |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4999 |
self cursorLeft |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5000 |
] ifFalse:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5001 |
self replaceSelectionBy:key |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5002 |
] |
3160 | 5003 |
]. |
2952 | 5004 |
selectStyle := nil. |
5005 |
||
3235 | 5006 |
editMode value isInsertAndSelectMode ifTrue:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5007 |
selectionStartLine := selStartLine. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5008 |
selectionStartCol := selStartCol. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5009 |
selectionEndLine := selEndLine. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5010 |
selectionEndCol := selEndCol. |
3235 | 5011 |
]. |
5012 |
||
2952 | 5013 |
showMatchingParenthesis ifTrue:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5014 |
"emacs style parenthesis shower" |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5015 |
(ExecutingMacroQuery query ? false) ifFalse:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5016 |
"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
|
5017 |
otherwise its too anoying. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5018 |
" |
2952 | 5019 |
" |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5020 |
(#( $( $) $[ $] ${ $} ) includes:key) ifTrue:[ |
2952 | 5021 |
" |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5022 |
(#( $) $] $} ) includes:key) ifTrue:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5023 |
self |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5024 |
searchForMatchingParenthesisFromLine:cursorLine col:(cursorCol - 1) |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5025 |
ifFound:[:line :col | |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5026 |
|savLine savCol sensor| |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5027 |
|
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5028 |
self withCursor:Cursor eye do:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5029 |
savLine := cursorLine. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5030 |
savCol := cursorCol. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5031 |
self cursorLine:line col:col. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5032 |
device flush. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5033 |
|
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5034 |
"/ 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
|
5035 |
"/ arrives in the meantime ... |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5036 |
|
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5037 |
sensor := self sensor. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5038 |
5 timesRepeat:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5039 |
(sensor hasKeyPressEventFor:self) ifFalse:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5040 |
Processor activeProcess millisecondDelay:40. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5041 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5042 |
]. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5043 |
self cursorLine:savLine col:savCol |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5044 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5045 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5046 |
ifNotFound:[self showNotFound] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5047 |
onError:[self beep] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5048 |
]. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5049 |
] |
2952 | 5050 |
]. |
5051 |
||
5052 |
"/ true "autoExpandWhileTyping" ifTrue:[ |
|
5053 |
"/ self wordAtLine:cursorLine col:cursorCol-1 do:[ |
|
5054 |
"/ :beginLine :beginCol :endLine :endCol :style | |
|
5055 |
"/ |
|
5056 |
"/ self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
|
5057 |
"/ self selection. |
|
5058 |
"/ typeOfSelection := #paste. |
|
3160 | 5059 |
"/ ]. |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5060 |
"/ ]. |
3235 | 5061 |
editMode value isInsertAndSelectMode ifTrue:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5062 |
selectionStartLine isNil ifTrue:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5063 |
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
|
5064 |
] ifFalse:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5065 |
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
|
5066 |
]. |
3235 | 5067 |
]. |
2952 | 5068 |
! |
5069 |
||
5070 |
keyPress:key x:x y:y |
|
5071 |
"handle keyboard input" |
|
5072 |
||
5073 |
self undoableDo:[ |
|
4242 | 5074 |
self doKeyPress:key x:x y:y |
5075 |
]. |
|
5076 |
self repairDamage |
|
5077 |
||
5078 |
"Modified: / 18-04-2011 / 21:35:27 / cg" |
|
2952 | 5079 |
! |
5080 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5081 |
mapped |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5082 |
"view was made visible" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5083 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5084 |
super mapped. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
5085 |
self updateCursorVisibleLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5086 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5087 |
|
3268
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
5088 |
requestAutoAccept |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
5089 |
"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
|
5090 |
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
|
5091 |
|
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
5092 |
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
|
5093 |
"/ nope - |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5094 |
^ false |
3268
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
5095 |
]. |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
5096 |
self accept. |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
5097 |
^ true. |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
5098 |
! |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
5099 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5100 |
sizeChanged:how |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5101 |
"make certain, cursor is visible after the sizechange" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5102 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5103 |
|cv| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5104 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5105 |
cv := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5106 |
super sizeChanged:how. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5107 |
cv notNil ifTrue:[ |
3160 | 5108 |
self makeLineVisible:cursorLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5109 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5110 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5111 |
|
1807 | 5112 |
!EditTextView methodsFor:'focus handling'! |
5113 |
||
5114 |
hasKeyboardFocus:aBoolean |
|
5115 |
"sent by the windowGroup, a delegate or myself to make me show a block cursor |
|
5116 |
(otherwise, I would not know about this)" |
|
5117 |
||
5118 |
hasKeyboardFocus := aBoolean. |
|
3160 | 5119 |
(cursorShown |
5120 |
and:[self enabled |
|
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
5121 |
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
|
5122 |
self drawCursor |
1816
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
5123 |
]. |
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
5124 |
|
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
5125 |
"Modified: / 23.3.1999 / 13:49:35 / cg" |
1807 | 5126 |
! |
5127 |
||
5128 |
showFocus:explicit |
|
5129 |
"in addition to however my superclass thinks how a focusView is to be |
|
5130 |
displayed, show the cursor when I got the focus" |
|
5131 |
||
5132 |
self showCursor. |
|
5133 |
self hasKeyboardFocus:true. |
|
5134 |
super showFocus:explicit |
|
5135 |
||
5136 |
"Modified: 11.12.1996 / 16:56:54 / cg" |
|
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5137 |
! |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5138 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5139 |
wantsFocusWithPointerEnter |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5140 |
"return true, if I want the focus when |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5141 |
the mouse pointer enters" |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5142 |
|
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
5143 |
(UserPreferences current focusFollowsMouse ~~ false |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
5144 |
and:[(styleSheet at:#'editText.requestFocusOnPointerEnter' default:true) |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
5145 |
and:[self enabled |
4097
233d27a2b0a0
comment/format in: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
5146 |
and:[self isReadOnly not]]] |
233d27a2b0a0
comment/format in: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
5147 |
) ifTrue:[ |
233d27a2b0a0
comment/format in: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
5148 |
^ true |
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5149 |
]. |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5150 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5151 |
^ false |
1807 | 5152 |
! ! |
5153 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5154 |
!EditTextView methodsFor:'formatting'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5155 |
|
4237 | 5156 |
executekeyboardMacroNamed:macroName |
4238 | 5157 |
|functionKeySequences cmdMacro| |
5158 |
||
5159 |
functionKeySequences := UserPreferences current functionKeySequences. |
|
5160 |
functionKeySequences notNil ifTrue:[ |
|
5161 |
cmdMacro := functionKeySequences at:macroName ifAbsent:nil. |
|
5162 |
]. |
|
5163 |
||
5164 |
cmdMacro isNil ifTrue:[ |
|
5165 |
^ false. |
|
5166 |
] ifFalse:[ |
|
5167 |
self |
|
5168 |
undoableDo:[ self executeKeyboardMacro:cmdMacro ] |
|
5169 |
info: macroName. |
|
5170 |
^ true. |
|
5171 |
]. |
|
5172 |
||
5173 |
" |
|
5174 |
EditTextView new open |
|
5175 |
contents:'bla'; |
|
5176 |
selectAll; |
|
5177 |
executekeyboardMacroNamed:#IndentBy4. |
|
5178 |
EditTextView new open |
|
5179 |
contents:'bla'; |
|
5180 |
selectAll; |
|
5181 |
executekeyboardMacroNamed:#blabla. |
|
5182 |
" |
|
4237 | 5183 |
! |
5184 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5185 |
indent |
3221 | 5186 |
"indent a line-range - this is done by searching for the |
5187 |
last non-empty line before the selection, and changing the indent |
|
5188 |
of the selected line-range based on that lines indent." |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5189 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5190 |
|start end| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5191 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5192 |
selectionStartLine isNil ifTrue:[^ self]. |
3221 | 5193 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5194 |
start := selectionStartLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5195 |
end := selectionEndLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5196 |
(selectionEndCol == 0) ifTrue:[ |
3786 | 5197 |
end := end - 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5198 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5199 |
self unselect. |
3160 | 5200 |
self |
3786 | 5201 |
undoableDo:[self indentFromLine:start toLine:end] |
5202 |
info:'Indent' |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5203 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5204 |
|
4237 | 5205 |
indentBy4 |
4238 | 5206 |
self executekeyboardMacroNamed:#IndentBy4 |
4237 | 5207 |
|
5208 |
"Modified: / 06-04-2011 / 18:52:40 / cg" |
|
5209 |
! |
|
5210 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5211 |
indentFromLine:start toLine:end |
3221 | 5212 |
"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
|
5213 |
last non-empty line before start, and change the indent |
3221 | 5214 |
of the selected line-range based on that lines indent." |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5215 |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5216 |
|leftStart delta d line spaces| |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5217 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5218 |
leftStart := self leftIndentForLine:start. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5219 |
(leftStart == 0) ifTrue:[^ self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5220 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5221 |
delta := leftStart - (self leftIndentOfLine:start). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5222 |
(delta == 0) ifTrue:[^ self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5223 |
(delta > 0) ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5224 |
spaces := String new:delta |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5225 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5226 |
start to:end do:[:lineNr | |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5227 |
line := self listAt:lineNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5228 |
line notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5229 |
line isBlank ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5230 |
list at:lineNr put:nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5231 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5232 |
(delta > 0) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5233 |
line := spaces , line. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5234 |
widthOfWidestLine notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5235 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5236 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5237 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5238 |
"check if deletion is ok" |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5239 |
d := delta negated + 1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5240 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5241 |
line size > d ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5242 |
(line copyTo:(d - 1)) withoutSeparators isEmpty ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5243 |
line := line copyFrom:d |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5244 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5245 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5246 |
widthOfWidestLine := nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5247 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5248 |
self replaceLine:lineNr with:line. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5249 |
self textChanged. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5250 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5251 |
] |
3221 | 5252 |
]. |
5253 |
"/ self redrawFromLine:start to:end |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5254 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5255 |
"Modified: 5.3.1996 / 14:59:18 / cg" |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5256 |
! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5257 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5258 |
leftIndentForLine:lineNr |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5259 |
"find an appropriate indent for a line. |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5260 |
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
|
5261 |
and returning its indent." |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5262 |
|
827 | 5263 |
"SHOULD GO TO ListView" |
5264 |
||
5265 |
|line lnr indent| |
|
5266 |
||
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5267 |
lnr := lineNr. |
827 | 5268 |
|
5269 |
[lnr ~~ 1] whileTrue:[ |
|
3160 | 5270 |
lnr := lnr - 1. |
5271 |
line := self listAt:lnr. |
|
5272 |
||
5273 |
line notNil ifTrue:[ |
|
5274 |
indent := line indexOfNonSeparatorStartingAt:1. |
|
5275 |
indent ~~ 0 ifTrue:[ |
|
5276 |
^ indent - 1 |
|
5277 |
] |
|
5278 |
] |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5279 |
]. |
827 | 5280 |
^ 0 |
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5281 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5282 |
"Created: 5.3.1996 / 14:58:53 / cg" |
4237 | 5283 |
! |
5284 |
||
5285 |
undentBy4 |
|
4238 | 5286 |
self executekeyboardMacroNamed:#UndentBy4. |
4237 | 5287 |
|
5288 |
"Modified: / 06-04-2011 / 18:52:49 / cg" |
|
105 | 5289 |
! ! |
5290 |
||
0 | 5291 |
!EditTextView methodsFor:'initialization'! |
5292 |
||
941 | 5293 |
fetchDeviceResources |
5294 |
"fetch device colors, to avoid reallocation at redraw time" |
|
5295 |
||
5296 |
super fetchDeviceResources. |
|
5297 |
||
1993 | 5298 |
cursorFgColor notNil ifTrue:[cursorFgColor := cursorFgColor onDevice:device]. |
5299 |
cursorBgColor notNil ifTrue:[cursorBgColor := cursorBgColor onDevice:device]. |
|
5300 |
cursorNoFocusFgColor notNil ifTrue:[cursorNoFocusFgColor := cursorNoFocusFgColor onDevice:device]. |
|
941 | 5301 |
|
5302 |
"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
|
5303 |
"Modified: 18.2.1997 / 15:02:46 / cg" |
941 | 5304 |
! |
5305 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5306 |
initEvents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5307 |
"enable enter/leave events in addition" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5308 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5309 |
super initEvents. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5310 |
self enableEnterLeaveEvents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5311 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5312 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5313 |
initStyle |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5314 |
"initialize style specific stuff" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5315 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5316 |
super initStyle. |
2088 | 5317 |
lineSpacing := 1. "/ for underwave - also looks better |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5318 |
lockUpdates := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5319 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5320 |
cursorFgColor := DefaultCursorForegroundColor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5321 |
cursorFgColor isNil ifTrue:[cursorFgColor := bgColor]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5322 |
cursorBgColor := DefaultCursorBackgroundColor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5323 |
cursorBgColor isNil ifTrue:[cursorBgColor := fgColor]. |
1334 | 5324 |
cursorType := cursorTypeNoFocus := DefaultCursorType. |
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
5325 |
DefaultCursorTypeNoFocus notNil ifTrue:[ |
3160 | 5326 |
cursorTypeNoFocus := DefaultCursorTypeNoFocus. |
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
5327 |
]. |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
5328 |
cursorNoFocusFgColor := DefaultCursorNoFocusForegroundColor. |
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
5329 |
cursorNoFocusFgColor isNil ifTrue:[ |
3160 | 5330 |
cursorType ~~ #block ifTrue:[ |
5331 |
cursorNoFocusFgColor := cursorBgColor |
|
5332 |
] ifFalse:[ |
|
5333 |
cursorNoFocusFgColor := cursorFgColor |
|
5334 |
] |
|
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
5335 |
]. |
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
5336 |
|
2088 | 5337 |
"Modified: / 15.12.1999 / 22:27:45 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5338 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5339 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5340 |
initialize |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5341 |
"initialize a new EditTextView; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5342 |
setup some instance variables" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5343 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5344 |
super initialize. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5345 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5346 |
self level:-1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5347 |
readOnly := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5348 |
fixedSize := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5349 |
exceptionBlock := [:errorText | ]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5350 |
cursorShown := prevCursorState := true. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5351 |
cursorLine := 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5352 |
cursorVisibleLine := 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5353 |
cursorCol := 1. |
2815 | 5354 |
cursorLineHolder := 1 asValue. |
5355 |
cursorColHolder := 1 asValue. |
|
2119 | 5356 |
modifiedChannel := ValueHolder with:false. |
5357 |
acceptChannel := ValueHolder with:false. |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
5358 |
acceptChannel addDependent:self. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5359 |
showMatchingParenthesis := false. |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
5360 |
hasKeyboardFocus := false. |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
5361 |
tabMeansNextField := false. |
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5362 |
autoIndent := false. |
3235 | 5363 |
editMode := EditMode insertMode asValue. |
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5364 |
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
|
5365 |
trimBlankLines := self st80EditMode not. |
2131 | 5366 |
cursorMovementWhenUpdating := #beginOfText. |
4048 | 5367 |
lastReplacementInfo := LastReplacementInfo new. |
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
5368 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5369 |
"/ enable drop by default |
2589 | 5370 |
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
|
5371 |
|
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
5372 |
undoSupport := UndoSupport for:self. |
0 | 5373 |
! ! |
5374 |
||
2580 | 5375 |
!EditTextView methodsFor:'macros'! |
5376 |
||
5377 |
executeLearnedKeyboardMacro |
|
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5378 |
(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
|
5379 |
ExecutingMacroQuery |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5380 |
answer:true |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5381 |
do:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5382 |
learnedMacro do:[:event | |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5383 |
WindowGroup lastEventQuerySignal answer:event |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5384 |
do:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5385 |
self |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5386 |
dispatchEvent:event |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5387 |
withFocusOn:nil |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5388 |
delegate:false |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5389 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5390 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5391 |
]. |
2580 | 5392 |
] ifFalse:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5393 |
self flash. |
2580 | 5394 |
]. |
5395 |
! |
|
5396 |
||
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5397 |
learnMode |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5398 |
"true if currently learning" |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5399 |
|
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5400 |
^ (learnMode value ? false). |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5401 |
! |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5402 |
|
2580 | 5403 |
learnMode:aBoolean |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5404 |
"toggle the learn-mode" |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5405 |
|
2580 | 5406 |
|fg bg| |
5407 |
||
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5408 |
self learnModeHolder value:aBoolean. |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5409 |
|
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5410 |
aBoolean ifTrue:[ |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5411 |
learnedMacro := OrderedCollection new. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5412 |
fg := Color white. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5413 |
bg := Color black. |
2580 | 5414 |
] ifFalse:[ |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5415 |
cursorFgColor := fg := (DefaultCursorForegroundColor ? bgColor). |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5416 |
cursorBgColor := bg := (DefaultCursorBackgroundColor ? fgColor). |
2580 | 5417 |
]. |
5418 |
self cursorForegroundColor:fg backgroundColor:bg. |
|
5419 |
! |
|
5420 |
||
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5421 |
learnModeHolder |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5422 |
learnMode isNil ifTrue:[ |
3160 | 5423 |
learnMode := false asValue |
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5424 |
]. |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5425 |
^ learnMode |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5426 |
! |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5427 |
|
2580 | 5428 |
toggleLearnMode |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5429 |
"toggle the learn-mode" |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5430 |
|
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5431 |
self learnMode:(self learnMode not). |
2580 | 5432 |
! ! |
5433 |
||
121 | 5434 |
!EditTextView methodsFor:'menu actions'! |
5435 |
||
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5436 |
babelFishTranslate:fromToModeString |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5437 |
"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
|
5438 |
|
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5439 |
|original translated| |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5440 |
|
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5441 |
original := self selectionAsString. |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5442 |
original size == 0 ifTrue:[^ self]. |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5443 |
|
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5444 |
self withWaitCursorDo:[ |
4143
34d78a2ca94f
changed: #babelFishTranslate:
Claus Gittinger <cg@exept.de>
parents:
4142
diff
changeset
|
5445 |
(HostNameLookupError , SOAP::SoapImplError) handle:[:ex | |
3799 | 5446 |
Dialog warn:('Translation failed - WEB Service error:\\%1.' bindWith:ex description allBold) withCRs |
5447 |
] do:[ |
|
5448 |
translated := SOAP::BabelFishClient new translate:original mode:fromToModeString. |
|
5449 |
] |
|
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5450 |
]. |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5451 |
|
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5452 |
"/ v pasteOrReplace:translated |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5453 |
self cursorLine:(self selectionEndLine) col:(self selectionEndCol + 1). |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5454 |
self unselect. |
3799 | 5455 |
self |
5456 |
undoablePaste:translated |
|
5457 |
info:'Translate' |
|
3495 | 5458 |
|
5459 |
"Modified: / 28-07-2007 / 13:27:21 / cg" |
|
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5460 |
! |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5461 |
|
3517 | 5462 |
compareWithClipboard |
5463 |
"compare the selection against the clipboard contents" |
|
5464 |
||
5465 |
|t1 t2| |
|
5466 |
||
5467 |
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
|
5468 |
t2 isEmptyOrNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5469 |
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
|
5470 |
^ self. |
3517 | 5471 |
]. |
5472 |
||
5473 |
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
|
5474 |
t1 := self selectionAsString. |
3517 | 5475 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5476 |
t1 := self contents asString |
3517 | 5477 |
]. |
5478 |
t1 := t1 string. |
|
5479 |
||
5480 |
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
|
5481 |
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
|
5482 |
^ self. |
3517 | 5483 |
]. |
5484 |
DiffTextView |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5485 |
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
|
5486 |
and:t2 label:'Clipboard' |
3517 | 5487 |
! |
5488 |
||
121 | 5489 |
cut |
5490 |
"cut selection into copybuffer" |
|
5491 |
||
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5492 |
self deleteCopyToClipboard:true |
121 | 5493 |
! |
5494 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5495 |
defaultForGotoLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5496 |
"return a default value to show in the gotoLine box" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5497 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5498 |
cursorLine notNil ifTrue:[ |
3160 | 5499 |
^ cursorLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5500 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5501 |
^ super defaultForGotoLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5502 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5503 |
|
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5504 |
deleteCopyToClipboard:toClipboard |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5505 |
"cut selection into copybuffer" |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5506 |
|
4129 | 5507 |
|line col history sel | |
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5508 |
|
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5509 |
(self checkModificationsAllowed) ifFalse:[ |
3786 | 5510 |
self flash. |
5511 |
^ self |
|
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5512 |
]. |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5513 |
|
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5514 |
sel := self selection. |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5515 |
sel notNil ifTrue:[ |
4129 | 5516 |
self setLastStringToReplace: sel. |
4053 | 5517 |
|
3786 | 5518 |
line := selectionStartLine. |
5519 |
col := selectionStartCol. |
|
5520 |
||
5521 |
toClipboard ifTrue:[ |
|
5522 |
" |
|
5523 |
remember in CopyBuffer |
|
5524 |
" |
|
5525 |
self setClipboardText:sel. "/ lastString. |
|
5526 |
]. |
|
5527 |
||
5528 |
" |
|
5529 |
append to DeleteHistory (if there is one) |
|
5530 |
" |
|
5531 |
history := Smalltalk at:#DeleteHistory. |
|
5532 |
history notNil ifTrue:[ |
|
5533 |
history addAll:(sel asStringCollection). |
|
5534 |
history size > 1000 ifTrue:[ |
|
5535 |
history := history copyFrom:(history size - 1000) |
|
5536 |
]. |
|
5537 |
]. |
|
5538 |
||
5539 |
" |
|
5540 |
now, delete it |
|
5541 |
" |
|
5542 |
self |
|
5543 |
undoableDo:[self deleteSelection] |
|
5544 |
info:'Delete'. |
|
4048 | 5545 |
lastReplacementInfo lastReplacement: nil |
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5546 |
] ifFalse:[ |
3786 | 5547 |
" |
5548 |
a cut without selection will search&cut again |
|
5549 |
" |
|
5550 |
self undoableDo:[ |
|
5551 |
self again |
|
5552 |
] |
|
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5553 |
] |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5554 |
|
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5555 |
"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
|
5556 |
! |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5557 |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5558 |
editMenu |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5559 |
"return the views middleButtonMenu" |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5560 |
|
3781 | 5561 |
<resource: #keyboard (#Again #AgainForAll #Copy #Cut #Paste #Accept |
5562 |
#Find #GotoLine #SaveAs #Print |
|
3890 | 5563 |
#PasteFromHistory #Join #Wrap #Undo #Redo |
3781 | 5564 |
#ToggleAutoIndent #ToggleInsertMode |
5565 |
#LearnKeyboardMacro #ExecuteKeyboardMacro )> |
|
1261
bdb18f73205c
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1198
diff
changeset
|
5566 |
<resource: #programMenu> |
1054 | 5567 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5568 |
|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
|
5569 |
transSub sortSub what undoIdx redoIdx sensor main mainItems| |
1515 | 5570 |
|
2460 | 5571 |
items := #( |
3781 | 5572 |
('Redo' redo Redo ) |
5573 |
('Again (for All)' multipleAgain AgainForAll ) |
|
3731 | 5574 |
('-' ) |
5575 |
('Search...' search Find ) |
|
5576 |
('Goto Line...' gotoLine GotoLine ) |
|
5577 |
('-' ) |
|
4213 | 5578 |
('Tools' tools ) ). |
5579 |
CharacterSetView notNil ifTrue:[ |
|
5580 |
items := items , |
|
5581 |
#( |
|
5582 |
('Special Characters...' specialCharacters OpenSpecialCharacterWindow ) |
|
5583 |
). |
|
5584 |
]. |
|
5585 |
items := items , #( |
|
3731 | 5586 |
('-' ) |
5587 |
('Save As...' save SaveAs ) |
|
5588 |
('Print' doPrint Print ) |
|
5589 |
('=' ) |
|
4213 | 5590 |
('Misc' misc ShiftCtrl) ). |
2460 | 5591 |
|
2866 | 5592 |
miscItems := #( |
3781 | 5593 |
('AutoIndent \c' autoIndent: ToggleAutoIndent ) |
5594 |
('InsertMode \c' insertMode: ToggleInsertMode ) |
|
3731 | 5595 |
('-' ) |
5596 |
('Paste Previous...' pasteOrReplaceFromHistory PasteFromHistory ) |
|
3781 | 5597 |
('Join Lines' joinLines Join ) |
3890 | 5598 |
('Wrap Lines' wrapLines Wrap ) |
3731 | 5599 |
('-' ) |
3781 | 5600 |
('Learn Macro' learnMode: LearnKeyboardMacro) |
5601 |
('Execute Macro' executeLearnedKeyboardMacro ExecuteKeyboardMacro ) |
|
3731 | 5602 |
('-' ) |
3811 | 5603 |
('Insert File...' insertFile ) |
5604 |
('Insert URL Contents...' insertURL ) |
|
3781 | 5605 |
('Insert new UUID' insertUUID ) |
5606 |
('Insert Date && Time' insertDateAndTime ) |
|
3732 | 5607 |
('-' ) |
5608 |
('Insert File as String Literal...' insertFileAsStringLiteral ) |
|
5609 |
('Paste as String Literal' pasteAsStringLiteral ) |
|
3731 | 5610 |
('-' ) |
5611 |
). |
|
4213 | 5612 |
"/ CharacterSetView notNil ifTrue:[ |
5613 |
"/ miscItems := miscItems , |
|
5614 |
"/ #( |
|
5615 |
"/ ('Special Characters...' specialCharacters OpenSpecialCharacterWindow ) |
|
5616 |
"/ ). |
|
5617 |
"/ ]. |
|
3406
c5efa51e7929
dont offer CharacterSetView display in menu, if its not available.
Claus Gittinger <cg@exept.de>
parents:
3402
diff
changeset
|
5618 |
miscItems := miscItems , |
3731 | 5619 |
#( |
5620 |
('Font...' changeFont ) |
|
2870 | 5621 |
"/ ('Encoding...' changeEncoding ) |
3731 | 5622 |
). |
2866 | 5623 |
|
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5624 |
translateItems := #( |
3731 | 5625 |
('English -> German' (babelFishTranslate: 'en_de') ) |
5626 |
('English -> French' (babelFishTranslate: 'en_fr') ) |
|
5627 |
('English -> Italian' (babelFishTranslate: 'en_it') ) |
|
5628 |
('English -> Spanish' (babelFishTranslate: 'en_es') ) |
|
5629 |
('English -> Portuguese' (babelFishTranslate: 'en_pt') ) |
|
5630 |
('-' ) |
|
5631 |
('German -> English' (babelFishTranslate: 'de_en') ) |
|
5632 |
('French -> English' (babelFishTranslate: 'fr_en') ) |
|
5633 |
('Italian -> English' (babelFishTranslate: 'it_en') ) |
|
5634 |
('Spanish -> English' (babelFishTranslate: 'es_en') ) |
|
5635 |
('Portuguese -> English' (babelFishTranslate: 'pt_en') ) |
|
5636 |
). |
|
3221 | 5637 |
|
5638 |
sortItems := #( |
|
3731 | 5639 |
('Lines' (sortSelection:ignoreCase: #lines false) ) |
5640 |
('Lines by First Word' (sortSelection:ignoreCase: #linesByFirstWord false) ) |
|
5641 |
('Lines by nth Word' (sortSelection:ignoreCase: #linesByNthWord false) ) |
|
5642 |
('Words' (sortSelection:ignoreCase: #words false) ) |
|
5643 |
('-' ) |
|
5644 |
('Lines (ignore case)' (sortSelection:ignoreCase: #lines true) ) |
|
5645 |
('Lines by First Word (ignore case)'(sortSelection:ignoreCase: #linesByFirstWord true) ) |
|
5646 |
('Lines by nth Word (ignore case)' (sortSelection:ignoreCase: #linesByNthWord true) ) |
|
5647 |
('Words (ignore case)' (sortSelection:ignoreCase: #words true) ) |
|
5648 |
). |
|
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5649 |
|
2762 | 5650 |
toolItems := #( |
3731 | 5651 |
('Indent' indent ) |
4287 | 5652 |
('Toggle Case' convertSelectionToLowercaseOrUppercaseOrUppercaseFirst ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst) |
3731 | 5653 |
('Sort' sort ) |
5654 |
('-' ) |
|
5655 |
('Google Spell' googleSpellingSuggestion ) |
|
5656 |
('Translate' babelFishTranslate ) |
|
5657 |
('Compare with Clipboard...' compareWithClipboard ) |
|
5658 |
). |
|
2762 | 5659 |
|
3623
f99c70d99425
close door to fileBrowser and workspace
Claus Gittinger <cg@exept.de>
parents:
3595
diff
changeset
|
5660 |
Smalltalk isStandAloneApp ifFalse:[ |
3731 | 5661 |
toolItems := toolItems , #( |
5662 |
('-' ) |
|
5663 |
('Open FileBrowser on It' openFileBrowserOnIt ) |
|
5664 |
('Open Workspace with It' openWorkspaceWithIt ) |
|
5665 |
). |
|
3623
f99c70d99425
close door to fileBrowser and workspace
Claus Gittinger <cg@exept.de>
parents:
3595
diff
changeset
|
5666 |
]. |
f99c70d99425
close door to fileBrowser and workspace
Claus Gittinger <cg@exept.de>
parents:
3595
diff
changeset
|
5667 |
|
2460 | 5668 |
sub := PopUpMenu itemList:items resources:resources performer:model. |
2461 | 5669 |
sub receiver:self. |
2460 | 5670 |
|
2919 | 5671 |
toolSub := PopUpMenu itemList:toolItems resources:resources performer:model. |
5672 |
toolSub receiver:self. |
|
5673 |
sub subMenuAt:#tools put:toolSub. |
|
5674 |
||
3495 | 5675 |
transSub := PopUpMenu itemList:translateItems resources:resources performer:model. |
5676 |
transSub receiver:self. |
|
5677 |
toolSub subMenuAt:#babelFishTranslate put:transSub. |
|
5678 |
||
5679 |
sortSub := PopUpMenu itemList:sortItems resources:resources performer:model. |
|
5680 |
sortSub receiver:self. |
|
5681 |
toolSub subMenuAt:#sort put:sortSub. |
|
3221 | 5682 |
|
2866 | 5683 |
subSub := PopUpMenu itemList:miscItems resources:resources performer:model. |
5684 |
subSub receiver:self. |
|
2952 | 5685 |
subSub checkToggleAt:#autoIndent: put:autoIndent. |
3235 | 5686 |
subSub checkToggleAt:#insertMode: put:(self isInInsertMode). |
2952 | 5687 |
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
|
5688 |
|
2866 | 5689 |
sub subMenuAt:#misc put:subSub. |
5690 |
||
3495 | 5691 |
mainItems := #( |
3731 | 5692 |
('Undo' undo Undo ) |
5693 |
('Again' again Again ) |
|
5694 |
('-' ) |
|
5695 |
('Cut' cut Cut ) |
|
5696 |
('Copy' copySelection Copy ) |
|
5697 |
('Paste' pasteOrReplace Paste ) |
|
5698 |
('-' ) |
|
5699 |
('Accept' accept Accept ) |
|
5700 |
('=' ) |
|
5701 |
('More' others Ctrl ) |
|
5702 |
). |
|
3495 | 5703 |
main := PopUpMenu itemList:mainItems resources:resources. |
5704 |
main subMenuAt:#others put:sub. |
|
5705 |
||
5706 |
sensor := self sensor. |
|
5707 |
(sensor notNil and:[sensor ctrlDown]) ifTrue:[ |
|
5708 |
sensor shiftDown ifTrue:[ |
|
3731 | 5709 |
m := subSub |
5710 |
] ifFalse:[ |
|
5711 |
m := sub |
|
5712 |
] |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5713 |
] ifFalse:[ |
3731 | 5714 |
m := main |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5715 |
]. |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5716 |
|
2676 | 5717 |
SOAP::GoogleClient isNil ifTrue:[ |
3731 | 5718 |
"/ GoogleClient new spellingSuggestionOf: 'Smmalltlaak and Soaap'. |
5719 |
m disable:#googleSpellingSuggestion |
|
2676 | 5720 |
]. |
5721 |
||
3811 | 5722 |
HTTPInterface isNil ifTrue:[ |
5723 |
m disableAll:#(insertURL) |
|
5724 |
]. |
|
5725 |
||
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
5726 |
self isReadOnly ifTrue:[ |
3731 | 5727 |
m disableAll:#(undo again multipleAgain redo |
5728 |
paste pasteOrReplace pasteOrReplaceFromHistory |
|
5729 |
cut indent autoIndent: insertMode: |
|
3811 | 5730 |
insertFile insertFileAsStringLiteral insertURL |
5731 |
babelFishTranslate googleSpellingSuggestion sort |
|
3731 | 5732 |
joinLines insertUUID insertDateAndTime pasteAsStringLiteral |
5733 |
specialCharacters) |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5734 |
]. |
2817 | 5735 |
self hasSelectionForCopy ifFalse:[ |
3731 | 5736 |
m disable:#copySelection. |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5737 |
]. |
2416
56acdd9e31b5
lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents:
2406
diff
changeset
|
5738 |
self hasSelection ifFalse:[ |
3731 | 5739 |
m disableAll:#(cut googleSpellingSuggestion babelFishTranslate openFileBrowserOnIt openWorkspaceWithIt sort indent). |
2762 | 5740 |
] ifTrue:[ |
3731 | 5741 |
(Error handle:[:ex | |
5742 |
ex return:false |
|
5743 |
] do:[ |
|
4042 | 5744 |
|fn| |
5745 |
fn := self selectionAsString. |
|
5746 |
fn asFilename exists or:[ fn withoutSeparators withoutQuotes asFilename exists ] |
|
3731 | 5747 |
]) ifFalse:[ |
5748 |
m disableAll:#(openFileBrowserOnIt). |
|
5749 |
] |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5750 |
]. |
2569 | 5751 |
self hasUndoAction ifFalse:[ |
3731 | 5752 |
m disable:#undo. |
3115 | 5753 |
] ifTrue:[ |
3731 | 5754 |
what := undoSupport undoActionInfo. |
5755 |
what notNil ifTrue:[ |
|
5756 |
undoIdx := m indexOf:#undo. |
|
5757 |
m labelAt:undoIdx put:(resources string:'Undo (%1)' with:what). |
|
5758 |
] |
|
1818
aa16d9b96e40
fixed cut to not compress multiple blanks.
Claus Gittinger <cg@exept.de>
parents:
1817
diff
changeset
|
5759 |
]. |
2952 | 5760 |
self hasRedoAction ifFalse:[ |
3731 | 5761 |
sub disable:#redo. |
3569
d3eec21d0ece
also show \"what-would-be-done\" in redo item
Claus Gittinger <cg@exept.de>
parents:
3566
diff
changeset
|
5762 |
] ifTrue:[ |
3731 | 5763 |
what := undoSupport redoActionInfo. |
5764 |
what notNil ifTrue:[ |
|
5765 |
redoIdx := sub indexOf:#redo. |
|
5766 |
sub labelAt:redoIdx put:(resources string:'Redo (%1)' with:what). |
|
5767 |
] |
|
2952 | 5768 |
]. |
1108 | 5769 |
acceptEnabled == false ifTrue:[ |
3731 | 5770 |
m disable:#accept |
1108 | 5771 |
]. |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5772 |
^ m. |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5773 |
|
4287 | 5774 |
"Modified: / 14-07-2011 / 12:13:14 / cg" |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5775 |
! |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5776 |
|
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5777 |
getTextSelectionFromHistory |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5778 |
|sel list box history| |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5779 |
|
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5780 |
history := device getCopyBufferHistory copy. |
3160 | 5781 |
list := history collect:[:entry | |
4165
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5782 |
|text shown| |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5783 |
|
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5784 |
text := entry asString string asCollectionOfLines. |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5785 |
shown := text detect:[:line| line notEmptyOrNil] ifNone:[' ']. |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5786 |
text size > 1 ifTrue:[ |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5787 |
shown := shown,(resources string:' ... [%1 lines]' with:text size). |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5788 |
]. |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5789 |
shown |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5790 |
]. |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5791 |
|
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5792 |
box := ListSelectionBox |
4165
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5793 |
title:(resources string:'Clipboard History') |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5794 |
okText:(resources string:'Paste') |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5795 |
abortText:(resources string:'Cancel') |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5796 |
list:list |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5797 |
action:[:idx | idx notNil ifTrue:[sel := history at:idx]]. |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5798 |
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
|
5799 |
box useIndex:true. |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5800 |
box show. |
3160 | 5801 |
^ sel. |
4165
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5802 |
|
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5803 |
"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
|
5804 |
! |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5805 |
|
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5806 |
getTextSelectionOrTextSelectionFromHistory |
2730
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
5807 |
|
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
5808 |
self sensor shiftDown ifTrue:[ |
3855 | 5809 |
^ self getTextSelectionFromHistory |
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5810 |
]. |
2724 | 5811 |
|
4285
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5812 |
"/ return either the (xterm-) selection or the clipBoard depending on |
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5813 |
"/ the Ctrl-Key state. |
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5814 |
|
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5815 |
"/ ouch - this used to be ok for ALT-c / ALT-v, |
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5816 |
"/ but no longer works with CTRL-c / CTRL-v. |
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5817 |
^ self getClipboardText:#clipboard |
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5818 |
|
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5819 |
"/ ^ self |
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5820 |
"/ getClipboardText:(self sensor ctrlDown |
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5821 |
"/ ifTrue:[#selection] |
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5822 |
"/ ifFalse:[#clipboard]) |
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5823 |
|
8487c7a8fab0
changed: #getTextSelectionOrTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4275
diff
changeset
|
5824 |
"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
|
5825 |
! |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5826 |
|
2676 | 5827 |
googleSpellingSuggestion |
5828 |
"insert the google-spelling suggestion for the selected text. |
|
5829 |
Requires that the SOAP stuff is loaded and working." |
|
5830 |
||
2677 | 5831 |
|text suggestion| |
2676 | 5832 |
|
5833 |
self withWaitCursorDo:[ |
|
3799 | 5834 |
text := self selection asString string withoutSeparators. |
5835 |
text size == 0 ifTrue:[^ self]. |
|
5836 |
||
5837 |
SOAP::SoapImplError handle:[:ex | |
|
5838 |
Dialog warn:('Spelling correction failed - WEB Service error:\\%1.' bindWith:ex description allBold) withCRs. |
|
5839 |
^ self. |
|
5840 |
] do:[ |
|
5841 |
suggestion := SOAP::GoogleClient new spellingSuggestionOf:text. |
|
5842 |
]. |
|
5843 |
suggestion size == 0 ifTrue:[ |
|
5844 |
Transcript showCR:'No SpellingSuggestion from Google for: ' , text. |
|
5845 |
^ self. |
|
5846 |
]. |
|
5847 |
]. |
|
5848 |
self |
|
5849 |
undoablePaste:suggestion |
|
5850 |
info:'Spelling Suggestion'. |
|
3495 | 5851 |
|
5852 |
"Modified: / 28-07-2007 / 13:25:10 / cg" |
|
2676 | 5853 |
! |
5854 |
||
3595 | 5855 |
insertDateAndTime |
5856 |
"insert the curent date and time string" |
|
5857 |
||
5858 |
typeOfSelection := nil. |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5859 |
self |
3786 | 5860 |
undoableDo:[ self pasteOrReplace:(Timestamp now printStringRFC1123Format)] |
3799 | 5861 |
info:'Paste Date and Time' |
3595 | 5862 |
! |
5863 |
||
2676 | 5864 |
insertFile |
3160 | 5865 |
"insert contents of a file |
2676 | 5866 |
- ask user for filename using a fileSelectionBox." |
5867 |
||
3731 | 5868 |
self insertFileAsStringLiteral:false |
5869 |
! |
|
5870 |
||
5871 |
insertFileAsStringLiteral |
|
5872 |
"insert a file's contents as a string literal. |
|
5873 |
Almost the same as the insert file, but single-quotes are doubled, |
|
5874 |
to make it a legal string literal" |
|
5875 |
||
5876 |
self insertFileAsStringLiteral:true |
|
5877 |
! |
|
5878 |
||
5879 |
insertFileAsStringLiteral:asStringLiteral |
|
5880 |
"insert contents of a file; either as-is or as a string literal. |
|
5881 |
- ask user for filename using a fileSelectionBox." |
|
5882 |
||
3409
d650e3ae9085
insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents:
3406
diff
changeset
|
5883 |
|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
|
5884 |
|
d650e3ae9085
insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents:
3406
diff
changeset
|
5885 |
((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
|
5886 |
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
|
5887 |
and:[ selFn isRegularFile ]]) |
d650e3ae9085
insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents:
3406
diff
changeset
|
5888 |
ifTrue:[ |
3731 | 5889 |
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
|
5890 |
]. |
2757
b98097eaf8dc
Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents:
2756
diff
changeset
|
5891 |
|
b98097eaf8dc
Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents:
2756
diff
changeset
|
5892 |
[ |
3731 | 5893 |
|why| |
5894 |
||
5895 |
file := Dialog |
|
5896 |
requestFileName:(resources string:'Insert Contents Of:') |
|
5897 |
default:initial |
|
5898 |
ok:(resources string:'Insert') |
|
5899 |
abort:(resources string:'Cancel') |
|
5900 |
pattern:nil |
|
5901 |
fromDirectory:directoryForFileDialog. |
|
5902 |
file isNil ifTrue:[ |
|
5903 |
"cancel" |
|
5904 |
^ self. |
|
5905 |
]. |
|
5906 |
file := file asFilename. |
|
5907 |
directoryForFileDialog := file. |
|
5908 |
||
5909 |
ok := file isReadable and:[file isDirectory not]. |
|
5910 |
ok ifFalse:[ |
|
5911 |
file isReadable ifFalse:[ |
|
5912 |
why := '%1 is unreadable.\\Please try again.' |
|
5913 |
] ifTrue:[ |
|
5914 |
why := '%1 is a directory.\\Please try again.' |
|
5915 |
]. |
|
5916 |
Dialog warn:(resources stringWithCRs:why with:file pathName). |
|
5917 |
]. |
|
2909 | 5918 |
] doUntil:[ok]. |
2757
b98097eaf8dc
Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents:
2756
diff
changeset
|
5919 |
|
b98097eaf8dc
Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents:
2756
diff
changeset
|
5920 |
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
|
5921 |
self |
3786 | 5922 |
undoableDo:[ self paste:(asStringLiteral ifTrue:[text storeString] ifFalse:[text]) ] |
3799 | 5923 |
info:'Paste File' |
3495 | 5924 |
|
5925 |
"Modified: / 28-07-2007 / 13:23:32 / cg" |
|
5926 |
! |
|
5927 |
||
3811 | 5928 |
insertURL |
5929 |
"insert contents of a URL |
|
5930 |
- ask user for URL using a dialog." |
|
5931 |
||
5932 |
self insertURLAsStringLiteral:false |
|
5933 |
! |
|
5934 |
||
5935 |
insertURLAsStringLiteral:asStringLiteral |
|
5936 |
"insert contents of a file; either as-is or as a string literal. |
|
5937 |
- ask user for filename using a fileSelectionBox." |
|
5938 |
||
5939 |
|sel url text response initial| |
|
5940 |
||
5941 |
(sel := self selectionAsString) notEmptyOrNil |
|
5942 |
ifTrue:[ |
|
5943 |
initial := sel. |
|
5944 |
]. |
|
5945 |
||
5946 |
url := Dialog |
|
5947 |
request:(resources string:'Insert Contents of URL:') |
|
5948 |
initialAnswer:initial |
|
5949 |
okLabel:(resources string:'Insert') |
|
5950 |
title:(resources string:'URL'). |
|
5951 |
url isNil ifTrue:[ |
|
5952 |
"cancel" |
|
5953 |
^ self. |
|
5954 |
]. |
|
5955 |
response := HTTPInterface get:url. |
|
5956 |
response isErrorResponse ifTrue:[ |
|
5957 |
Dialog warn:(resources string:'Could not fetch the document: %1' with:url). |
|
5958 |
^ self. |
|
5959 |
]. |
|
5960 |
text := response data asString. |
|
5961 |
||
5962 |
self |
|
5963 |
undoableDo:[ |
|
5964 |
self paste:(asStringLiteral ifTrue:[text storeString] ifFalse:[text]) |
|
5965 |
] |
|
5966 |
info:'Insert Contents of URL' |
|
5967 |
! |
|
5968 |
||
3495 | 5969 |
insertUUID |
5970 |
"insert a new UUID's string" |
|
5971 |
||
5972 |
typeOfSelection := nil. |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5973 |
self |
3786 | 5974 |
undoableDo:[ self pasteOrReplace:(UUID genUUID printString)] |
3799 | 5975 |
info:'Paste New UUID' |
3495 | 5976 |
|
5977 |
"Created: / 28-07-2007 / 13:01:16 / cg" |
|
2676 | 5978 |
! |
5979 |
||
2762 | 5980 |
openFileBrowserOnIt |
5981 |
"open a fileBrowser on the selected fileName" |
|
5982 |
||
5983 |
|fn dir| |
|
5984 |
||
5985 |
fn := self selectionAsString asFilename. |
|
5986 |
fn exists ifFalse:[ |
|
4042 | 5987 |
fn := self selectionAsString withoutSeparators withoutQuotes asFilename. |
5988 |
fn exists ifFalse:[ |
|
5989 |
^ self warn:'Oops - file is gone'. |
|
5990 |
]. |
|
2762 | 5991 |
]. |
5992 |
(dir := fn) isDirectory ifFalse:[ |
|
4042 | 5993 |
dir := fn directory |
2762 | 5994 |
]. |
5995 |
UserPreferences fileBrowserClass openOn:dir |
|
5996 |
! |
|
5997 |
||
3483
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5998 |
openWorkspaceWithIt |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5999 |
"open a workspace containing the selected text" |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
6000 |
|
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
6001 |
|text| |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
6002 |
|
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
6003 |
text := self selectionAsString. |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
6004 |
WorkspaceApplication openWith:text selected:true |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
6005 |
|
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
6006 |
"Created: / 26-05-2007 / 06:05:22 / cg" |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
6007 |
! |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
6008 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6009 |
paste |
1289 | 6010 |
"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
|
6011 |
Then paste at cursor position." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6012 |
|
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
6013 |
self checkModificationsAllowed ifTrue:[ |
3160 | 6014 |
self withSelfAndTextForPasteDo:[:me :text | |
6015 |
me unselect. |
|
6016 |
me undoablePaste:text |
|
6017 |
] |
|
2952 | 6018 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6019 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6020 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6021 |
paste:someText |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6022 |
"paste someText at cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6023 |
|
3825 | 6024 |
self paste:someText withCR:false |
6025 |
! |
|
6026 |
||
6027 |
paste:someText withCR:withCR |
|
6028 |
"paste someText at cursor" |
|
6029 |
||
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6030 |
|s nLines startLine startCol l1 l2 c1 c2 codingErrorReported| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6031 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
6032 |
self checkModificationsAllowed ifFalse:[^ self]. |
2853
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6033 |
someText isNil ifTrue:[^ self]. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6034 |
|
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6035 |
s := someText. |
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6036 |
codingErrorReported := false. |
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6037 |
CharacterEncoderError handle:[:ex | |
3825 | 6038 |
|code msg| |
6039 |
||
6040 |
code := ex parameter. |
|
6041 |
codingErrorReported ifFalse:[ |
|
6042 |
msg := 'Cannot represent pasted string in this Views encoding (',characterEncoding,').'. |
|
6043 |
code notNil ifTrue:[ |
|
6044 |
msg := msg , '\\Reason: No representation for ' , (code radixPrintStringRadix:16). |
|
6045 |
]. |
|
6046 |
Dialog warn:(resources stringWithCRs:msg). |
|
6047 |
codingErrorReported := true. |
|
6048 |
]. |
|
6049 |
ex proceedWith:ex defaultValue |
|
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6050 |
] do:[ |
3825 | 6051 |
s isString ifTrue:[ |
6052 |
s encoding ~~ characterEncoding ifTrue:[ |
|
6053 |
s := s encodeFrom:(s encoding) into:characterEncoding. |
|
6054 |
]. |
|
6055 |
||
6056 |
s := s asStringCollection. |
|
6057 |
(someText endsWith:Character cr) ifTrue:[ |
|
6058 |
"/ s := s copyWith:nil. |
|
6059 |
s := s copyWith:'' "/ an empty line at the end |
|
6060 |
||
6061 |
] |
|
6062 |
] ifFalse:[ |
|
6063 |
s isStringCollection ifTrue:[ |
|
6064 |
s := s encodeFrom:(s encoding) into:characterEncoding. |
|
6065 |
] ifFalse:[ |
|
6066 |
(self |
|
6067 |
confirm:(resources |
|
6068 |
stringWithCRs:'Selection (%1) is not convertable to Text.\\Paste storeString ?' |
|
6069 |
with:s class name)) ifFalse:[^ self]. |
|
6070 |
s := StringCollection with:s storeString . |
|
6071 |
"/ ^ self |
|
6072 |
]. |
|
6073 |
]. |
|
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6074 |
]. |
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6075 |
|
2853
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6076 |
(nLines := s size) == 0 ifTrue:[^ self]. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6077 |
(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
|
6078 |
|
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6079 |
typeOfSelection := #paste. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6080 |
|
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6081 |
startLine := l1 := cursorLine. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6082 |
startCol := c1 := cursorCol. |
3180 | 6083 |
|
4328 | 6084 |
"do not expand tabs into spaces here - |
3180 | 6085 |
they get expanded in basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr. |
6086 |
Some Subviews want to paste with unexpanded tabs!!" |
|
6087 |
||
3825 | 6088 |
self insertLines:s withCR:withCR. |
2853
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6089 |
l2 := cursorLine. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6090 |
c2 := (cursorCol - 1). |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6091 |
self selectFromLine:l1 col:c1 toLine:l2 col:c2. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6092 |
typeOfSelection := #paste. "/ sigh - cleared by #selectFromLine: |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
6093 |
|
4328 | 6094 |
"Modified: / 14-02-1996 / 11:14:14 / stefan" |
6095 |
"Modified: / 30-01-2000 / 02:32:42 / cg" |
|
6096 |
"Modified (comment): / 07-10-2011 / 15:42:40 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6097 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6098 |
|
3731 | 6099 |
pasteAsStringLiteral |
6100 |
"insert clipboard string as a string literal. |
|
6101 |
Almost the same as a normal paste, but single-quotes are doubled, |
|
6102 |
to make it a legal string literal" |
|
6103 |
||
6104 |
typeOfSelection := nil. |
|
6105 |
self |
|
3786 | 6106 |
undoableDo:[ self pasteOrReplace:(self getClipboardText storeString) ] |
6107 |
info:'Paste as String Literal' |
|
3731 | 6108 |
! |
6109 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6110 |
pasteOrReplace |
1289 | 6111 |
"paste the copybuffer; if there is a selection, replace it. |
3160 | 6112 |
otherwise paste at cursor position. |
6113 |
Replace is not done for selections which were created by a paste, |
|
2010 | 6114 |
to allow multiple paste operations in a row." |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6115 |
|
2724 | 6116 |
self withSelfAndTextForPasteDo:[:me :text | me pasteOrReplace:text] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6117 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6118 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6119 |
pasteOrReplace:someText |
1289 | 6120 |
"paste someText; if there is a selection, replace it. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6121 |
otherwise paste at cursor position. Replace is not done |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6122 |
for originating by a paste, to allow multiple |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6123 |
paste." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6124 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
6125 |
self checkModificationsAllowed ifFalse:[^ self]. |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
6126 |
|
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
6127 |
self undoableDo:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6128 |
((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
|
6129 |
self replace:someText |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6130 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6131 |
self paste:someText. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6132 |
] |
3542 | 6133 |
] info:'Paste/Replace'. |
1289 | 6134 |
|
2107
9d44232af0a0
textSelection fixes (added newLine) for MSDOS;
Claus Gittinger <cg@exept.de>
parents:
2101
diff
changeset
|
6135 |
"Modified: / 30.1.2000 / 02:33:00 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6136 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6137 |
|
3474
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6138 |
pasteOrReplaceFromHistory |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6139 |
"paste a previous item from the copybuffer history. |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6140 |
(i.e. repaste some previously deleted or copied text)" |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6141 |
|
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6142 |
|text| |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6143 |
|
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6144 |
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
|
6145 |
self flash. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6146 |
^ self |
3474
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6147 |
]. |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6148 |
text := self getTextSelectionFromHistory. |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6149 |
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
|
6150 |
self pasteOrReplace:text |
3474
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6151 |
] |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6152 |
! |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6153 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6154 |
replace |
1289 | 6155 |
"replace the selection by the contents of the copybuffer" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6156 |
|
3269
03d04670a5d2
replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
6157 |
self hasSelection ifFalse:[^ self]. |
03d04670a5d2
replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
6158 |
self checkModificationsAllowed ifFalse:[^ self]. |
03d04670a5d2
replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
6159 |
|
03d04670a5d2
replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
6160 |
self withSelfAndTextForPasteDo:[:me :text | |
3786 | 6161 |
me undoableDo:[ me replace:text ] |
6162 |
info:'Replace' |
|
2952 | 6163 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6164 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6165 |
|
121 | 6166 |
replace:someText |
1289 | 6167 |
"replace the selection by someText" |
121 | 6168 |
|
3160 | 6169 |
|selected selectedString |
6170 |
selStartLine selStartCol selEndLine selEndCol| |
|
121 | 6171 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
6172 |
self checkModificationsAllowed ifFalse:[^ self]. |
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
6173 |
|
3130 | 6174 |
self undoableDo:[ |
4010 | 6175 |
selected := self selection. |
6176 |
selected isNil ifTrue:[ |
|
6177 |
^ self paste:someText |
|
6178 |
]. |
|
6179 |
||
6180 |
self deleteSelection. |
|
6181 |
||
6182 |
"take care, if we replace a selection without space by a word selected |
|
6183 |
with one - in this case we usually do not want the space. |
|
6184 |
But, if we replace a word-selected selection by something without a |
|
6185 |
space, we DO want the space added." |
|
6186 |
||
6187 |
selected size == 1 ifTrue:[ |
|
6188 |
selectedString := selected at:1. |
|
6189 |
]. |
|
6190 |
||
6191 |
someText size == 1 ifTrue:[ |
|
6192 |
|cutOffSpace addSpace replacement replacementString| |
|
6193 |
||
6194 |
cutOffSpace := false. |
|
6195 |
addSpace := false. |
|
6196 |
replacement := someText copyFrom:1. |
|
6197 |
||
6198 |
selectedString notNil ifTrue:[ |
|
6199 |
((selectedString startsWith:' ') or:[selectedString endsWith:' ']) ifFalse:[ |
|
6200 |
"selection has no space" |
|
6201 |
||
6202 |
((selectStyle == #wordleft) or:[selectStyle == #wordRight]) ifTrue:[ |
|
6203 |
cutOffSpace := true |
|
6204 |
] |
|
6205 |
] ifTrue:[ |
|
6206 |
addSpace := true |
|
6207 |
] |
|
6208 |
]. |
|
6209 |
replacementString := replacement at:1. |
|
6210 |
cutOffSpace ifTrue:[ |
|
6211 |
(replacementString startsWith:' ') ifTrue:[ |
|
6212 |
replacementString := replacementString withoutSpaces |
|
6213 |
]. |
|
6214 |
] ifFalse:[ |
|
6215 |
selectStyle == #wordLeft ifTrue:[ |
|
6216 |
"want a space at left" |
|
6217 |
(replacementString startsWith:' ') ifFalse:[ |
|
6218 |
replacementString := replacementString withoutSpaces. |
|
6219 |
replacementString := ' ' , replacementString |
|
6220 |
] |
|
6221 |
]. |
|
6222 |
selectStyle == #wordRight ifTrue:[ |
|
6223 |
"want a space at right" |
|
6224 |
||
6225 |
(replacementString endsWith:' ') ifFalse:[ |
|
6226 |
replacementString := replacementString withoutSpaces. |
|
6227 |
replacementString := replacementString , ' ' |
|
6228 |
] |
|
6229 |
]. |
|
6230 |
]. |
|
6231 |
replacement at:1 put: replacementString. |
|
6232 |
self paste:replacement. |
|
6233 |
] ifFalse:[ |
|
6234 |
self paste:someText |
|
6235 |
]. |
|
4053 | 6236 |
self setLastStringToReplace: selectedString. |
6237 |
||
4048 | 6238 |
lastReplacementInfo lastReplacement: someText. |
4010 | 6239 |
|
6240 |
selStartLine := selectionStartLine. |
|
6241 |
selStartCol := self selectionStartCol. |
|
6242 |
selEndLine := selectionEndLine. |
|
6243 |
selEndCol := self selectionEndCol. |
|
3130 | 6244 |
] |
3542 | 6245 |
info:'Replace' |
362
3993ba6c31a0
Expand tabs before pasting a string.
Stefan Vogel <sv@exept.de>
parents:
331
diff
changeset
|
6246 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
6247 |
"Modified: / 14.2.1996 / 10:37:02 / stefan" |
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
6248 |
"Modified: / 5.4.1998 / 16:55:28 / cg" |
121 | 6249 |
! |
6250 |
||
3430 | 6251 |
searchReplace |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6252 |
"search for a string - show a box to enter searchpattern |
3430 | 6253 |
replace for the found searchpattern or replace all searchpattern found to a new pattern - show a box to enter replacepattern |
6254 |
- 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
|
6255 |
|
3430 | 6256 |
|searchBox patternHolder replacePatternHolder caseHolder flag ign initialString bindings bldr search modal replace action| |
6257 |
||
6258 |
modal := false "(UserPreferences current searchDialogIsModal)". |
|
6259 |
lastSearchDirection := #forward. |
|
6260 |
ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. |
|
6261 |
caseHolder := ign asValue. |
|
6262 |
patternHolder := '' asValue. |
|
6263 |
replacePatternHolder := '' asValue. |
|
6264 |
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
|
6265 |
initialString := lastSearchPattern |
3430 | 6266 |
]. |
6267 |
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
|
6268 |
initialString := self selectionAsString |
3430 | 6269 |
]. |
6270 |
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
|
6271 |
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
|
6272 |
initialString := LastSearchPatterns first |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6273 |
] |
3430 | 6274 |
]. |
6275 |
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
|
6276 |
patternHolder value:initialString. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6277 |
replacePatternHolder value:initialString. |
3430 | 6278 |
]. |
6279 |
flag := true. |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6280 |
search := [:fwd | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6281 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6282 |
search:patternHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6283 |
ignoreCase:caseHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6284 |
forward:fwd. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6285 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6286 |
replace := [:all | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6287 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6288 |
replace:patternHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6289 |
by:replacePatternHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6290 |
all:all |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6291 |
ignoreCase:caseHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6292 |
]. |
3430 | 6293 |
bindings := IdentityDictionary new. |
6294 |
bindings at:#searchPattern put:patternHolder. |
|
6295 |
bindings at:#replacePattern put:replacePatternHolder. |
|
6296 |
modal ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6297 |
bindings at:#nextAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6298 |
put:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6299 |
flag := true. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6300 |
action := search. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6301 |
searchBox doAccept. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6302 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6303 |
bindings at:#prevAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6304 |
put:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6305 |
flag := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6306 |
action := search. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6307 |
searchBox doAccept. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6308 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6309 |
bindings at:#replaceAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6310 |
put:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6311 |
flag := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6312 |
action := replace. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6313 |
searchBox doAccept. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6314 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6315 |
bindings at:#replaceAllAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6316 |
put:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6317 |
flag := true. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6318 |
action := replace. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6319 |
searchBox doAccept. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6320 |
]. |
3430 | 6321 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6322 |
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
|
6323 |
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
|
6324 |
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
|
6325 |
bindings at:#replaceAllAction put:[ replace value:true. ]. |
3430 | 6326 |
]. |
6327 |
bindings at:#ignoreCase put:caseHolder. |
|
6328 |
bindings at:#patternList put:LastSearchPatterns. |
|
6329 |
modal ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6330 |
searchBox := SimpleDialog new. |
3430 | 6331 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6332 |
searchBox := ApplicationModel new. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6333 |
searchBox createBuilder. |
3430 | 6334 |
]. |
6335 |
searchBox resources:(self resources). |
|
6336 |
bldr := searchBox builder. |
|
6337 |
bldr addBindings:bindings. |
|
6338 |
searchBox allButOpenFrom:(self class searchReplaceDialogSpec). |
|
6339 |
(bldr componentAt:#nextButton) cursor:(Cursor thumbsUp). |
|
6340 |
(bldr componentAt:#prevButton) cursor:(Cursor thumbsUp). |
|
6341 |
(bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown). |
|
6342 |
modal ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6343 |
searchBox openDialog. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6344 |
searchBox accepted ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6345 |
action value:flag |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6346 |
]. |
3430 | 6347 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6348 |
(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
|
6349 |
(bldr componentAt:#cancelButton) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6350 |
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
|
6351 |
action:[ searchBox closeRequest ]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6352 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6353 |
"/ 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
|
6354 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6355 |
self topView beMaster. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6356 |
(searchBox window) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6357 |
beSlave; |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6358 |
openInGroup:(self windowGroup). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6359 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6360 |
"/ searchBox window open. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6361 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6362 |
searchBox window assignKeyboardFocusToFirstInputField. |
3430 | 6363 |
] |
6364 |
||
6365 |
"Modified: / 11-07-2006 / 11:20:06 / fm" |
|
6366 |
! |
|
6367 |
||
121 | 6368 |
showDeleted |
6369 |
"open a readonly editor on all deleted text" |
|
6370 |
||
6371 |
|v| |
|
6372 |
||
6373 |
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
|
6374 |
v readOnly:true. |
121 | 6375 |
v topView label:'deleted text'. |
2624
22d352e56c27
preps for special characters
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6376 |
! |
22d352e56c27
preps for special characters
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6377 |
|
3221 | 6378 |
sort:how ignoreCase:ignoreCase fromLine:start toLine:end |
6379 |
"sort the selected lines" |
|
6380 |
||
6381 |
|lines extractor fetcher lineWise nStr n s words| |
|
6382 |
||
6383 |
lineWise := true. |
|
6384 |
||
6385 |
how == #lines ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6386 |
extractor := [:l | l withoutLeadingSeparators]. |
3221 | 6387 |
] ifFalse:[ how == #linesByFirstWord ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6388 |
extractor := [:l | ((l asCollectionOfWords select:[:w | w isEmpty or:[w first isLetterOrDigit]]) at:1 ifAbsent:'')]. |
3221 | 6389 |
] ifFalse:[ how == #linesByNthWord ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6390 |
nStr := Dialog request:'Word (1..)'. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6391 |
nStr isEmptyOrNil ifTrue:[^ self]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6392 |
n := Integer readFrom:nStr onError:[^ self]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6393 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6394 |
extractor := [:l | ((l asCollectionOfWords) at:n ifAbsent:'')]. |
3221 | 6395 |
] ifFalse:[ how == #words ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6396 |
lineWise := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6397 |
extractor := [:w | w]. |
3221 | 6398 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6399 |
self error:'unknown sort criteria: ', how printString. |
3221 | 6400 |
]]]]. |
6401 |
||
6402 |
ignoreCase ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6403 |
fetcher := [:l | (extractor value:l) asLowercase]. |
3221 | 6404 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6405 |
fetcher := extractor. |
3221 | 6406 |
]. |
6407 |
||
6408 |
lineWise ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6409 |
start == end ifTrue:[^ self ]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6410 |
lines := (start to:end) collect:[:lineNr | (self listAt:lineNr) ? '']. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6411 |
lines := lines sort:[:l1 :l2 | (fetcher value:l1) < (fetcher value:l2)]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6412 |
(start to:end) with:lines do:[:lineNr :line | self replaceLine:lineNr with:line]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6413 |
self textChanged. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6414 |
^ self. |
3221 | 6415 |
]. |
6416 |
||
6417 |
s := self selectionAsString. |
|
6418 |
words := s asCollectionOfWords. |
|
6419 |
words := words sort:[:w1 :w2 | (fetcher value:w1) < (fetcher value:w2)]. |
|
6420 |
s := words asStringCollection asStringWith:Character space. |
|
6421 |
self replace:s. |
|
6422 |
self textChanged. |
|
6423 |
! |
|
6424 |
||
6425 |
sortSelection:how ignoreCase:ignoreCase |
|
6426 |
"sort the selected lines" |
|
6427 |
||
6428 |
|start end| |
|
6429 |
||
6430 |
selectionStartLine isNil ifTrue:[^ self]. |
|
6431 |
||
6432 |
start := selectionStartLine. |
|
6433 |
end := selectionEndLine. |
|
6434 |
(selectionEndCol == 0) ifTrue:[ |
|
3786 | 6435 |
end := end - 1 |
3221 | 6436 |
]. |
6437 |
||
6438 |
self |
|
3786 | 6439 |
undoableDo:[ self sort:how ignoreCase:ignoreCase fromLine:start toLine:end ] |
6440 |
info:'Sort' |
|
3221 | 6441 |
! |
6442 |
||
2624
22d352e56c27
preps for special characters
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6443 |
specialCharacters |
2915 | 6444 |
CharacterSetView |
3160 | 6445 |
openAsInputFor:self |
6446 |
label:'Special Character Input' |
|
6447 |
clickLabel:'Click to Insert Character'. |
|
2866 | 6448 |
! |
6449 |
||
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
6450 |
undoablePaste:someText |
3495 | 6451 |
self undoablePaste:someText info:nil. |
6452 |
||
6453 |
"Modified: / 28-07-2007 / 13:25:46 / cg" |
|
6454 |
! |
|
6455 |
||
6456 |
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
|
6457 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6458 |
undoableDo:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6459 |
self paste:someText. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6460 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6461 |
info:infoOrNil |
3495 | 6462 |
|
6463 |
"Created: / 28-07-2007 / 13:25:30 / cg" |
|
6464 |
! |
|
6465 |
||
6466 |
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
|
6467 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6468 |
undoableDo:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6469 |
self pasteOrReplace:someText. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6470 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6471 |
info:infoOrNil |
3495 | 6472 |
|
6473 |
"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
|
6474 |
! |
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
6475 |
|
4114
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6476 |
undoablePasteReplacingAll:someText info:infoOrNil |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6477 |
self |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6478 |
undoableDo:[ |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6479 |
self selectAll. |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6480 |
self pasteOrReplace:someText. |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6481 |
] |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6482 |
info:infoOrNil |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6483 |
|
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6484 |
"Created: / 28-07-2007 / 13:25:30 / cg" |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6485 |
! |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6486 |
|
2724 | 6487 |
withSelfAndTextForPasteDo:aBlock |
6488 |
"common code for paste/replace of the copybuffer" |
|
6489 |
||
6490 |
|sel| |
|
6491 |
||
6492 |
self checkModificationsAllowed ifFalse:[ |
|
3160 | 6493 |
self flash. |
6494 |
^ self |
|
2724 | 6495 |
]. |
6496 |
||
6497 |
sel := self getTextSelectionOrTextSelectionFromHistory. |
|
6498 |
sel notNil ifTrue:[ |
|
3160 | 6499 |
aBlock value:self value:sel. |
2724 | 6500 |
] |
105 | 6501 |
! ! |
6502 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6503 |
!EditTextView methodsFor:'private'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6504 |
|
3880 | 6505 |
beep |
6506 |
UserPreferences current beepInEditor ifTrue:[ |
|
6507 |
super beep |
|
6508 |
] |
|
6509 |
! |
|
6510 |
||
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
6511 |
checkModificationsAllowed |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
6512 |
"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
|
6513 |
evaluate the exceptionBlock if not. |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
6514 |
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
|
6515 |
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
|
6516 |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
6517 |
self isReadOnly ifTrue: [ |
3160 | 6518 |
exceptionBlock isNil ifTrue:[ |
6519 |
^ false |
|
6520 |
]. |
|
6521 |
||
6522 |
(exceptionBlock value:'Text may not be modified') ~~ true ifTrue:[ |
|
6523 |
^ false |
|
6524 |
] |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
6525 |
]. |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
6526 |
^ true |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
6527 |
|
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
6528 |
"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
|
6529 |
! |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
6530 |
|
2596 | 6531 |
currentSelectionBgColor |
6532 |
typeOfSelection == #paste ifTrue:[ |
|
3160 | 6533 |
^ DefaultAlternativeSelectionBackgroundColor ? selectionBgColor |
2596 | 6534 |
]. |
6535 |
^ super currentSelectionBgColor |
|
6536 |
||
6537 |
" |
|
6538 |
DefaultAlternativeSelectionBackgroundColor := Color yellow blendWith:Color green |
|
6539 |
" |
|
6540 |
! |
|
6541 |
||
6542 |
currentSelectionFgColor |
|
6543 |
typeOfSelection == #paste ifTrue:[ |
|
3160 | 6544 |
^ DefaultAlternativeSelectionForegroundColor ? selectionFgColor |
2596 | 6545 |
]. |
6546 |
^ super currentSelectionFgColor |
|
6547 |
! |
|
6548 |
||
3996 | 6549 |
resetVariablesBeforeNewSearch |
6550 |
||
6551 |
super resetVariablesBeforeNewSearch. |
|
6552 |
||
6553 |
"/ new search invalidates remembered string |
|
4048 | 6554 |
lastStringFromReplaceForNextSearch := nil. |
3996 | 6555 |
! |
6556 |
||
4053 | 6557 |
setLastStringToReplace: aString |
6558 |
||
6559 |
"This method will set the information coming from the last replace into the replacementInfo" |
|
6560 |
||
6561 |
|lastReplaceIgnoredCase| |
|
6562 |
||
4064 | 6563 |
"/ The searchAction is mantained until a cut/replace or a search with a user selection is done |
6564 |
self clearSearchAction. |
|
6565 |
||
4053 | 6566 |
lastReplacementInfo lastStringToReplace: aString. |
6567 |
lastStringFromReplaceForNextSearch := aString. |
|
6568 |
||
6569 |
"If the replace came after a search, the next replace will have the ignored case from that search action" |
|
4107 | 6570 |
lastReplaceIgnoredCase := (typeOfSelection == #search) |
6571 |
ifTrue: [lastSearchIgnoredCase] |
|
6572 |
ifFalse: [nil]. |
|
4053 | 6573 |
lastReplacementInfo lastReplaceIgnoredCase: lastReplaceIgnoredCase. |
6574 |
! |
|
6575 |
||
2647
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
6576 |
st80EditMode |
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
6577 |
^ st80Mode ? (UserPreferences current st80EditMode) |
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
6578 |
! |
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
6579 |
|
2225
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6580 |
suppressEmphasisInSelection |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6581 |
"selection is shown without emphasis" |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6582 |
|
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6583 |
^ true |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6584 |
! |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6585 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6586 |
textChanged |
522 | 6587 |
"my text was modified (internally). |
6588 |
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
|
6589 |
contentsChanged, which is triggered when the size has changed, and |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6590 |
is used to notify scrollers, other views etc.)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6591 |
|
641 | 6592 |
self contentsChanged. |
1015 | 6593 |
self modified:true. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6594 |
contentsWasSaved := false |
641 | 6595 |
|
1015 | 6596 |
"Modified: 14.2.1997 / 16:58:38 / cg" |
2207 | 6597 |
! |
6598 |
||
2617 | 6599 |
textChangedButNoSizeChange |
2207 | 6600 |
"my text was modified (internally). |
6601 |
Sent whenever text has been edited (not to confuse with |
|
6602 |
contentsChanged, which is triggered when the size has changed, and |
|
6603 |
is used to notify scrollers, other views etc.)" |
|
6604 |
||
6605 |
self modified:true. |
|
6606 |
contentsWasSaved := false |
|
6607 |
||
6608 |
"Modified: 14.2.1997 / 16:58:38 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6609 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6610 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6611 |
!EditTextView methodsFor:'queries'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6612 |
|
1526
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6613 |
currentLine |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6614 |
"the current line (for relative gotos)" |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6615 |
|
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6616 |
^ cursorLine |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6617 |
|
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6618 |
"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
|
6619 |
! |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6620 |
|
4064 | 6621 |
hasSearchActionSelection |
6622 |
||
6623 |
^ typeOfSelection == #searchAction |
|
6624 |
! |
|
6625 |
||
1878 | 6626 |
isKeyboardConsumer |
6627 |
"return true, if the receiver is a keyboard consumer; |
|
6628 |
Return true here, redefined from SimpleView." |
|
6629 |
||
3476 | 6630 |
^ self isReadOnly not |
1878 | 6631 |
! |
6632 |
||
997 | 6633 |
specClass |
1390 | 6634 |
"redefined, since the name of my specClass is nonStandard (i.e. not EditTextSpec)" |
6635 |
||
997 | 6636 |
self class == EditTextView ifTrue:[^ TextEditorSpec]. |
1049 | 6637 |
^ super specClass |
6638 |
||
1390 | 6639 |
"Modified: / 31.10.1997 / 19:48:19 / cg" |
997 | 6640 |
! |
6641 |
||
324 | 6642 |
tabMeansNextField |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
6643 |
"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
|
6644 |
|
313
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
6645 |
"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
|
6646 |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
6647 |
^ self isReadOnly or:[tabMeansNextField] |
324 | 6648 |
|
6649 |
"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
|
6650 |
! |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
6651 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6652 |
widthOfContents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6653 |
"return the width of the contents in pixels |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6654 |
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
|
6655 |
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
|
6656 |
line (and possibly see the cursor behind the line)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6657 |
|
697 | 6658 |
|w dev| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6659 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6660 |
w := super widthOfContents. |
697 | 6661 |
(dev := device) isNil ifTrue:[ |
3160 | 6662 |
"/ really dont know ... |
6663 |
dev := Screen current |
|
606
682579fa3b62
fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
6664 |
]. |
697 | 6665 |
^ w + (font widthOn:dev) |
6666 |
||
6667 |
"Modified: 28.5.1996 / 19:32:25 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6668 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6669 |
|
1588 | 6670 |
!EditTextView methodsFor:'realization'! |
6671 |
||
6672 |
realize |
|
6673 |
"make the view visible - scroll to make the cursor visible." |
|
6674 |
||
6675 |
super realize. |
|
6676 |
||
6677 |
self makeCursorVisible. |
|
1993 | 6678 |
cursorFgColor := cursorFgColor onDevice:device. |
6679 |
cursorBgColor := cursorBgColor onDevice:device. |
|
1588 | 6680 |
|
6681 |
"Modified: 20.12.1996 / 14:16:05 / cg" |
|
6682 |
"Created: 24.7.1997 / 18:24:12 / cg" |
|
6683 |
! ! |
|
6684 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6685 |
!EditTextView methodsFor:'redrawing'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6686 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6687 |
redrawCursorIfBetweenVisibleLine:startVisLine and:endVisLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6688 |
"redraw the cursor, if it sits in a line range" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6689 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6690 |
cursorShown ifTrue:[ |
3160 | 6691 |
cursorVisibleLine notNil ifTrue:[ |
6692 |
(cursorVisibleLine between:startVisLine and:endVisLine) ifTrue:[ |
|
6693 |
self drawCursorCharacter |
|
6694 |
] |
|
6695 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6696 |
] |
105 | 6697 |
! |
6698 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6699 |
redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6700 |
"redraw the cursor, if it sits in visible line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6701 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6702 |
cursorShown ifTrue:[ |
3160 | 6703 |
(visLine == cursorVisibleLine) ifTrue:[ |
6704 |
self drawCursorCharacter |
|
6705 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6706 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6707 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6708 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6709 |
redrawFromVisibleLine:startVisLine to:endVisLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6710 |
"redraw a visible line range" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6711 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6712 |
super redrawFromVisibleLine:startVisLine to:endVisLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6713 |
self redrawCursorIfBetweenVisibleLine:startVisLine and:endVisLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6714 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6715 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6716 |
redrawVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6717 |
"redraw a visible line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6718 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6719 |
super redrawVisibleLine:visLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6720 |
self redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6721 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6722 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6723 |
redrawVisibleLine:visLine col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6724 |
"redraw the single character in visibleline at colNr" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6725 |
|
3510
4bd0b20bd05d
cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents:
3495
diff
changeset
|
6726 |
super redrawVisibleLine:visLine col:colNr. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6727 |
cursorShown ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6728 |
(visLine == cursorVisibleLine) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6729 |
(colNr == cursorCol) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6730 |
self drawCursorCharacter. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6731 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6732 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6733 |
] |
3510
4bd0b20bd05d
cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents:
3495
diff
changeset
|
6734 |
]. |
4bd0b20bd05d
cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents:
3495
diff
changeset
|
6735 |
|
4bd0b20bd05d
cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents:
3495
diff
changeset
|
6736 |
"Modified: / 05-11-2007 / 17:35:53 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6737 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6738 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6739 |
redrawVisibleLine:visLine from:startCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6740 |
"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
|
6741 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6742 |
super redrawVisibleLine:visLine from:startCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6743 |
self redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6744 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6745 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6746 |
redrawVisibleLine:visLine from:startCol to:endCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6747 |
"redraw a visible line from startCol to endCol" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6748 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6749 |
super redrawVisibleLine:visLine from:startCol to:endCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6750 |
self redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6751 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6752 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6753 |
!EditTextView methodsFor:'scrolling'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6754 |
|
2331
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6755 |
additionalMarginForHorizontalScroll |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6756 |
"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
|
6757 |
width of the document would allow. |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6758 |
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
|
6759 |
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
|
6760 |
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
|
6761 |
|
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6762 |
^ 10 max:font width |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6763 |
! |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6764 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6765 |
halfPageDown |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6766 |
"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
|
6767 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6768 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6769 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6770 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6771 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6772 |
super halfPageDown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6773 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6774 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6775 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6776 |
halfPageUp |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6777 |
"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
|
6778 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6779 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6780 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6781 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6782 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6783 |
super halfPageUp. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6784 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6785 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6786 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6787 |
originChanged:delta |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6788 |
"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
|
6789 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6790 |
super originChanged:delta. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6791 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6792 |
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
|
6793 |
" |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
6794 |
self updateCursorVisibleLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6795 |
prevCursorState ifTrue:[ |
3160 | 6796 |
self showCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6797 |
] |
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
6798 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
6799 |
"Modified: / 17.6.1998 / 16:13:24 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6800 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6801 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6802 |
originWillChange |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6803 |
"sent before scrolling - have to hide the cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6804 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6805 |
prevCursorState := cursorShown. |
1601 | 6806 |
"/ cursorShown := false. |
1591 | 6807 |
cursorShown ifTrue:[ |
3160 | 6808 |
self hideCursor |
1591 | 6809 |
] |
6810 |
||
1601 | 6811 |
"Modified: / 6.7.1998 / 13:07:23 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6812 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6813 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6814 |
pageDown |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6815 |
"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
|
6816 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6817 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6818 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6819 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6820 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6821 |
super pageDown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6822 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6823 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6824 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6825 |
pageUp |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6826 |
"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
|
6827 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6828 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6829 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6830 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6831 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6832 |
super pageUp. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6833 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6834 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6835 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6836 |
!EditTextView methodsFor:'searching'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6837 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6838 |
searchBwd:pattern ifAbsent:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6839 |
"do a backward search" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6840 |
|
2822 | 6841 |
self searchBwd:pattern ignoreCase:false ifAbsent:aBlock |
1339 | 6842 |
! |
6843 |
||
6844 |
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
6845 |
"do a backward search" |
|
6846 |
||
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6847 |
|pos startLine startCol| |
1339 | 6848 |
|
6849 |
cursorLine isNil ifTrue:[^ self]. |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6850 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6851 |
pos := self startPositionForSearchBackward. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6852 |
startLine := pos y. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6853 |
startCol := pos x. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6854 |
|
3580 | 6855 |
self searchBwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock |
6856 |
||
6857 |
"Modified: 9.10.1997 / 13:02:13 / cg" |
|
6858 |
! |
|
6859 |
||
6860 |
searchBwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock |
|
6861 |
"do a backward search" |
|
6862 |
||
6863 |
cursorLine isNil ifTrue:[^ self]. |
|
6864 |
||
3160 | 6865 |
self |
4119 | 6866 |
searchBackwardFor:pattern |
6867 |
ignoreCase:ign |
|
6868 |
startingAtLine:startLine col:startCol |
|
6869 |
ifFound:[:line :col | |
|
6870 |
self cursorMovementAllowed ifTrue:[ |
|
6871 |
self cursorLine:line col:col. |
|
6872 |
]. |
|
6873 |
self showMatch:pattern isMatch:false atLine:line col:col. |
|
1339 | 6874 |
"/ self makeLineVisible:cursorLine |
4119 | 6875 |
typeOfSelection := #search] |
6876 |
ifAbsent:aBlock |
|
1339 | 6877 |
|
6878 |
"Modified: 9.10.1997 / 13:02:13 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6879 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6880 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6881 |
searchForAndSelectMatchingParenthesis |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6882 |
"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
|
6883 |
|
2554 | 6884 |
self searchForAndSelectMatchingParenthesisFromLine:cursorLine col:cursorCol |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6885 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6886 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6887 |
searchForMatchingParenthesis |
3160 | 6888 |
"search for a matching parenthesis starting at cursor position. |
6889 |
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
|
6890 |
backwards if its a closing parenthesis. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6891 |
Positions the cursor if found, peeps if not" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6892 |
|
2822 | 6893 |
self cursorMovementAllowed ifFalse:[^ self]. |
6894 |
||
3160 | 6895 |
self |
6896 |
searchForMatchingParenthesisFromLine:cursorLine col:cursorCol |
|
6897 |
ifFound:[:line :col | self cursorLine:line col:col] |
|
6898 |
ifNotFound:[self showNotFound] |
|
6899 |
onError:[self beep] |
|
1339 | 6900 |
|
6901 |
"Modified: 9.10.1997 / 12:56:30 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6902 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6903 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6904 |
searchFwd:pattern ifAbsent:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6905 |
"do a forward search" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6906 |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6907 |
|pos startLine startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6908 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6909 |
pos := self startPositionForSearchForward. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6910 |
startLine := pos y. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6911 |
startCol := pos x. |
1339 | 6912 |
|
3160 | 6913 |
self |
6914 |
searchFwd:pattern |
|
6915 |
startingAtLine:startLine col:startCol |
|
6916 |
ifAbsent:aBlock |
|
1339 | 6917 |
|
6918 |
"Modified: 9.10.1997 / 12:58:59 / cg" |
|
6919 |
! |
|
6920 |
||
6921 |
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
6922 |
"do a forward search" |
|
6923 |
||
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6924 |
|pos startLine startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6925 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6926 |
pos := self startPositionForSearchForward. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6927 |
startLine := pos y. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6928 |
startCol := pos x. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6929 |
|
3160 | 6930 |
self |
6931 |
searchFwd:pattern |
|
6932 |
ignoreCase:ign |
|
6933 |
startingAtLine:startLine col:startCol |
|
6934 |
ifAbsent:aBlock |
|
1339 | 6935 |
|
6936 |
"Modified: 9.10.1997 / 12:58:59 / cg" |
|
6937 |
"Created: 9.10.1997 / 13:04:10 / cg" |
|
6938 |
! |
|
6939 |
||
3967 | 6940 |
searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock |
1339 | 6941 |
"do a forward search" |
6942 |
||
6943 |
cursorLine isNil ifTrue:[^ self]. |
|
3967 | 6944 |
self |
6945 |
searchForwardFor:pattern |
|
6946 |
ignoreCase:ign |
|
6947 |
match: match |
|
6948 |
startingAtLine:startLine col:startCol |
|
6949 |
ifFound:[:line :col | |
|
6950 |
self cursorMovementAllowed ifTrue:[ |
|
6951 |
self cursorLine:line col:col. |
|
6952 |
]. |
|
4119 | 6953 |
self showMatch:pattern isMatch:match atLine:line col:col. |
1339 | 6954 |
"/ self makeLineVisible:cursorLine |
3967 | 6955 |
typeOfSelection := #search |
6956 |
] |
|
6957 |
ifAbsent:aBlock |
|
1339 | 6958 |
|
6959 |
"Modified: 9.10.1997 / 12:57:47 / cg" |
|
6960 |
"Created: 9.10.1997 / 13:01:12 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6961 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6962 |
|
3967 | 6963 |
searchFwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock |
6964 |
"do a forward search" |
|
6965 |
||
6966 |
self searchFwd:pattern ignoreCase:ign match: false startingAtLine:startLine col:startCol ifAbsent:aBlock |
|
6967 |
! |
|
6968 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6969 |
searchFwd:pattern startingAtLine:startLine col:startCol ifAbsent:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6970 |
"do a forward search" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6971 |
|
2822 | 6972 |
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
|
6973 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6974 |
|
3982 | 6975 |
searchPatternForSearchBar |
6976 |
||
6977 |
"Returns the next searchPattern from the user selection or from the autoSearch" |
|
6978 |
||
6979 |
|searchPattern| |
|
6980 |
||
4138 | 6981 |
searchPattern := self searchPatternFromUserSelectionOrReplace. |
3982 | 6982 |
searchPattern isNil |
6983 |
ifTrue: [searchPattern := lastSearchPattern] |
|
6984 |
ifFalse: [lastSearchPattern := searchPattern]. |
|
6985 |
^ searchPattern |
|
6986 |
! |
|
6987 |
||
3578 | 6988 |
setSearchPatternWithMatchEscapes: match |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6989 |
"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
|
6990 |
cursor to start of pattern" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6991 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6992 |
|sel| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6993 |
|
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6994 |
"/ |
3967 | 6995 |
"/ 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
|
6996 |
"/ original string (for search after again) |
4121 | 6997 |
"/ 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
|
6998 |
"/ |
4249
44daffb1b034
comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents:
4248
diff
changeset
|
6999 |
"/ (lastStringFromReplaceForNextSearch notNil |
44daffb1b034
comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents:
4248
diff
changeset
|
7000 |
"/ and:[typeOfSelection ~~ #search]) ifTrue:[ |
44daffb1b034
comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents:
4248
diff
changeset
|
7001 |
"/ lastStringFromReplaceForNextSearch isString ifTrue:[ |
44daffb1b034
comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents:
4248
diff
changeset
|
7002 |
"/ lastSearchPattern := lastStringFromReplaceForNextSearch. |
44daffb1b034
comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents:
4248
diff
changeset
|
7003 |
"/ ] ifFalse:[ |
44daffb1b034
comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents:
4248
diff
changeset
|
7004 |
"/ lastSearchPattern := lastStringFromReplaceForNextSearch asStringWithoutFinalCR. |
44daffb1b034
comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents:
4248
diff
changeset
|
7005 |
"/ ]. |
44daffb1b034
comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents:
4248
diff
changeset
|
7006 |
"/ ^ self |
44daffb1b034
comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents:
4248
diff
changeset
|
7007 |
"/ ]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7008 |
|
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
7009 |
"/ |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
7010 |
"/ if there is a selection: |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
7011 |
"/ 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
|
7012 |
"/ if there was a previous search, only take the selection if |
3967 | 7013 |
"/ 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
|
7014 |
"/ (to allow search-paste to be repeated) |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
7015 |
"/ |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7016 |
sel := self selection. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7017 |
sel notNil ifTrue:[ |
3967 | 7018 |
(lastSearchPattern isNil |
7019 |
or:[typeOfSelection ~~ #paste |
|
7020 |
and:[typeOfSelection ~~ #search]]) ifTrue:[ |
|
7021 |
self cursorLine:selectionStartLine col:selectionStartCol. |
|
7022 |
lastSearchPattern := sel asStringWithoutFinalCR. |
|
7023 |
match ifTrue:[lastSearchPattern := lastSearchPattern withMatchEscapes]. |
|
7024 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7025 |
] |
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
7026 |
|
4249
44daffb1b034
comment/format in: #deleteCopyToClipboard:
Claus Gittinger <cg@exept.de>
parents:
4248
diff
changeset
|
7027 |
"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
|
7028 |
! |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7029 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7030 |
startPositionForSearchBackward |
2822 | 7031 |
^ self startPositionForSearchBackwardBasedOnCursorOrSelection |
7032 |
! |
|
7033 |
||
7034 |
startPositionForSearchBackwardBasedOnCursorOrSelection |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7035 |
|startLine startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7036 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7037 |
selectionStartLine notNil ifTrue:[ |
3160 | 7038 |
startLine := selectionStartLine. |
7039 |
startCol := selectionStartCol |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7040 |
] ifFalse:[ |
3160 | 7041 |
cursorLine isNil ifTrue:[ |
7042 |
startLine := list size. |
|
7043 |
startCol := self listAt:startLine size. |
|
7044 |
] ifFalse:[ |
|
7045 |
startLine := cursorLine min:list size. |
|
7046 |
startCol := cursorCol |
|
7047 |
] |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7048 |
]. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7049 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7050 |
^ startCol @ cursorLine |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7051 |
! |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7052 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7053 |
startPositionForSearchForward |
2822 | 7054 |
^ self startPositionForSearchForwardBasedOnCursorOrSelection |
7055 |
! |
|
7056 |
||
7057 |
startPositionForSearchForwardBasedOnCursorOrSelection |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7058 |
|startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7059 |
|
3160 | 7060 |
"/ 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
|
7061 |
"/ 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
|
7062 |
startCol := cursorCol. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7063 |
self hasSelection ifFalse:[ |
4064 | 7064 |
(cursorLine == 1 and:[cursorCol == 1]) ifTrue:[ |
7065 |
startCol := 0 |
|
7066 |
]. |
|
7067 |
startCol := startCol min:(self at:cursorLine) size |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7068 |
]. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7069 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
7070 |
^ startCol @ cursorLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7071 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7072 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7073 |
!EditTextView methodsFor:'selections'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7074 |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7075 |
addToSelectionAfter:aBlock |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7076 |
"Pokud existuje selekce, upravi ji |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7077 |
podle aktualni pozice kurzoru a pozice |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7078 |
po provedeni blocku. |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7079 |
Urceno k implementaci Shift-Home a Shift-End |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7080 |
Nejak nevim, jak to presneji popsat :-)" |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7081 |
|
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7082 |
|startLine startCol endLine endCol | |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7083 |
|
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7084 |
self hasSelection ifTrue: [ |
3160 | 7085 |
startLine := selectionStartLine . |
7086 |
startCol := selectionStartCol . |
|
7087 |
endLine := selectionEndLine . |
|
7088 |
endCol := selectionEndCol . |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7089 |
] ifFalse: [ |
3160 | 7090 |
startLine := endLine := cursorLine . |
7091 |
startCol := endCol := cursorCol . |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7092 |
]. |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7093 |
|
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7094 |
"deselectim a provedu presun kurzoru..." |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7095 |
self unselect . |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7096 |
aBlock value . |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7097 |
|
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7098 |
"funguje dost mizerne, jen na jednom radku..." |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7099 |
(startCol - cursorCol) abs <= (endCol - cursorCol) abs |
3160 | 7100 |
ifTrue: [ |
7101 |
startCol := cursorCol. |
|
7102 |
] ifFalse: [ |
|
7103 |
endCol := cursorCol - 1. |
|
7104 |
]. |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7105 |
self selectFromLine:startLine col:startCol toLine: endLine col:endCol . |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7106 |
! |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
7107 |
|
1850 | 7108 |
autoMoveCursorToEndOfSelection |
7109 |
"return true, if the cursor should be automatically moved to the |
|
7110 |
end of a selection. |
|
3963
c315f087d655
comment in: #autoMoveCursorToEndOfSelection
Claus Gittinger <cg@exept.de>
parents:
3945
diff
changeset
|
7111 |
Redefined to return false in terminalViews, where the cursor should |
1850 | 7112 |
not be affected by selecting" |
7113 |
||
7114 |
^ true |
|
7115 |
! |
|
7116 |
||
2606
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
7117 |
changeTypeOfSelectionTo:newType |
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
7118 |
typeOfSelection ~~ newType ifTrue:[ |
3160 | 7119 |
typeOfSelection := newType. |
7120 |
selectionStartLine notNil ifTrue:[ |
|
7121 |
self |
|
7122 |
redrawFromLine:selectionStartLine col:selectionStartCol |
|
7123 |
toLine:selectionEndLine col:selectionEndCol |
|
7124 |
]. |
|
2606
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
7125 |
]. |
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
7126 |
! |
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
7127 |
|
4138 | 7128 |
searchPatternFromUserSelectionOrReplace |
7129 |
||
7130 |
|sel searchPattern| |
|
7131 |
||
7132 |
"/ |
|
7133 |
"/ if the last operation was a replace, set pattern to last |
|
7134 |
"/ original string (for search after again) |
|
7135 |
"/ |
|
7136 |
(lastStringFromReplaceForNextSearch notNil |
|
7137 |
and:[typeOfSelection ~~ #search]) ifTrue:[ |
|
7138 |
lastStringFromReplaceForNextSearch isString ifTrue:[ |
|
7139 |
searchPattern := lastStringFromReplaceForNextSearch. |
|
7140 |
] ifFalse:[ |
|
7141 |
searchPattern := lastStringFromReplaceForNextSearch asStringWithoutFinalCR. |
|
7142 |
]. |
|
7143 |
^ searchPattern |
|
7144 |
]. |
|
7145 |
||
7146 |
"/ |
|
7147 |
"/ if there is a selection: |
|
7148 |
"/ if there was no previous search, take it as search pattern. |
|
7149 |
"/ if there was a previous search, only take the selection if |
|
7150 |
"/ it did not result from a paste. |
|
7151 |
"/ (to allow search-paste to be repeated) |
|
7152 |
"/ |
|
7153 |
sel := self selection. |
|
7154 |
sel notNil ifTrue:[ |
|
7155 |
typeOfSelection ~~ #search ifTrue:[ |
|
7156 |
typeOfSelection ~~ #paste ifTrue:[ |
|
7157 |
self cursorLine:selectionStartLine col:selectionStartCol. |
|
7158 |
searchPattern := sel asStringWithoutFinalCR. |
|
7159 |
] |
|
7160 |
]. |
|
7161 |
]. |
|
7162 |
||
7163 |
^ searchPattern |
|
7164 |
! |
|
7165 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7166 |
selectAll |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7167 |
"select the whole text. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7168 |
redefined to send super selectFrom... since we dont want the |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7169 |
cursor to be moved in this case." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7170 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7171 |
list isNil ifTrue:[ |
3160 | 7172 |
self unselect |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7173 |
] ifFalse:[ |
3160 | 7174 |
super selectFromLine:1 col:1 toLine:(list size + 1) col:0. |
7175 |
typeOfSelection := nil |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7176 |
] |
1082 | 7177 |
|
7178 |
"Modified: 28.2.1997 / 19:14:54 / cg" |
|
259
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 |
|
4117 | 7181 |
selectAllInitially |
7182 |
"select the whole text. This is called only once during the initialization |
|
7183 |
for editFields which are shown in a table or tree. |
|
7184 |
The selectAll is called via this method to allow for easier redefinition and |
|
7185 |
to distinguish auto-select from user-initiated selects." |
|
7186 |
||
7187 |
self selectAll |
|
7188 |
! |
|
7189 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7190 |
selectCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7191 |
"select cursorline" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7192 |
|
3160 | 7193 |
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
|
7194 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7195 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7196 |
selectCursorLineFromBeginning |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7197 |
"select cursorline up to cursor position" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7198 |
|
823
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
7199 |
cursorCol > 1 ifTrue:[ |
3160 | 7200 |
self selectFromLine:cursorLine col:1 |
7201 |
toLine:cursorLine col:(cursorCol-1) |
|
823
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
7202 |
] |
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
7203 |
|
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
7204 |
"Modified: 16.8.1996 / 19:14:14 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7205 |
! |
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 |
selectExpandCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7208 |
"expand selection by one line or select cursorline" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7209 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7210 |
selectionStartLine isNil ifTrue:[ |
3160 | 7211 |
self selectCursorLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7212 |
] ifFalse:[ |
3160 | 7213 |
self selectFromLine:selectionStartLine col:selectionStartCol |
7214 |
toLine:cursorLine+1 col:0. |
|
7215 |
self makeLineVisible:selectionEndLine |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7216 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7217 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7218 |
|
4257 | 7219 |
selectFromBeginOfLine |
7220 |
"select the text from the beginning of the current line to the current cursor position." |
|
7221 |
||
4271 | 7222 |
| newCursorCol | |
7223 |
||
4257 | 7224 |
list isNil ifTrue:[ |
7225 |
self unselect |
|
7226 |
] ifFalse:[ |
|
7227 |
cursorCol > 1 ifTrue:[ |
|
4271 | 7228 |
newCursorCol := (list at: cursorLine) indexOfNonSeparator. |
7229 |
self selectFromLine:cursorLine col:newCursorCol toLine:cursorLine col:cursorCol-1. |
|
7230 |
cursorCol := newCursorCol. |
|
4257 | 7231 |
typeOfSelection := nil |
7232 |
] |
|
7233 |
] |
|
7234 |
||
7235 |
"Created: / 28-06-2011 / 22:47:04 / cg" |
|
4271 | 7236 |
"Modified: / 29-06-2011 / 19:20:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4257 | 7237 |
! |
7238 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7239 |
selectFromBeginning |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7240 |
"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
|
7241 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7242 |
|col| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7243 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7244 |
list isNil ifTrue:[ |
3160 | 7245 |
self unselect |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7246 |
] ifFalse:[ |
3160 | 7247 |
cursorCol == 0 ifTrue:[ |
7248 |
col := 0 |
|
7249 |
] ifFalse:[ |
|
7250 |
col := cursorCol - 1 |
|
7251 |
]. |
|
7252 |
super selectFromLine:1 col:1 toLine:cursorLine col:col. |
|
7253 |
typeOfSelection := nil |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7254 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7255 |
! |
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 |
selectFromLine:startLine col:startCol toLine:endLine col:endCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7258 |
"when a range is selected, position the cursor behind the selection |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7259 |
for easier editing. Also typeOfSelection is nilled here." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7260 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7261 |
super selectFromLine:startLine col:startCol toLine:endLine col:endCol. |
1850 | 7262 |
(selectionEndLine notNil and:[self autoMoveCursorToEndOfSelection]) ifTrue:[ |
3160 | 7263 |
self cursorLine:selectionEndLine col:(selectionEndCol + 1). |
1198 | 7264 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7265 |
typeOfSelection := nil |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7266 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7267 |
|
4257 | 7268 |
selectToEndOfLine |
7269 |
"select the text from the current cursor position to the end of the current line" |
|
7270 |
||
4271 | 7271 |
| newCursorCol line | |
7272 |
||
4257 | 7273 |
list isNil ifTrue:[ |
7274 |
self unselect |
|
7275 |
] ifFalse:[ |
|
4275
16c80f32c06c
bug fix in #selectToEndOfLine
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4271
diff
changeset
|
7276 |
cursorCol >= 1 ifTrue:[ |
4271 | 7277 |
line := list at: cursorLine. |
7278 |
newCursorCol := line size. |
|
7279 |
[ newCursorCol > 1 and:[(line at:newCursorCol) isSeparator] ] |
|
7280 |
whileTrue:[newCursorCol := newCursorCol - 1]. |
|
7281 |
||
7282 |
self selectFromLine:cursorLine col:cursorCol toLine:cursorLine col: newCursorCol. |
|
7283 |
cursorCol := newCursorCol. |
|
4257 | 7284 |
typeOfSelection := nil |
7285 |
] |
|
7286 |
] |
|
7287 |
||
7288 |
"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
|
7289 |
"Modified: / 30-06-2011 / 19:51:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4257 | 7290 |
! |
7291 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7292 |
selectUpToEnd |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7293 |
"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
|
7294 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7295 |
list isNil ifTrue:[ |
3160 | 7296 |
self unselect |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7297 |
] ifFalse:[ |
3160 | 7298 |
super selectFromLine:cursorLine col:cursorCol toLine:(list size + 1) col:0. |
7299 |
typeOfSelection := nil |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7300 |
] |
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 |
selectWordUnderCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7304 |
"select the word under the cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7305 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7306 |
self selectWordAtLine:cursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7307 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7308 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7309 |
unselect |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7310 |
"forget and unhilight selection - must take care of cursor here" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7311 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7312 |
|wasOn| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7313 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7314 |
wasOn := self hideCursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7315 |
super unselect. |
2606
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
7316 |
typeOfSelection := nil. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7317 |
wasOn ifTrue:[self showCursor] |
105 | 7318 |
! ! |
7319 |
||
7320 |
!EditTextView methodsFor:'undo & again'! |
|
7321 |
||
2952 | 7322 |
addUndo:action |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7323 |
^ undoSupport addUndo:action. |
2952 | 7324 |
! |
7325 |
||
105 | 7326 |
again |
7327 |
"repeat the last action (which was a cut or replace). |
|
7328 |
If current selection is not last string, search forward to |
|
3160 | 7329 |
next occurrence of it before repeating the last operation." |
105 | 7330 |
|
4048 | 7331 |
|s l c sel savedSelectStyle startColForSearch |
4051 | 7332 |
lastStringToReplace lastReplaceIgnoredCase lastReplaceWasMatch| |
4048 | 7333 |
|
7334 |
lastStringToReplace := lastReplacementInfo lastStringToReplace. |
|
4010 | 7335 |
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
|
7336 |
^ false |
2579
74d3798f4200
do not remove separators from replacement string
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
7337 |
]. |
4048 | 7338 |
lastReplaceIgnoredCase := lastReplacementInfo lastReplaceIgnoredCase. |
7339 |
lastReplaceWasMatch := lastReplacementInfo lastReplaceWasMatch. |
|
2579
74d3798f4200
do not remove separators from replacement string
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
7340 |
|
3127
29767bf8a215
better info of replace action (compound-undo-action has info, too)
Claus Gittinger <cg@exept.de>
parents:
3115
diff
changeset
|
7341 |
self undoableDo:[ |
4010 | 7342 |
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
|
7343 |
"remove final cr" |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7344 |
(s endsWith:Character cr) ifTrue:[s := s copyWithoutLast:1]. |
3127
29767bf8a215
better info of replace action (compound-undo-action has info, too)
Claus Gittinger <cg@exept.de>
parents:
3115
diff
changeset
|
7345 |
"/ s := s withoutSpaces. "XXX - replacing text with spaces ..." |
4010 | 7346 |
|
4053 | 7347 |
"set lastStringToReplace as the next search string |
7348 |
and set lastReplaceIgnoredCase as the next search ignored case flag" |
|
4048 | 7349 |
lastStringFromReplaceForNextSearch := s. |
4053 | 7350 |
lastSearchIgnoredCase := lastReplaceIgnoredCase. |
4010 | 7351 |
|
3816
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7352 |
savedSelectStyle := selectStyle. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7353 |
selectStyle := nil. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7354 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7355 |
sel := self selection. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7356 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7357 |
"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
|
7358 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7359 |
(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
|
7360 |
l := selectionStartLine "cursorLine". |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7361 |
c := selectionStartCol "cursorCol". |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7362 |
self deleteSelection. |
4051 | 7363 |
lastReplacementInfo lastReplacement notNil ifTrue:[ |
7364 |
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
|
7365 |
self selectFromLine:l col:c 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
|
7366 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7367 |
selectStyle := savedSelectStyle. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7368 |
^ true |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7369 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7370 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7371 |
sel isEmptyOrNil ifTrue:[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7372 |
startColForSearch := cursorCol - 1 |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7373 |
] ifFalse:[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7374 |
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
|
7375 |
]. |
4048 | 7376 |
self |
7377 |
searchForwardFor:s |
|
7378 |
ignoreCase: lastReplaceIgnoredCase |
|
7379 |
match: lastReplaceWasMatch |
|
7380 |
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
|
7381 |
ifFound: |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7382 |
[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7383 |
:line :col | |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7384 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7385 |
|repl| |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7386 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7387 |
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
|
7388 |
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
|
7389 |
self makeLineVisible:line. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7390 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7391 |
self deleteSelection. |
4051 | 7392 |
lastReplacementInfo lastReplacement notNil ifTrue:[ |
7393 |
lastReplacementInfo lastReplacement isString ifFalse:[ |
|
7394 |
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
|
7395 |
] ifTrue:[ |
4051 | 7396 |
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
|
7397 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7398 |
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
|
7399 |
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
|
7400 |
undoSupport actionInfo:'replace'. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7401 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7402 |
selectStyle := savedSelectStyle. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7403 |
^ true |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7404 |
] |
4048 | 7405 |
ifAbsent: |
3816
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7406 |
[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7407 |
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
|
7408 |
self showNotFound. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7409 |
selectStyle := savedSelectStyle. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7410 |
^ false |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7411 |
]. |
3127
29767bf8a215
better info of replace action (compound-undo-action has info, too)
Claus Gittinger <cg@exept.de>
parents:
3115
diff
changeset
|
7412 |
]. |
2730
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
7413 |
|
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
7414 |
^ true. |
501 | 7415 |
|
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
7416 |
"Modified: 9.10.1996 / 16:14:11 / cg" |
105 | 7417 |
! |
7418 |
||
2952 | 7419 |
hasRedoAction |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7420 |
^ undoSupport hasRedoAction. |
2952 | 7421 |
! |
7422 |
||
7423 |
hasUndoAction |
|
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7424 |
^ undoSupport hasUndoAction. |
2952 | 7425 |
! |
7426 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7427 |
multipleAgain |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7428 |
"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
|
7429 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7430 |
[self again] whileTrue:[] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7431 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7432 |
|
2952 | 7433 |
nonUndoableDo:aBlock |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7434 |
undoSupport nonUndoableDo:aBlock. |
2952 | 7435 |
! |
7436 |
||
7437 |
redo |
|
3780 | 7438 |
"undo the last undo" |
7439 |
||
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7440 |
undoSupport hasRedoAction ifFalse:[ |
3780 | 7441 |
self beep |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7442 |
] ifTrue:[ |
3780 | 7443 |
undoSupport redo. |
2952 | 7444 |
] |
7445 |
! |
|
7446 |
||
121 | 7447 |
undo |
3780 | 7448 |
"undo the last edit operation" |
7449 |
||
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7450 |
undoSupport hasUndoAction ifFalse:[ |
3780 | 7451 |
self beep |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7452 |
] ifTrue:[ |
3780 | 7453 |
undoSupport undo. |
121 | 7454 |
] |
2952 | 7455 |
! |
7456 |
||
7457 |
undoableDo:aBlock |
|
3495 | 7458 |
self undoableDo:aBlock info:nil. |
7459 |
||
7460 |
"Modified: / 28-07-2007 / 13:20:14 / cg" |
|
3130 | 7461 |
! |
7462 |
||
7463 |
undoableDo:aBlock info:aString |
|
3154
42bf7ebd54c8
refadctored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
7464 |
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
|
7465 |
"/ 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
|
7466 |
aBlock value. |
3154
42bf7ebd54c8
refadctored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
7467 |
] ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7468 |
undoSupport undoableDo:aBlock info:aString. |
3495 | 7469 |
]. |
7470 |
||
7471 |
"Modified: / 28-07-2007 / 13:21:00 / cg" |
|
2952 | 7472 |
! ! |
7473 |
||
7474 |
!EditTextView::EditAction class methodsFor:'instance creation'! |
|
7475 |
||
7476 |
line1:arg1 col1:arg2 line2:arg3 col2:arg4 |
|
7477 |
^ self new line1:arg1 col1:arg2 line2:arg3 col2:arg4 |
|
7478 |
! |
|
7479 |
||
3115 | 7480 |
line1:arg1 col1:arg2 line2:arg3 col2:arg4 info:info |
3160 | 7481 |
^ (self new line1:arg1 col1:arg2 line2:arg3 col2:arg4) info:info |
3115 | 7482 |
! |
7483 |
||
2952 | 7484 |
line:arg1 col:arg2 character:arg3 |
7485 |
^ self new line:arg1 col:arg2 character:arg3 |
|
7486 |
! |
|
7487 |
||
3115 | 7488 |
line:arg1 col:arg2 character:arg3 info:info |
3160 | 7489 |
^ (self new line:arg1 col:arg2 character:arg3) info:info |
3115 | 7490 |
! |
7491 |
||
3235 | 7492 |
line:arg1 col:arg2 characters:arg3 info:info |
7493 |
^ (self new line:arg1 col:arg2 characters:arg3) info:info |
|
7494 |
! |
|
7495 |
||
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7496 |
line:arg1 col:arg2 info:arg3 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7497 |
^ self new line:arg1 col:arg2 info:arg3 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7498 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7499 |
|
2952 | 7500 |
line:arg1 col:arg2 string:arg3 |
7501 |
^ self new line:arg1 col:arg2 string:arg3 |
|
3115 | 7502 |
! |
7503 |
||
7504 |
line:arg1 col:arg2 string:arg3 info:info |
|
7505 |
^ (self new line:arg1 col:arg2 string:arg3) info:info |
|
3130 | 7506 |
! |
7507 |
||
7508 |
line:arg1 string:arg3 info:info |
|
7509 |
^ (self new line:arg1 string:arg3) info:info |
|
3131 | 7510 |
! |
7511 |
||
7512 |
text:arg info:info |
|
7513 |
^ (self new text:arg) info:info |
|
3115 | 7514 |
! ! |
7515 |
||
7516 |
!EditTextView::EditAction methodsFor:'accessing'! |
|
7517 |
||
7518 |
info |
|
7519 |
^ userFriendlyInfo |
|
7520 |
! |
|
7521 |
||
7522 |
info:aString |
|
7523 |
userFriendlyInfo := aString |
|
2952 | 7524 |
! ! |
7525 |
||
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7526 |
!EditTextView::EditAction methodsFor:'combining'! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7527 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7528 |
canCombineWithPreviousPasteStringAction: aPasteStringAction |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7529 |
^ false. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7530 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7531 |
"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
|
7532 |
! ! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7533 |
|
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7534 |
!EditTextView::EditAction methodsFor:'queries'! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7535 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7536 |
canCombineWithNext:nextAction |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7537 |
^ false |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7538 |
! ! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7539 |
|
2952 | 7540 |
!EditTextView::DeleteRange methodsFor:'accessing'! |
7541 |
||
3160 | 7542 |
line1:line1Arg col1:col1Arg line2:line2Arg col2:col2Arg |
2952 | 7543 |
"set instance variables (automatically generated)" |
7544 |
||
7545 |
self assert:(line1Arg notNil). |
|
7546 |
self assert:(col1Arg notNil). |
|
7547 |
self assert:(line2Arg notNil). |
|
7548 |
self assert:(col2Arg notNil). |
|
7549 |
||
7550 |
line1 := line1Arg. |
|
7551 |
col1 := col1Arg. |
|
7552 |
line2 := line2Arg. |
|
7553 |
col2 := col2Arg. |
|
7554 |
! ! |
|
7555 |
||
7556 |
!EditTextView::DeleteRange methodsFor:'execution'! |
|
7557 |
||
3160 | 7558 |
executeIn:editor |
2952 | 7559 |
editor unselect. |
3160 | 7560 |
editor |
7561 |
deleteFromLine:line1 |
|
7562 |
col:col1 |
|
7563 |
toLine:line2 |
|
7564 |
col:col2. |
|
2952 | 7565 |
editor cursorLine:line1 col:col1. |
7566 |
! ! |
|
7567 |
||
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7568 |
!EditTextView::DeleteCharacters methodsFor:'accessing'! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7569 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7570 |
col1 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7571 |
^ col1 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7572 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7573 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7574 |
col2 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7575 |
^ col2 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7576 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7577 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7578 |
line |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7579 |
^ line |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7580 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7581 |
|
3160 | 7582 |
line:lineArg col1:col1Arg col2:col2Arg |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7583 |
"set instance variables (automatically generated)" |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7584 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7585 |
self assert:(lineArg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7586 |
self assert:(col1Arg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7587 |
self assert:(col2Arg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7588 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7589 |
line := lineArg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7590 |
col1 := col1Arg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7591 |
col2 := col2Arg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7592 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7593 |
|
3160 | 7594 |
line:lineArg col:colArg info:infoArg |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7595 |
self assert:(lineArg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7596 |
self assert:(colArg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7597 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7598 |
line := lineArg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7599 |
col1 := col2 := colArg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7600 |
self info:infoArg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7601 |
! ! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7602 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7603 |
!EditTextView::DeleteCharacters methodsFor:'combining'! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7604 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7605 |
canCombineWithNext:anotherAction |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7606 |
^ anotherAction perform:#canCombineWithPreviousDeleteCharactersAction: with:self ifNotUnderstood:false |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7607 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7608 |
|
3160 | 7609 |
canCombineWithPreviousDeleteCharactersAction:previousDeleteAction |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7610 |
"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
|
7611 |
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
|
7612 |
(i.e. single-character typing)" |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7613 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7614 |
previousDeleteAction line == line ifTrue:[ |
3160 | 7615 |
previousDeleteAction col2 == (col1-1) ifTrue:[ |
7616 |
^ true |
|
7617 |
]. |
|
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7618 |
]. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7619 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7620 |
^ false |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7621 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7622 |
|
3160 | 7623 |
combineWithNext:nextDeleteAction |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7624 |
self assert:(line == nextDeleteAction line). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7625 |
self assert:(col2 == (nextDeleteAction col1 - 1)). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7626 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7627 |
col2 := nextDeleteAction col2. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7628 |
userFriendlyInfo := 'insert ' , (col2 - col1 + 1) printString |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7629 |
! ! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7630 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7631 |
!EditTextView::DeleteCharacters methodsFor:'execution'! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7632 |
|
3160 | 7633 |
executeIn:editor |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7634 |
editor unselect. |
3160 | 7635 |
editor |
7636 |
deleteFromLine:line |
|
7637 |
col:col1 |
|
7638 |
toLine:line |
|
7639 |
col:col2. |
|
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7640 |
editor cursorLine:line col:col1. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7641 |
! ! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7642 |
|
3235 | 7643 |
!EditTextView::EditMode class methodsFor:'constants'! |
7644 |
||
7645 |
insertAndSelectMode |
|
7646 |
^ InsertAndSelectMode |
|
7647 |
! |
|
7648 |
||
7649 |
insertMode |
|
7650 |
^ InsertMode |
|
7651 |
! |
|
7652 |
||
7653 |
overwriteMode |
|
7654 |
^ OverwriteMode |
|
7655 |
! ! |
|
7656 |
||
7657 |
!EditTextView::EditMode class methodsFor:'queries'! |
|
7658 |
||
7659 |
isInsertAndSelectMode |
|
7660 |
^ false |
|
7661 |
! |
|
7662 |
||
7663 |
isInsertMode |
|
7664 |
^ false |
|
7665 |
! |
|
7666 |
||
7667 |
symbolicName |
|
7668 |
self subclassResponsibility |
|
7669 |
! ! |
|
7670 |
||
7671 |
!EditTextView::EditMode::InsertAndSelectMode class methodsFor:'info'! |
|
7672 |
||
7673 |
infoPrintString |
|
7674 |
^ 'IS' |
|
7675 |
! ! |
|
7676 |
||
7677 |
!EditTextView::EditMode::InsertAndSelectMode class methodsFor:'queries'! |
|
7678 |
||
7679 |
isInsertAndSelectMode |
|
7680 |
^ true |
|
7681 |
! |
|
7682 |
||
7683 |
isInsertMode |
|
7684 |
^ true |
|
7685 |
! ! |
|
7686 |
||
7687 |
!EditTextView::EditMode::InsertMode class methodsFor:'info'! |
|
7688 |
||
7689 |
infoPrintString |
|
7690 |
^ 'I' |
|
7691 |
! ! |
|
7692 |
||
7693 |
!EditTextView::EditMode::InsertMode class methodsFor:'queries'! |
|
7694 |
||
7695 |
isInsertMode |
|
7696 |
^ true |
|
7697 |
! ! |
|
7698 |
||
7699 |
!EditTextView::EditMode::OverwriteMode class methodsFor:'info'! |
|
7700 |
||
7701 |
infoPrintString |
|
7702 |
^ 'O' |
|
7703 |
! ! |
|
7704 |
||
4048 | 7705 |
!EditTextView::LastReplacementInfo methodsFor:'accessing'! |
7706 |
||
7707 |
lastReplaceIgnoredCase |
|
7708 |
^ lastReplaceIgnoredCase ? false |
|
7709 |
! |
|
7710 |
||
7711 |
lastReplaceIgnoredCase:something |
|
7712 |
lastReplaceIgnoredCase := something. |
|
7713 |
! |
|
7714 |
||
7715 |
lastReplaceWasMatch |
|
7716 |
^ lastReplaceWasMatch ? false |
|
7717 |
! |
|
7718 |
||
7719 |
lastReplaceWasMatch:something |
|
7720 |
lastReplaceWasMatch := something. |
|
7721 |
! |
|
7722 |
||
7723 |
lastReplacement |
|
7724 |
^ lastReplacement |
|
7725 |
! |
|
7726 |
||
7727 |
lastReplacement:something |
|
4053 | 7728 |
"/Transcript showCR: 'lastReplacement:', something printString. |
4048 | 7729 |
lastReplacement := something. |
7730 |
! |
|
7731 |
||
7732 |
lastStringToReplace |
|
7733 |
^ lastStringToReplace |
|
7734 |
! |
|
7735 |
||
7736 |
lastStringToReplace:something |
|
7737 |
lastStringToReplace := something. |
|
7738 |
! ! |
|
7739 |
||
2952 | 7740 |
!EditTextView::PasteString methodsFor:'accessing'! |
7741 |
||
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7742 |
col |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7743 |
^ col |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7744 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7745 |
"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
|
7746 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7747 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7748 |
col2 |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7749 |
^ col + string size - 1 |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7750 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7751 |
"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
|
7752 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7753 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7754 |
line |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7755 |
^ line |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7756 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7757 |
"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
|
7758 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7759 |
|
3160 | 7760 |
line:lineArg col:colArg string:stringArg |
2952 | 7761 |
self assert:(lineArg notNil). |
7762 |
self assert:(colArg notNil). |
|
7763 |
self assert:(stringArg notNil). |
|
7764 |
||
7765 |
line := lineArg. |
|
7766 |
col := colArg. |
|
7767 |
string := stringArg. |
|
7768 |
! |
|
7769 |
||
7770 |
line:lineArg col:colArg string:stringArg selected:selectedArg |
|
7771 |
self assert:(lineArg notNil). |
|
7772 |
self assert:(colArg notNil). |
|
7773 |
self assert:(stringArg notNil). |
|
7774 |
||
7775 |
line := lineArg. |
|
7776 |
col := colArg. |
|
7777 |
string := stringArg. |
|
7778 |
selected := selectedArg. |
|
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7779 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7780 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7781 |
string |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7782 |
^ string |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7783 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7784 |
"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
|
7785 |
! ! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7786 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7787 |
!EditTextView::PasteString methodsFor:'combining'! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7788 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7789 |
canCombineWithNext:anotherAction |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7790 |
^ anotherAction canCombineWithPreviousPasteStringAction:self |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7791 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7792 |
"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
|
7793 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7794 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7795 |
canCombineWithPreviousPasteStringAction: previousPasteAction |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7796 |
"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
|
7797 |
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
|
7798 |
(i.e. single-character deletes)" |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7799 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7800 |
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
|
7801 |
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
|
7802 |
^ true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7803 |
]. |
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7804 |
]. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7805 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7806 |
^ false |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7807 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7808 |
"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
|
7809 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7810 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7811 |
combineWithNext:nextPasteAction |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7812 |
|s1 s2| |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7813 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7814 |
self assert:(line == nextPasteAction line). |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7815 |
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
|
7816 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7817 |
s1 := nextPasteAction string. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7818 |
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
|
7819 |
s2 := string. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7820 |
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
|
7821 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7822 |
string := s1, s2. |
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7823 |
col := nextPasteAction col. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7824 |
userFriendlyInfo := 'delete ' , string size printString |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7825 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7826 |
"Created: / 25-09-2006 / 12:24:10 / cg" |
2952 | 7827 |
! ! |
7828 |
||
7829 |
!EditTextView::PasteString methodsFor:'execution'! |
|
7830 |
||
3160 | 7831 |
executeIn:editor |
2952 | 7832 |
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
|
7833 |
editor paste:string. |
2952 | 7834 |
selected ~~ true ifTrue:[ |
3160 | 7835 |
editor unselect |
2952 | 7836 |
]. |
7837 |
! ! |
|
7838 |
||
7839 |
!EditTextView::ReplaceCharacter methodsFor:'accessing'! |
|
7840 |
||
3235 | 7841 |
col |
7842 |
^ col |
|
7843 |
! |
|
7844 |
||
7845 |
col1 |
|
7846 |
^ col |
|
7847 |
! |
|
7848 |
||
7849 |
col2 |
|
7850 |
^ col |
|
7851 |
! |
|
7852 |
||
7853 |
line |
|
7854 |
^ line |
|
7855 |
! |
|
7856 |
||
3160 | 7857 |
line:lineArg col:colArg character:characterArg |
2952 | 7858 |
line := lineArg. |
7859 |
col := colArg. |
|
7860 |
character := characterArg. |
|
7861 |
! ! |
|
7862 |
||
7863 |
!EditTextView::ReplaceCharacter methodsFor:'execution'! |
|
7864 |
||
3160 | 7865 |
executeIn:editor |
7866 |
editor |
|
7867 |
replace:character |
|
7868 |
atLine:line |
|
7869 |
col:col. |
|
2952 | 7870 |
editor cursorLine:line col:col. |
105 | 7871 |
! ! |
7872 |
||
3235 | 7873 |
!EditTextView::ReplaceCharacters methodsFor:'accessing'! |
7874 |
||
7875 |
characters |
|
7876 |
^ characters |
|
7877 |
! |
|
7878 |
||
7879 |
col1 |
|
7880 |
^ col1 |
|
7881 |
! |
|
7882 |
||
7883 |
col2 |
|
7884 |
^ col2 |
|
7885 |
! |
|
7886 |
||
7887 |
line |
|
7888 |
^ line |
|
7889 |
! |
|
7890 |
||
7891 |
line:lineArg col:colArg character:characterArg |
|
7892 |
line := lineArg. |
|
7893 |
col1 := col2 := colArg. |
|
7894 |
characters := characterArg asString. |
|
7895 |
! |
|
7896 |
||
7897 |
line:lineArg col:colArg characters:charactersArg |
|
7898 |
line := lineArg. |
|
7899 |
col1 := colArg. |
|
7900 |
characters := charactersArg asString. |
|
7901 |
col2 := col1 + charactersArg size - 1 |
|
7902 |
! ! |
|
7903 |
||
7904 |
!EditTextView::ReplaceCharacters methodsFor:'combining'! |
|
7905 |
||
7906 |
canCombineWithNext:anotherAction |
|
7907 |
^ anotherAction perform:#canCombineWithPreviousReplaceCharactersAction: with:self ifNotUnderstood:false |
|
7908 |
! |
|
7909 |
||
7910 |
canCombineWithPreviousReplaceCharactersAction:previousReplaceAction |
|
7911 |
"I will combine only if we both are single character deletes, |
|
7912 |
and my col-to-delete is the next after anotherDeleteActions col-to-delete. |
|
7913 |
(i.e. single-character typing)" |
|
7914 |
||
7915 |
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
|
7916 |
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
|
7917 |
^ true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7918 |
]. |
3235 | 7919 |
]. |
7920 |
||
7921 |
^ false |
|
7922 |
! |
|
7923 |
||
7924 |
combineWithNext:nextReplaceAction |
|
7925 |
self assert:(line == nextReplaceAction line). |
|
7926 |
self assert:(self col2 == (nextReplaceAction col1 - 1)). |
|
7927 |
||
7928 |
col2 := nextReplaceAction col2. |
|
7929 |
userFriendlyInfo := 'replace ' , (col2 - col1 + 1) printString. |
|
7930 |
characters := characters , nextReplaceAction characters. |
|
7931 |
! ! |
|
7932 |
||
7933 |
!EditTextView::ReplaceCharacters methodsFor:'execution'! |
|
7934 |
||
7935 |
executeIn:editor |
|
7936 |
editor |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7937 |
replaceString:characters |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7938 |
atLine:line |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7939 |
col:col1. |
3235 | 7940 |
editor cursorLine:line col:col1. |
7941 |
! ! |
|
7942 |
||
3131 | 7943 |
!EditTextView::ReplaceContents methodsFor:'accessing'! |
7944 |
||
7945 |
text:something |
|
7946 |
text := something. |
|
7947 |
! ! |
|
7948 |
||
7949 |
!EditTextView::ReplaceContents methodsFor:'execution'! |
|
7950 |
||
3160 | 7951 |
executeIn:editor |
3131 | 7952 |
editor contents:text |
7953 |
! ! |
|
7954 |
||
3130 | 7955 |
!EditTextView::ReplaceLine methodsFor:'accessing'! |
7956 |
||
3160 | 7957 |
line:lineArg string:stringArg |
3130 | 7958 |
line := lineArg. |
7959 |
text := stringArg. |
|
7960 |
! ! |
|
7961 |
||
7962 |
!EditTextView::ReplaceLine methodsFor:'execution'! |
|
7963 |
||
3160 | 7964 |
executeIn:editor |
3130 | 7965 |
editor list at:line put:text. |
7966 |
editor invalidateLine:line |
|
7967 |
! ! |
|
7968 |
||
3402 | 7969 |
!EditTextView::ReplaceLines methodsFor:'accessing'! |
7970 |
||
7971 |
line:lineArg lines:lineCollectionArg |
|
7972 |
line := lineArg. |
|
7973 |
text := lineCollectionArg. |
|
7974 |
||
7975 |
"Created: / 09-10-2006 / 10:35:22 / cg" |
|
7976 |
! ! |
|
7977 |
||
7978 |
!EditTextView::ReplaceLines methodsFor:'execution'! |
|
7979 |
||
7980 |
executeIn:editor |
|
7981 |
|lnr| |
|
7982 |
||
7983 |
lnr := line. |
|
7984 |
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
|
7985 |
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
|
7986 |
editor invalidateLine:lnr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7987 |
lnr := lnr + 1. |
3402 | 7988 |
]. |
7989 |
||
7990 |
"Modified: / 09-10-2006 / 10:39:16 / cg" |
|
7991 |
! ! |
|
7992 |
||
865 | 7993 |
!EditTextView class methodsFor:'documentation'! |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7994 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7995 |
version |
4328 | 7996 |
^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.519 2011-10-07 13:56:28 cg Exp $' |
3945 | 7997 |
! |
7998 |
||
7999 |
version_CVS |
|
4328 | 8000 |
^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.519 2011-10-07 13:56:28 cg Exp $' |
0 | 8001 |
! ! |