author | Claus Gittinger <cg@exept.de> |
Wed, 28 Oct 2009 14:32:52 +0100 | |
changeset 4042 | 2dac2f89e877 |
parent 4041 | d3a015f9d5dd |
child 4048 | a2ec0cedffc2 |
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 |
|
4010 | 18 |
cursorTypeNoFocus typeOfSelection lastReplacement |
19 |
lastStringToReplace lastStringFromReplace lastAction replacing |
|
20 |
showMatchingParenthesis hasKeyboardFocus acceptAction lockUpdates |
|
21 |
tabMeansNextField autoIndent insertMode editMode trimBlankLines |
|
22 |
wordWrap replacementWordSelectStyle acceptChannel acceptEnabled |
|
23 |
st80Mode disableIfInvisible cursorMovementWhenUpdating learnMode |
|
24 |
learnedMacro cursorLineHolder cursorColHolder tabRequiresControl |
|
25 |
undoSupport' |
|
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 |
|
2952 | 89 |
EditTextView::EditAction subclass:#PasteString |
90 |
instanceVariableNames:'line col string selected' |
|
91 |
classVariableNames:'' |
|
92 |
poolDictionaries:'' |
|
93 |
privateIn:EditTextView |
|
94 |
! |
|
95 |
||
96 |
EditTextView::EditAction subclass:#ReplaceCharacter |
|
97 |
instanceVariableNames:'line col character' |
|
98 |
classVariableNames:'' |
|
99 |
poolDictionaries:'' |
|
100 |
privateIn:EditTextView |
|
101 |
! |
|
102 |
||
3235 | 103 |
EditTextView::EditAction subclass:#ReplaceCharacters |
104 |
instanceVariableNames:'line col1 col2 characters' |
|
105 |
classVariableNames:'' |
|
106 |
poolDictionaries:'' |
|
107 |
privateIn:EditTextView |
|
108 |
! |
|
109 |
||
3131 | 110 |
EditTextView::EditAction subclass:#ReplaceContents |
111 |
instanceVariableNames:'text' |
|
112 |
classVariableNames:'' |
|
113 |
poolDictionaries:'' |
|
114 |
privateIn:EditTextView |
|
115 |
! |
|
116 |
||
3130 | 117 |
EditTextView::EditAction subclass:#ReplaceLine |
118 |
instanceVariableNames:'line text' |
|
119 |
classVariableNames:'' |
|
120 |
poolDictionaries:'' |
|
121 |
privateIn:EditTextView |
|
122 |
! |
|
123 |
||
3402 | 124 |
EditTextView::EditAction subclass:#ReplaceLines |
125 |
instanceVariableNames:'line text' |
|
126 |
classVariableNames:'' |
|
127 |
poolDictionaries:'' |
|
128 |
privateIn:EditTextView |
|
129 |
! |
|
130 |
||
865 | 131 |
!EditTextView class methodsFor:'documentation'! |
0 | 132 |
|
33 | 133 |
copyright |
134 |
" |
|
135 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
3160 | 136 |
All Rights Reserved |
33 | 137 |
|
138 |
This software is furnished under a license and may be used |
|
139 |
only in accordance with the terms of that license and with the |
|
140 |
inclusion of the above copyright notice. This software may not |
|
141 |
be provided or otherwise made available to, or used by, any |
|
142 |
other person. No title to or ownership of the software is |
|
143 |
hereby transferred. |
|
144 |
" |
|
145 |
! |
|
146 |
||
0 | 147 |
documentation |
148 |
" |
|
149 |
a view for editable text - adds editing functionality to TextView |
|
3160 | 150 |
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
|
151 |
acceptAction to be performed for accept |
125 | 152 |
|
153 |
If used with a model, this is informed by sending it a changeMsg with |
|
154 |
the current contents as argument. |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
155 |
(however, it is possible to define both changeMsg and acceptAction) |
125 | 156 |
|
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
|
157 |
Please read the historic notice in the ListView class. |
0 | 158 |
|
586 | 159 |
[Instance variables:] |
0 | 160 |
|
4010 | 161 |
cursorLine <Number> line where cursor sits (1..) |
162 |
||
163 |
cursorVisibleLine <Number> visible line where cursor sits (1..nLinesShown) |
|
164 |
||
165 |
cursorCol <Number> col where cursor sits (1..) |
|
166 |
||
167 |
cursorShown <Boolean> true, if cursor is currently shown |
|
168 |
||
169 |
readOnly <Boolean> true, if text may not be edited |
|
170 |
||
171 |
modifiedChannel <ValueHolder> holding true, if text has been modified. |
|
172 |
cleared on accept. |
|
173 |
||
174 |
acceptChannel <ValueHolder> holding true, if text has been accepted. |
|
175 |
||
176 |
fixedSize <Boolean> true, if no lines may be added/removed |
|
177 |
||
178 |
exceptionBlock <Block> block to be evaluated when readonly text is about to be modified |
|
179 |
if it returns true, the modification will be done anyway. |
|
180 |
if it returns anything else, the modification is not done. |
|
181 |
||
182 |
cursorFgColor <Color> color used for cursor drawing |
|
183 |
cursorBgColor <Color> color used for cursor drawing |
|
184 |
||
185 |
cursorType <Symbol> how the cursor is drawn; currently implemented |
|
186 |
are #block (solid-block cursor), #ibeam |
|
187 |
(vertical bar at insertion point) |
|
188 |
and #caret (caret below insertion-point) |
|
189 |
||
190 |
cursorTypeNoFocus <Symbol> like above, if view has no focus |
|
191 |
nil means: hide the cursor. |
|
192 |
||
193 |
undoAction <Block> block which undoes last cut, paste or replace |
|
194 |
(not yet fully implemented) |
|
195 |
||
196 |
typeOfSelection <Symbol> #paste, if selection created by paste, nil otherwise |
|
197 |
this affects the next keyPress: if #paste it does not |
|
198 |
replace; otherwise it replaces the selection. |
|
199 |
||
200 |
lastCut <String> last cut or replaced string |
|
201 |
||
202 |
lastReplacement <String> last replacement |
|
203 |
||
204 |
lastStringToReplace <String> string to be replaced by lastReplacement |
|
205 |
||
206 |
lastStringFromReplace <String> string to be taken be the next search action |
|
207 |
(cleared after a new selection) |
|
208 |
||
209 |
replacing <Boolean> true if entered characters replace last selection |
|
210 |
||
211 |
showMatchingParenthesis <Boolean> if true, shows matching parenthesis |
|
212 |
when entering one; this is the default. |
|
213 |
||
214 |
hasKeyboardFocus <Boolean> true if this view has the focus |
|
215 |
||
216 |
acceptAction <Block> accept action - evaluated passing the contents as |
|
217 |
argument |
|
218 |
||
219 |
tabMeansNextField <Boolean> if true, Tab is ignored as input and shifts keyboard |
|
220 |
focus to the next field. For editTextViews, this is false |
|
221 |
by default (i.e. tabs can be entered into the text). |
|
222 |
For some subclasses (inputFields), this may be true. |
|
223 |
||
224 |
trimBlankLines <Boolean> if true, trailing blanks are |
|
225 |
removed when editing. |
|
226 |
Default is true. |
|
227 |
||
228 |
wordWrap <Boolean> Currently not used. |
|
229 |
||
230 |
lockUpdates <Boolean> internal, private |
|
231 |
||
232 |
prevCursorState <Boolean> temporary, private |
|
233 |
||
234 |
cursorMovementWhenUpdating |
|
235 |
<Symbol> defines where the cursor is to be positioned if the |
|
236 |
model changes its value by some outside activity |
|
237 |
(i.e. not by user input into the field). |
|
238 |
Can be one of: |
|
239 |
#keep / nil -> stay where it was |
|
240 |
#endOfText -> cursor to the end |
|
241 |
#endOfLine -> stay in the line, but move to end |
|
242 |
#beginOfText -> cursor to the beginning |
|
243 |
#beginOfLine -> stay in the line, but move to begin |
|
244 |
The default is #beginOfText |
|
245 |
||
246 |
||
247 |
||
248 |
dropTarget <DropTarget|nil> drop operation descriptor or nil (drop disabled) |
|
2589 | 249 |
|
250 |
||
2712
e83d71c9bdec
ST80Mode classVariables is now UserPreferences.st80EditMode
Claus Gittinger <cg@exept.de>
parents:
2707
diff
changeset
|
251 |
userPreference values: |
4010 | 252 |
userPreferences.st80EditMode |
253 |
<Boolean> if true, cursor positioning is |
|
254 |
done as in vi or ST80; i.e. |
|
255 |
wysiwyg mode is somewhat relaxed, |
|
256 |
in that the cursor cannot be |
|
257 |
positioned behind a lines end. |
|
258 |
This is not yet completely implemented. |
|
33 | 259 |
used globals: |
260 |
||
4010 | 261 |
DeleteHistory <Text> last 1000 lines of deleted text |
262 |
(but only if this variable exists already) |
|
586 | 263 |
|
264 |
[styleSheet parameters:] |
|
121 | 265 |
|
4010 | 266 |
textCursorForegroundColor <Color> cursor fg color; default: text background |
267 |
textCursorBackgroundColor <Color> cursor bg color; default: text foreground |
|
268 |
textCursorNoFocusForegroundColor |
|
269 |
<Color> cursor fg color if no focus; default: cursor fg color |
|
270 |
textCursorType <Symbol> cursor type; default: #block |
|
586 | 271 |
|
272 |
[author:] |
|
4010 | 273 |
Claus Gittinger |
586 | 274 |
|
275 |
[see also:] |
|
4010 | 276 |
CodeView Workspace TextView ListView |
277 |
EditField |
|
0 | 278 |
" |
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
279 |
! |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
280 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
281 |
examples |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
282 |
" |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
283 |
non MVC operation: |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
284 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
285 |
basic setup: |
3160 | 286 |
[exBegin] |
287 |
|top textView| |
|
288 |
||
289 |
top := StandardSystemView new. |
|
290 |
top extent:300@200. |
|
291 |
||
292 |
textView := EditTextView new. |
|
293 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
294 |
top addSubView:textView. |
|
295 |
||
296 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
297 |
||
298 |
top open. |
|
299 |
[exEnd] |
|
594 | 300 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
301 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
302 |
with vertical scrollbar: |
3160 | 303 |
[exBegin] |
304 |
|top scrollView textView| |
|
305 |
||
306 |
top := StandardSystemView new. |
|
307 |
top extent:300@200. |
|
308 |
||
309 |
scrollView := ScrollableView for:EditTextView. |
|
310 |
textView := scrollView scrolledView. |
|
311 |
scrollView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
312 |
top addSubView:scrollView. |
|
313 |
||
314 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
315 |
||
316 |
top open. |
|
317 |
[exEnd] |
|
594 | 318 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
319 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
320 |
with horizontal & vertical scrollbars: |
3160 | 321 |
[exBegin] |
322 |
|top scrollView textView| |
|
323 |
||
324 |
top := StandardSystemView new. |
|
325 |
top extent:300@200. |
|
326 |
||
327 |
scrollView := HVScrollableView for:EditTextView. |
|
328 |
textView := scrollView scrolledView. |
|
329 |
scrollView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
330 |
top addSubView:scrollView. |
|
331 |
||
332 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
333 |
||
334 |
top open. |
|
335 |
[exEnd] |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
336 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
337 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
338 |
set the action for accept: |
3160 | 339 |
[exBegin] |
340 |
|top textView| |
|
341 |
||
342 |
top := StandardSystemView new. |
|
343 |
top extent:300@200. |
|
344 |
||
345 |
textView := EditTextView new. |
|
346 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
347 |
top addSubView:textView. |
|
348 |
||
349 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
350 |
textView acceptAction:[:contents | |
|
351 |
Transcript showCR:'will not overwrite the file with:'. |
|
352 |
Transcript showCR:contents asString |
|
353 |
]. |
|
354 |
top open. |
|
355 |
[exEnd] |
|
594 | 356 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
357 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
358 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
359 |
non-string (text) items: |
3160 | 360 |
[exBegin] |
361 |
|top textView list| |
|
362 |
||
363 |
list := '/etc/hosts' asFilename contentsOfEntireFile asStringCollection. |
|
364 |
1 to:list size by:2 do:[:nr | |
|
365 |
list at:nr put:(Text string:(list at:nr) |
|
366 |
emphasis:(Array with:#bold with:(#color->Color red))) |
|
367 |
]. |
|
368 |
||
369 |
top := StandardSystemView new. |
|
370 |
top extent:300@200. |
|
371 |
||
372 |
textView := EditTextView new. |
|
373 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
374 |
top addSubView:textView. |
|
375 |
||
376 |
textView contents:list. |
|
377 |
top open. |
|
378 |
[exEnd] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
379 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
380 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
381 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
382 |
MVC operation: |
594 | 383 |
(the examples model here is a plug simulating a real model; |
384 |
real world applications would not use a plug ..) |
|
3160 | 385 |
[exBegin] |
386 |
|top textView model| |
|
387 |
||
388 |
model := Plug new. |
|
389 |
model respondTo:#accepted: |
|
390 |
with:[:newContents | |
|
391 |
Transcript showCR:'will not overwrite the file with:'. |
|
392 |
Transcript showCR:newContents asString |
|
393 |
]. |
|
394 |
model respondTo:#getList |
|
395 |
with:['/etc/hosts' asFilename contentsOfEntireFile]. |
|
396 |
||
397 |
||
398 |
top := StandardSystemView new. |
|
399 |
top extent:300@200. |
|
400 |
||
401 |
textView := EditTextView new. |
|
402 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
403 |
top addSubView:textView. |
|
404 |
||
405 |
textView listMessage:#getList; |
|
406 |
model:model; |
|
407 |
changeMessage:#accepted:; |
|
408 |
aspect:#list. |
|
409 |
top open. |
|
410 |
[exEnd] |
|
594 | 411 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
412 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
413 |
two textViews on the same model: |
3160 | 414 |
[exBegin] |
415 |
|top1 textView1 top2 textView2 model currentContents| |
|
416 |
||
417 |
model := Plug new. |
|
418 |
model respondTo:#accepted: |
|
419 |
with:[:newContents | |
|
420 |
Transcript showCR:'accepted:'. |
|
421 |
Transcript showCR:newContents asString. |
|
422 |
currentContents := newContents. |
|
423 |
model changed:#contents |
|
424 |
]. |
|
425 |
model respondTo:#getList |
|
426 |
with:[Transcript showCR:'query'. |
|
427 |
currentContents]. |
|
428 |
||
429 |
||
430 |
top1 := StandardSystemView new. |
|
431 |
top1 extent:300@200. |
|
432 |
||
433 |
textView1 := EditTextView new. |
|
434 |
textView1 origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
435 |
top1 addSubView:textView1. |
|
436 |
||
437 |
textView1 listMessage:#getList; |
|
438 |
model:model; |
|
439 |
aspect:#contents; |
|
440 |
changeMessage:#accepted:. |
|
441 |
top1 open. |
|
442 |
||
443 |
top2 := StandardSystemView new. |
|
444 |
top2 extent:300@200. |
|
445 |
||
446 |
textView2 := EditTextView new. |
|
447 |
textView2 origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
448 |
top2 addSubView:textView2. |
|
449 |
||
450 |
textView2 listMessage:#getList; |
|
451 |
model:model; |
|
452 |
aspect:#contents; |
|
453 |
changeMessage:#accepted:. |
|
454 |
top2 open. |
|
455 |
[exEnd] |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
456 |
" |
0 | 457 |
! ! |
458 |
||
865 | 459 |
!EditTextView class methodsFor:'defaults'! |
59 | 460 |
|
1419 | 461 |
st80Mode |
462 |
"return true, if the st80 editing mode is turned on. |
|
463 |
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
|
464 |
beyond the end of a line or the end of the text." |
1419 | 465 |
|
2647
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
466 |
^ UserPreferences current st80EditMode |
1419 | 467 |
|
468 |
" |
|
469 |
EditTextView st80Mode:true |
|
470 |
EditTextView st80Mode:false |
|
471 |
" |
|
472 |
||
473 |
"Modified: / 16.1.1998 / 22:54:57 / cg" |
|
474 |
! |
|
475 |
||
476 |
st80Mode:aBoolean |
|
477 |
"turns on/off st80 behavior, where the cursor cannot be positioned |
|
2707 | 478 |
beyond the end of a line or the last line" |
1419 | 479 |
|
2647
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
480 |
UserPreferences current st80EditMode:aBoolean. |
1419 | 481 |
|
482 |
" |
|
483 |
EditTextView st80Mode:true |
|
484 |
EditTextView st80Mode:false |
|
485 |
" |
|
486 |
||
487 |
"Modified: / 16.1.1998 / 22:55:19 / cg" |
|
488 |
! |
|
489 |
||
59 | 490 |
updateStyleCache |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
491 |
"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
|
492 |
|
1390 | 493 |
<resource: #style (#'textCursor.foregroundColor' #'textCursor.backgroundColor' |
3160 | 494 |
#'textCursor.noFocusForegroundColor' |
495 |
#'textCursor.type' |
|
496 |
#'textCursor.typeNoFocus' |
|
497 |
#'editText.st80Mode')> |
|
1355 | 498 |
|
499 |
DefaultCursorForegroundColor := StyleSheet colorAt:'textCursor.foregroundColor'. |
|
500 |
DefaultCursorBackgroundColor := StyleSheet colorAt:'textCursor.backgroundColor'. |
|
501 |
DefaultCursorNoFocusForegroundColor := StyleSheet colorAt:'textCursor.noFocusForegroundColor'. |
|
502 |
DefaultCursorType := StyleSheet at:'textCursor.type' default:#block. |
|
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
503 |
DefaultCursorTypeNoFocus := StyleSheet at:'textCursor.typeNoFocus'. |
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
504 |
|
1419 | 505 |
" |
506 |
self updateStyleCache |
|
507 |
" |
|
508 |
||
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
509 |
"Modified: / 20.5.1998 / 04:27:41 / cg" |
59 | 510 |
! ! |
511 |
||
3431 | 512 |
!EditTextView class methodsFor:'specs'! |
513 |
||
514 |
searchReplaceDialogSpec |
|
515 |
"This resource specification was automatically generated |
|
516 |
by the UIPainter of ST/X." |
|
517 |
||
518 |
"Do not manually edit this!! If it is corrupted, |
|
519 |
the UIPainter may not be able to read the specification." |
|
520 |
||
521 |
" |
|
522 |
UIPainter new openOnClass:DAPASX::ProjectEditorTextView andSelector:#searchReplaceDialogSpec |
|
523 |
" |
|
524 |
||
525 |
<resource: #canvas> |
|
526 |
||
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
527 |
^ |
3431 | 528 |
#(FullSpec |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
529 |
name: searchReplaceDialogSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
530 |
window: |
3431 | 531 |
(WindowSpec |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
532 |
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
|
533 |
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
|
534 |
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
|
535 |
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
|
536 |
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
|
537 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
538 |
component: |
3431 | 539 |
(SpecCollection |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
540 |
collection: ( |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
541 |
(LabelSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
542 |
label: 'Search Pattern:' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
543 |
name: 'label' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
544 |
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
|
545 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
546 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
547 |
adjust: left |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
548 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
549 |
(ComboBoxSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
550 |
name: 'patternComboBox' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
551 |
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
|
552 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
553 |
model: searchPattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
554 |
immediateAccept: false |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
555 |
acceptOnLeave: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
556 |
acceptOnReturn: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
557 |
acceptOnTab: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
558 |
acceptOnLostFocus: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
559 |
acceptOnPointerLeave: false |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
560 |
autoSelectInitialText: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
561 |
comboList: patternList |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
562 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
563 |
(ComboBoxSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
564 |
name: 'replaceComboBox' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
565 |
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
|
566 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
567 |
model: replacePattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
568 |
immediateAccept: false |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
569 |
acceptOnLeave: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
570 |
acceptOnReturn: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
571 |
acceptOnTab: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
572 |
acceptOnLostFocus: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
573 |
acceptOnPointerLeave: false |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
574 |
autoSelectInitialText: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
575 |
comboList: patternList |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
576 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
577 |
(CheckBoxSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
578 |
label: 'Ignore Case' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
579 |
name: 'ignoreCaseCheckBox' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
580 |
layout: (LayoutFrame 3 0.0 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
|
581 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
582 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
583 |
model: ignoreCase |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
584 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
585 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
586 |
(VariableVerticalPanelSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
587 |
name: 'VariableVerticalPanel1' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
588 |
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
|
589 |
component: |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
590 |
(SpecCollection |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
591 |
collection: ( |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
592 |
(HorizontalPanelViewSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
593 |
name: 'HorizontalPanel1' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
594 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
595 |
horizontalLayout: fitSpace |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
596 |
verticalLayout: center |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
597 |
horizontalSpace: 3 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
598 |
verticalSpace: 3 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
599 |
ignoreInvisibleComponents: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
600 |
reverseOrderIfOKAtLeft: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
601 |
component: |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
602 |
(SpecCollection |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
603 |
collection: ( |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
604 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
605 |
label: 'Replace' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
606 |
name: 'replaceButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
607 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
608 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
609 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
610 |
model: replaceAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
611 |
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
|
612 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
613 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
614 |
label: 'Replace All' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
615 |
name: 'replaceAllButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
616 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
617 |
borderWidth: 1 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
618 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
619 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
620 |
model: replaceAllAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
621 |
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
|
622 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
623 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
624 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
625 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
626 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
627 |
(HorizontalPanelViewSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
628 |
name: 'horizontalPanelView' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
629 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
630 |
horizontalLayout: fitSpace |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
631 |
verticalLayout: center |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
632 |
horizontalSpace: 3 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
633 |
verticalSpace: 3 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
634 |
ignoreInvisibleComponents: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
635 |
reverseOrderIfOKAtLeft: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
636 |
component: |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
637 |
(SpecCollection |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
638 |
collection: ( |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
639 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
640 |
label: 'Cancel' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
641 |
name: 'cancelButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
642 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
643 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
644 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
645 |
model: cancel |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
646 |
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
|
647 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
648 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
649 |
label: 'Prev' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
650 |
name: 'prevButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
651 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
652 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
653 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
654 |
model: prevAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
655 |
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
|
656 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
657 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
658 |
label: 'Next' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
659 |
name: 'nextButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
660 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
661 |
borderWidth: 1 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
662 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
663 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
664 |
model: nextAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
665 |
isDefault: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
666 |
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
|
667 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
668 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
669 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
670 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
671 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
672 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
673 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
674 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
675 |
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
|
676 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
677 |
(LabelSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
678 |
label: 'Replace By:' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
679 |
name: 'ReplaceLabel' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
680 |
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
|
681 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
682 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
683 |
adjust: left |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
684 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
685 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
686 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
687 |
) |
3431 | 688 |
) |
689 |
||
690 |
"Modified: / 11-10-2006 / 21:05:09 / cg" |
|
691 |
! ! |
|
692 |
||
2744 | 693 |
!EditTextView methodsFor:'Compatibility-ST80'! |
1552
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
694 |
|
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
695 |
autoAccept:aBoolean |
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
696 |
"ignored for now" |
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
697 |
|
2019 | 698 |
"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
|
699 |
! |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
700 |
|
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
701 |
continuousAccept:aBoolean |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
702 |
"ignored for now" |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
703 |
|
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
704 |
"Created: / 19.6.1998 / 00:03:49 / cg" |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
705 |
! |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
706 |
|
1390 | 707 |
cutSelection |
708 |
self cut |
|
709 |
||
710 |
"Created: / 31.10.1997 / 03:29:50 / cg" |
|
711 |
! |
|
712 |
||
1590 | 713 |
deselect |
714 |
"remove the selection" |
|
715 |
||
716 |
^ self unselect |
|
717 |
||
718 |
"Created: / 19.6.1998 / 02:41:54 / cg" |
|
719 |
! |
|
720 |
||
2101 | 721 |
enabled:aBoolean |
722 |
||
723 |
self readOnly:aBoolean not |
|
724 |
||
725 |
"Created: / 30.3.1999 / 15:10:23 / stefan" |
|
726 |
"Modified: / 30.3.1999 / 15:10:53 / stefan" |
|
727 |
! |
|
728 |
||
1732
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
729 |
find:pattern |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
730 |
self searchFwd:pattern ifAbsent:nil |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
731 |
|
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
732 |
"Created: / 29.1.1999 / 19:09:42 / cg" |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
733 |
"Modified: / 29.1.1999 / 19:10:12 / cg" |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
734 |
! |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
735 |
|
1294
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
736 |
insert:aString at:aCharacterPosition |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
737 |
"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
|
738 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
739 |
|line col| |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
740 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
741 |
line := self lineOfCharacterPosition:aCharacterPosition. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
742 |
col := aCharacterPosition - (self characterPositionOfLine:line col:1) + 1. |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
743 |
col < 1 ifTrue:[ |
3160 | 744 |
col := 1 |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
745 |
]. |
1294
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
746 |
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
|
747 |
|
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 |
|top v| |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
750 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
751 |
top := StandardSystemView new. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
752 |
top extent:300@300. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
753 |
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
|
754 |
top openAndWait. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
755 |
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
|
756 |
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
|
757 |
" |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
758 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
759 |
"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
|
760 |
! |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
761 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
762 |
insertAndSelect:aString at:aCharacterPosition |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
763 |
"insert a selected string at aCharacterPosition." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
764 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
765 |
|line col| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
766 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
767 |
line := self lineOfCharacterPosition:aCharacterPosition. |
2310 | 768 |
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
|
769 |
self insertString:aString atLine:line col:col. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
770 |
self selectFromLine:line col:col toLine:line col:col + aString size - 1 |
125 | 771 |
" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
772 |
|v| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
773 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
774 |
v := EditTextView new openAndWait. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
775 |
v contents:'1234567890\1234567890\1234567890\' withCRs. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
776 |
v insertAndSelect:'<- hello there' at:5. |
125 | 777 |
" |
1390 | 778 |
! |
779 |
||
780 |
pasteSelection |
|
781 |
self paste |
|
782 |
||
783 |
"Created: / 31.10.1997 / 03:28:53 / cg" |
|
1590 | 784 |
! |
785 |
||
786 |
replaceSelectionWith:aString |
|
787 |
^ self replaceSelectionBy:aString |
|
788 |
||
789 |
"Created: / 19.6.1998 / 02:42:32 / cg" |
|
790 |
! |
|
791 |
||
792 |
selectAt:pos |
|
793 |
"move the cursor before cursorPosition." |
|
794 |
||
795 |
self cursorToCharacterPosition:pos |
|
796 |
||
797 |
"Modified: / 19.6.1998 / 02:41:28 / cg" |
|
798 |
"Created: / 19.6.1998 / 02:43:39 / cg" |
|
799 |
! |
|
800 |
||
801 |
selectFrom:startPos to:endPos |
|
802 |
"change the selection given two aCharacterPositions." |
|
803 |
||
804 |
|line1 col1 line2 col2| |
|
805 |
||
806 |
startPos > endPos ifTrue:[ |
|
3160 | 807 |
^ self unselect |
1590 | 808 |
]. |
809 |
||
810 |
line1 := self lineOfCharacterPosition:startPos. |
|
811 |
col1 := startPos - (self characterPositionOfLine:line1 col:1) + 1. |
|
812 |
col1 < 1 ifTrue:[ |
|
3160 | 813 |
col1 := 1 |
1590 | 814 |
]. |
815 |
line2 := self lineOfCharacterPosition:endPos. |
|
816 |
col2 := startPos - (self characterPositionOfLine:line2 col:1) + 1. |
|
817 |
col2 < 1 ifTrue:[ |
|
3160 | 818 |
col2 := 1 |
1590 | 819 |
]. |
820 |
self selectFromLine:line1 col:col1 toLine:line2 col:col2 |
|
821 |
||
822 |
"Modified: / 19.6.1998 / 02:41:28 / cg" |
|
2101 | 823 |
! |
824 |
||
825 |
textHasChanged |
|
826 |
^ self modified |
|
827 |
||
828 |
"Created: / 19.6.1998 / 00:09:43 / cg" |
|
2117
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
829 |
! |
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
830 |
|
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
831 |
textHasChanged:aBoolean |
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
832 |
"ST-80 compatibility: set/clear the modified flag." |
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
833 |
|
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
834 |
self modified:aBoolean |
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
835 |
|
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
836 |
"Created: / 5.2.2000 / 17:07:59 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
837 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
838 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
839 |
!EditTextView methodsFor:'accessing-behavior'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
840 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
841 |
acceptAction |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
842 |
"return the action to be performed on accept (or nil)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
843 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
844 |
^ acceptAction |
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 |
acceptAction:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
848 |
"set the action to be performed on accept" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
849 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
850 |
acceptAction := aBlock |
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 |
|
2792 | 853 |
acceptChannel |
854 |
"return the valueHolder holding true if text was accepted. |
|
855 |
By placing a true into this channel, an accept can also be forced." |
|
856 |
||
857 |
^ acceptChannel |
|
858 |
||
859 |
"Modified: / 30.1.1998 / 14:17:11 / cg" |
|
860 |
! |
|
861 |
||
862 |
acceptChannel:aValueHolder |
|
863 |
"set the valueHolder holding true if text was accepted. |
|
864 |
By placing a true into this channel, an accept can also be forced." |
|
865 |
||
866 |
|prev| |
|
867 |
||
868 |
prev := acceptChannel. |
|
869 |
acceptChannel := aValueHolder. |
|
870 |
self setupChannel:aValueHolder for:nil withOld:prev |
|
871 |
||
872 |
"Created: / 30.1.1998 / 14:51:09 / cg" |
|
873 |
! |
|
874 |
||
1108 | 875 |
acceptEnabled:aBoolean |
876 |
"enable/disable accept. This greys the corresponding item in the menu" |
|
877 |
||
878 |
acceptEnabled := aBoolean |
|
879 |
||
880 |
"Created: 7.3.1997 / 11:04:34 / cg" |
|
881 |
! |
|
882 |
||
2792 | 883 |
accepted |
884 |
"return true if text was accepted" |
|
885 |
||
886 |
^ acceptChannel value |
|
887 |
||
888 |
"Created: 14.2.1997 / 16:43:46 / cg" |
|
889 |
! |
|
890 |
||
891 |
accepted:aBoolean |
|
892 |
"set/clear the accepted flag. |
|
893 |
This may force my current contents to be placed into my model." |
|
894 |
||
895 |
acceptChannel value:aBoolean. |
|
896 |
||
897 |
"Created: / 14.2.1997 / 16:44:01 / cg" |
|
898 |
"Modified: / 30.1.1998 / 14:20:15 / cg" |
|
899 |
! |
|
900 |
||
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
901 |
autoIndent:aBoolean |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
902 |
autoIndent := aBoolean |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
903 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
904 |
"Created: 5.3.1996 / 14:37:50 / cg" |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
905 |
! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
906 |
|
2774 | 907 |
cursorMovementWhenUpdating |
3160 | 908 |
"return what is be done with the cursor, |
2774 | 909 |
when I get a new text (via the model or the #contents/#list) |
910 |
Allowed arguments are: |
|
3160 | 911 |
#keep / nil -> stay where it was |
912 |
#endOfText -> position cursor to the end |
|
913 |
#beginOfText -> position cursor to the beginning |
|
914 |
#endOfLine -> position cursor to the current lines end |
|
915 |
#beginOfLine -> position cursor to the current lines start |
|
2774 | 916 |
The default is #beginOfText. |
917 |
This may be useful for fields which get new values assigned from |
|
918 |
the program (i.e. not from the user)" |
|
919 |
||
920 |
^ cursorMovementWhenUpdating |
|
921 |
||
922 |
"Modified: 16.12.1995 / 16:27:55 / cg" |
|
923 |
! |
|
924 |
||
2133 | 925 |
cursorMovementWhenUpdating:aSymbolOrNil |
3160 | 926 |
"define what should be done with the cursor, |
2133 | 927 |
when I get a new text (via the model or the #contents/#list) |
928 |
Allowed arguments are: |
|
3160 | 929 |
#keep / nil -> stay where it was |
930 |
#endOfText -> position cursor to the end |
|
931 |
#beginOfText -> position cursor to the beginning |
|
932 |
#endOfLine -> position cursor to the current lines end |
|
933 |
#beginOfLine -> position cursor to the current lines start |
|
2133 | 934 |
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
|
935 |
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
|
936 |
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
|
937 |
|
2133 | 938 |
cursorMovementWhenUpdating := aSymbolOrNil |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
939 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
940 |
"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
|
941 |
! |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
942 |
|
2035
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
943 |
disableIfInvisible:aBoolean |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
944 |
disableIfInvisible := aBoolean |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
945 |
! |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
946 |
|
2438 | 947 |
dontReplaceSelectionOnInput |
948 |
typeOfSelection := #paste |
|
949 |
! |
|
950 |
||
3235 | 951 |
editModeHolder |
952 |
^ editMode. |
|
953 |
! |
|
954 |
||
955 |
editModeInsert |
|
956 |
editMode value:EditMode insertMode |
|
957 |
! |
|
958 |
||
959 |
editModeInsertAndSelect |
|
960 |
editMode value:EditMode insertAndSelectMode |
|
961 |
! |
|
962 |
||
963 |
editModeOverwrite |
|
964 |
editMode value:EditMode overwriteMode |
|
965 |
! |
|
966 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
967 |
exceptionBlock:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
968 |
"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
|
969 |
readonly text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
970 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
971 |
exceptionBlock := aBlock |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
972 |
! |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
973 |
|
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
974 |
fixedSize |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
975 |
"make the texts size fixed (no lines may be added). |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
976 |
OBSOLETE: use readOnly" |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
977 |
|
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
978 |
<resource:#obsolete> |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
979 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
980 |
|menu| |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
981 |
|
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
982 |
self obsoleteMethodWarning:'use #readOnly:'. |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
983 |
readOnly == true ifFalse:[ |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
984 |
readOnly := true. |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
985 |
(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
|
986 |
menu disableAll:#(cut paste replace indent) |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
987 |
] |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
988 |
] |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
989 |
|
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
990 |
"Modified: 14.2.1997 / 17:35:24 / cg" |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
991 |
! |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
992 |
|
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
993 |
insertMode:aBoolean |
3235 | 994 |
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
|
995 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
996 |
"Created: 6.3.1996 / 12:24:05 / cg" |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
997 |
! |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
998 |
|
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
999 |
insertModeHolder |
3235 | 1000 |
^ BlockValue |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1001 |
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
|
1002 |
argument:(editMode). |
3465 | 1003 |
|
1004 |
"Modified: / 08-03-2007 / 22:58:37 / cg" |
|
3235 | 1005 |
! |
1006 |
||
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1007 |
isInInsertMode |
3235 | 1008 |
^ editMode value isInsertMode |
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
1009 |
! |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
1010 |
|
2792 | 1011 |
isReadOnly |
1012 |
"return true, if the text is readonly." |
|
1013 |
||
1014 |
^ readOnly value |
|
1015 |
||
1016 |
"Modified: 14.2.1997 / 17:35:56 / cg" |
|
1017 |
! |
|
1018 |
||
2796 | 1019 |
modeLabelHolder |
1020 |
"a valueHolder, which contains 'L' (learnMode), I (insertMode) or empty" |
|
1021 |
||
3160 | 1022 |
^ BlockValue |
4041 | 1023 |
with:[:e :l | |
1024 |
self isReadOnly ifTrue:[ |
|
1025 |
'' |
|
1026 |
] ifFalse:[ |
|
1027 |
l ifTrue:[ 'L' allBold colorizeAllWith:Color red] |
|
1028 |
ifFalse:[ e infoPrintString]]] |
|
1029 |
argument:(self editModeHolder) |
|
1030 |
argument:(self learnModeHolder). |
|
3465 | 1031 |
|
1032 |
"Modified: / 08-03-2007 / 22:58:59 / cg" |
|
2796 | 1033 |
! |
1034 |
||
2792 | 1035 |
modified |
1036 |
"return true if text was modified" |
|
1037 |
||
1038 |
^ modifiedChannel value |
|
1039 |
! |
|
1040 |
||
1041 |
modified:aBoolean |
|
1042 |
"set/clear the modified flag" |
|
1043 |
||
1044 |
modifiedChannel value:aBoolean |
|
1045 |
||
1046 |
"Modified: 14.2.1997 / 16:44:05 / cg" |
|
1047 |
! |
|
1048 |
||
1049 |
modifiedChannel |
|
1050 |
"return the valueHolder holding true if text was modified" |
|
1051 |
||
1052 |
^ modifiedChannel |
|
1053 |
! |
|
1054 |
||
1055 |
modifiedChannel:aValueHolder |
|
1056 |
"set the valueHolder holding true if text was modified" |
|
1057 |
||
1058 |
|prev| |
|
1059 |
||
1060 |
prev := modifiedChannel. |
|
1061 |
modifiedChannel := aValueHolder. |
|
1062 |
self setupChannel:aValueHolder for:nil withOld:prev |
|
1063 |
||
1064 |
"Created: / 30.1.1998 / 14:51:32 / cg" |
|
1065 |
! |
|
1066 |
||
1067 |
readOnly |
|
1068 |
"make the text readonly. |
|
1069 |
Somewhat obsolete - use #readOnly:" |
|
1070 |
||
1071 |
<resource:#obsolete> |
|
1072 |
||
1073 |
self obsoleteMethodWarning:'use #readOnly:'. |
|
3705 | 1074 |
self readOnly:true. |
2792 | 1075 |
|
1076 |
"Modified: 14.2.1997 / 17:35:56 / cg" |
|
1077 |
! |
|
1078 |
||
1079 |
readOnly:aBoolean |
|
1080 |
"make the text readonly (aBoolean == true) or writable (aBoolean == false). |
|
1081 |
The argument may also be a valueHolder." |
|
1082 |
||
1083 |
readOnly := aBoolean |
|
1084 |
||
1085 |
"Created: 14.2.1997 / 17:35:39 / cg" |
|
1086 |
! |
|
1087 |
||
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1088 |
tabMeansNextField:aBoolean |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1089 |
"set/clear tabbing to the next field. |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1090 |
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
|
1091 |
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
|
1092 |
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
|
1093 |
input fields." |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1094 |
|
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1095 |
tabMeansNextField := aBoolean |
2779
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1096 |
! |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1097 |
|
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1098 |
tabRequiresControl |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1099 |
"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
|
1100 |
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
|
1101 |
to allow for easier text entry" |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1102 |
|
3160 | 1103 |
^ tabRequiresControl |
2779
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1104 |
! |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1105 |
|
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1106 |
tabRequiresControl:aBoolean |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1107 |
"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
|
1108 |
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
|
1109 |
to allow for easier text entry" |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1110 |
|
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1111 |
tabRequiresControl := aBoolean |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1112 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1113 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1114 |
!EditTextView methodsFor:'accessing-contents'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1115 |
|
1902
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1116 |
at:lineNr basicPut:aLine |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1117 |
"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
|
1118 |
|
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1119 |
(self at:lineNr) = aLine ifFalse:[ |
3160 | 1120 |
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
|
1121 |
]. |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1122 |
! |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1123 |
|
522 | 1124 |
at:lineNr put:aLine |
1125 |
(self at:lineNr) = aLine ifFalse:[ |
|
3160 | 1126 |
super at:lineNr put:aLine. |
1127 |
self textChanged |
|
522 | 1128 |
]. |
1129 |
! |
|
1130 |
||
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1131 |
characterBeforeCursor |
2707 | 1132 |
"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
|
1133 |
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
|
1134 |
of the insertion-bar or caret." |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1135 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1136 |
cursorCol == 1 ifTrue:[^ nil]. |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1137 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1138 |
^ self characterAtLine:cursorLine col:cursorCol-1 |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1139 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1140 |
"Created: / 17.6.1998 / 15:16:41 / cg" |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1141 |
! |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1142 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1143 |
characterUnderCursor |
2707 | 1144 |
"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
|
1145 |
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
|
1146 |
of the insertion-bar or caret." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1147 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1148 |
^ self characterAtLine:cursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1149 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1150 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1151 |
contents |
2213 | 1152 |
"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
|
1153 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1154 |
list isNil ifTrue:[^ '']. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1155 |
self removeTrailingBlankLines. |
3707
8f6bc68b9319
changed #contents - formatting and comments
Stefan Vogel <sv@exept.de>
parents:
3705
diff
changeset
|
1156 |
^ super contents. |
3313 | 1157 |
|
1158 |
"Modified: / 04-07-2006 / 19:22:32 / fm" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1159 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1160 |
|
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1161 |
contents:something |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1162 |
self contents:something keepUndoHistory:false. |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1163 |
! |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1164 |
|
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1165 |
contents:something keepUndoHistory:keepUndoHistory |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1166 |
super contents:something. |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1167 |
keepUndoHistory ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1168 |
undoSupport resetHistories. |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1169 |
]. |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1170 |
! |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1171 |
|
2213 | 1172 |
contentsAsString |
1173 |
"return the contents as a String (i.e. without emphasis)" |
|
1174 |
||
1175 |
list isNil ifTrue:[^ '']. |
|
1176 |
self removeTrailingBlankLines. |
|
1177 |
^ (list collect:[:each | each isNil ifTrue:[''] |
|
3160 | 1178 |
ifFalse:[each string] |
1179 |
]) asStringWithCRs |
|
2213 | 1180 |
! |
1181 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1182 |
cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1183 |
"return the cursors col (1..). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1184 |
This is the absolute col; NOT the visible col" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1185 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1186 |
^ cursorCol |
125 | 1187 |
! |
1188 |
||
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1189 |
cursorColHolder |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1190 |
"return a valueHolder for the cursors column (1..)." |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1191 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1192 |
^ cursorColHolder |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1193 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1194 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1195 |
cursorLine |
3160 | 1196 |
"return the cursors line (1..). |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1197 |
This is the absolute line; NOT the visible line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1198 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1199 |
^ cursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1200 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1201 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1202 |
cursorLineHolder |
3160 | 1203 |
"return a valueHolder for the cursors line (1..). |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1204 |
This is the absolute line; NOT the visible line" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1205 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1206 |
^ cursorLineHolder |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1207 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1208 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1209 |
list:something |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1210 |
"position cursor home when setting contents" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1211 |
|
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1212 |
|prevCursorLine prevCursorCol| |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1213 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1214 |
prevCursorLine := cursorLine. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1215 |
prevCursorCol := cursorCol. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1216 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1217 |
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
|
1218 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1219 |
(cursorMovementWhenUpdating == #endOfText |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1220 |
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
|
1221 |
^ self cursorToEndOfText |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1222 |
]. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1223 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1224 |
(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
|
1225 |
^ self cursorLine:prevCursorLine col:(self listAt:cursorLine) size + 1. |
3160 | 1226 |
]. |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1227 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1228 |
(cursorMovementWhenUpdating == #beginOfText |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1229 |
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
|
1230 |
^ self cursorHome |
2129
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 |
(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
|
1233 |
^ 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
|
1234 |
]. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1235 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1236 |
"/ 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
|
1237 |
"/ self cursorLine:prevCursorLine col:prevCursorCol. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1238 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1239 |
|
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1240 |
setContents:something |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1241 |
|selType| |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1242 |
|
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
1243 |
undoSupport resetHistories. |
2955 | 1244 |
|
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1245 |
selType := typeOfSelection. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1246 |
super setContents:something. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1247 |
typeOfSelection := selType. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1248 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1249 |
"Created: / 31.3.1998 / 23:35:06 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1250 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1251 |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1252 |
!EditTextView methodsFor:'accessing-look'! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1253 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1254 |
cursorForegroundColor:color1 backgroundColor:color2 |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1255 |
"set both cursor foreground and cursor background colors" |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1256 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1257 |
|wasOn| |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1258 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1259 |
wasOn := self hideCursor. |
1993 | 1260 |
cursorFgColor := color1 onDevice:device. |
1261 |
cursorBgColor := color2 onDevice:device. |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1262 |
wasOn ifTrue:[self showCursor] |
1333 | 1263 |
! |
1264 |
||
1899 | 1265 |
cursorType |
1266 |
"return the style of the text cursor. |
|
1267 |
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret |
|
3160 | 1268 |
#bigCaret and #bigSolidCaret" |
1899 | 1269 |
|
1270 |
^ cursorType |
|
1271 |
||
1272 |
"Modified: / 5.5.1999 / 14:52:33 / cg" |
|
1273 |
! |
|
1274 |
||
1333 | 1275 |
cursorType:aCursorTypeSymbol |
1276 |
"set the style of the text cursor. |
|
1277 |
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret |
|
3160 | 1278 |
#bigCaret and #bigSolidCaret" |
1333 | 1279 |
|
1334 | 1280 |
cursorType := aCursorTypeSymbol. |
1333 | 1281 |
|
1282 |
"Created: 21.9.1997 / 13:42:23 / cg" |
|
1283 |
"Modified: 21.9.1997 / 13:43:35 / cg" |
|
1334 | 1284 |
! |
1285 |
||
1899 | 1286 |
cursorTypeNoFocus |
1287 |
"return the style of the text cursor when the view has no focus. |
|
1288 |
If left unspecified, this is the same as the regular cursorType." |
|
1289 |
||
1290 |
^ cursorTypeNoFocus |
|
1291 |
||
1292 |
"Created: / 5.5.1999 / 14:52:46 / cg" |
|
1293 |
! |
|
1294 |
||
1334 | 1295 |
cursorTypeNoFocus:aCursorTypeSymbol |
1296 |
"set the style of the text cursor when the view has no focus. |
|
1297 |
If left unspecified, this is the same as the regular cursorType." |
|
1298 |
||
1299 |
cursorTypeNoFocus := aCursorTypeSymbol |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1300 |
! ! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1301 |
|
2119 | 1302 |
!EditTextView methodsFor:'change & update'! |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1303 |
|
125 | 1304 |
accept |
1305 |
"accept the current contents by executing the accept-action and/or |
|
1306 |
changeMessage." |
|
1307 |
||
1108 | 1308 |
acceptEnabled == false ifTrue:[ |
3945 | 1309 |
self beep. |
1310 |
^ self |
|
2035
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
1311 |
]. |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
1312 |
(disableIfInvisible == true and:[self reallyRealized not]) ifTrue:[ |
3945 | 1313 |
^ self |
1108 | 1314 |
]. |
1315 |
||
125 | 1316 |
lockUpdates := true. |
1013 | 1317 |
|
1318 |
"/ |
|
1319 |
"/ ST-80 way of doing it |
|
1320 |
"/ |
|
1321 |
model notNil ifTrue:[ |
|
3945 | 1322 |
self sendChangeMessageWith:self argForChangeMessage. |
1323 |
acceptChannel value:true withoutNotifying:self. |
|
2999 | 1324 |
]. |
1325 |
||
757
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1326 |
"/ |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1327 |
"/ ST/X way of doing things |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1328 |
"/ as a historic (and temporary) leftover, |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1329 |
"/ 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
|
1330 |
"/ - not with the actual string |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1331 |
"/ |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1332 |
acceptAction notNil ifTrue:[ |
3945 | 1333 |
acceptAction value:self list |
757
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1334 |
]. |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1335 |
|
125 | 1336 |
lockUpdates := false. |
757
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1337 |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1338 |
"Modified: / 30.1.1998 / 14:19:00 / cg" |
131 | 1339 |
! |
1340 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1341 |
argForChangeMessage |
597 | 1342 |
"return the argument to be passed with the change notification. |
1343 |
Defined as separate method for easier subclassability." |
|
1344 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1345 |
^ self contents |
597 | 1346 |
|
1347 |
"Modified: 29.4.1996 / 12:42:14 / cg" |
|
121 | 1348 |
! |
1349 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1350 |
getListFromModel |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1351 |
"get my contents from the model. |
597 | 1352 |
Redefined to ignore updates resulting from my own changes |
1353 |
(i.e. if lockUpdates is true)." |
|
121 | 1354 |
|
1355 |
" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1356 |
ignore updates from my own change |
121 | 1357 |
" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1358 |
lockUpdates ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1359 |
lockUpdates := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1360 |
^ self |
121 | 1361 |
]. |
2196
f8c955dd6eb9
validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents:
2186
diff
changeset
|
1362 |
super getListFromModel. |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1363 |
undoSupport resetHistories. |
2196
f8c955dd6eb9
validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents:
2186
diff
changeset
|
1364 |
|
f8c955dd6eb9
validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents:
2186
diff
changeset
|
1365 |
"/ validate the cursorLine |
3160 | 1366 |
(cursorLine notNil |
2310 | 1367 |
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
|
1368 |
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
|
1369 |
]. |
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1370 |
! |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1371 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1372 |
update:something with:aParameter from:changedObject |
1438
bed1564b0640
fixed update for acceptChannel
Claus Gittinger <cg@exept.de>
parents:
1437
diff
changeset
|
1373 |
changedObject == acceptChannel ifTrue:[ |
3160 | 1374 |
acceptChannel value == true ifTrue:[ |
1375 |
self accept. |
|
1376 |
]. |
|
1377 |
^ self. |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1378 |
]. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1379 |
super update:something with:aParameter from:changedObject |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1380 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1381 |
"Created: / 30.1.1998 / 14:15:56 / cg" |
1439
d1b3ca91ed8a
fixed update for acceptChannel
Claus Gittinger <cg@exept.de>
parents:
1438
diff
changeset
|
1382 |
"Modified: / 1.2.1998 / 13:15:55 / cg" |
121 | 1383 |
! ! |
1384 |
||
1385 |
!EditTextView methodsFor:'cursor handling'! |
|
1386 |
||
2406 | 1387 |
characterPositionOfCursor |
1388 |
^ self characterPositionOfLine:cursorLine col:cursorCol |
|
1389 |
! |
|
1390 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1391 |
cursorBacktab |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1392 |
"move cursor to prev tabstop" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1393 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1394 |
self cursorCol:(self prevTabBefore:cursorCol). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1395 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1396 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1397 |
cursorCol:newCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1398 |
"move cursor to some column in the current line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1399 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1400 |
|wasOn| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1401 |
|
2822 | 1402 |
(cursorCol == newCol) ifTrue:[^ self]. |
1403 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1404 |
wasOn := self hideCursor. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1405 |
self setValidatedCursorCol:newCol. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1406 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1407 |
|
1408 |
"Modified: 22.5.1996 / 14:25:53 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1409 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1410 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1411 |
cursorDown |
632
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1412 |
"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
|
1413 |
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
|
1414 |
|
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1415 |
|wasOn| |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1416 |
|
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1417 |
self cursorDown:1. |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1418 |
|
2707 | 1419 |
"/ cursor beyond text ? |
632
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1420 |
cursorLine > list size ifTrue:[ |
3160 | 1421 |
wasOn := self hideCursor. |
1422 |
self setValidatedCursorLine:(list size + 1) col:cursorCol. |
|
1423 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
1424 |
self beep. |
|
632
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1425 |
]. |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1426 |
|
1561
db5f27354172
make cursor correctly visible if in partial last line.
Claus Gittinger <cg@exept.de>
parents:
1560
diff
changeset
|
1427 |
"Modified: / 10.6.1998 / 17:00:23 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1428 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1429 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1430 |
cursorDown:n |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1431 |
"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
|
1432 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1433 |
|wasOn nv nL| |
259
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 |
cursorVisibleLine notNil ifTrue:[ |
3160 | 1436 |
wasOn := self hideCursor. |
1437 |
nv := cursorVisibleLine + n - 1. |
|
1438 |
(nv >= nFullLinesShown) ifTrue:[ |
|
1439 |
self scrollDown:(nv - nFullLinesShown + 1) |
|
1440 |
]. |
|
1441 |
self setValidatedCursorLine:(cursorLine + n) col:cursorCol. |
|
1442 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1443 |
] ifFalse:[ |
3160 | 1444 |
(nL := cursorLine) isNil ifTrue:[ |
1445 |
nL := firstLineShown |
|
1446 |
]. |
|
1447 |
self setValidatedCursorLine:(nL + n) col:cursorCol. |
|
1448 |
self makeCursorVisible. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1449 |
]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
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 / 16:59:17 / 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 |
|
121 | 1454 |
cursorHome |
597 | 1455 |
"scroll to top AND move cursor to first line of text." |
121 | 1456 |
|
674 | 1457 |
self cursorLine:1 col:1 |
1458 |
||
1459 |
"/ |wasOn| |
|
1460 |
"/ |
|
1461 |
"/ wasOn := self hideCursor. |
|
1462 |
"/ self scrollToTop. |
|
1463 |
"/ cursorLine := cursorVisibleLine := 1. |
|
1464 |
"/ cursorCol := self validateCursorCol:1 inLine:cursorLine. |
|
1465 |
"/ self makeCursorVisibleAndShowCursor:wasOn. |
|
1466 |
||
1467 |
"Modified: 22.5.1996 / 18:26:42 / cg" |
|
121 | 1468 |
! |
1469 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1470 |
cursorLeft |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1471 |
"move cursor to left" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1472 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1473 |
(cursorCol ~~ 1) ifTrue:[ |
3160 | 1474 |
self cursorCol:(cursorCol - 1) |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1475 |
] ifFalse:[ |
3160 | 1476 |
cursorLine ~~ 1 ifTrue:[ |
1477 |
self st80EditMode ifTrue:[ |
|
1478 |
self cursorUp. |
|
1479 |
self cursorToEndOfLine. |
|
1480 |
] |
|
1481 |
] |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1482 |
] |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1483 |
|
1426
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1484 |
"Modified: / 23.1.1998 / 12:37:13 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1485 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1486 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1487 |
cursorLine:line col:col |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1488 |
"this positions onto physical - not visible - line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1489 |
|
676 | 1490 |
|wasOn newCol| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1491 |
|
2822 | 1492 |
((line == cursorLine) and:[col == cursorCol]) ifTrue:[^ self]. |
1493 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1494 |
wasOn := self hideCursor. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1495 |
self setValidatedCursorLine:line. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1496 |
|
672 | 1497 |
(col < 1) ifTrue:[ |
3160 | 1498 |
newCol := 1 |
672 | 1499 |
] ifFalse:[ |
3160 | 1500 |
newCol := col. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1501 |
]. |
2647
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
1502 |
self st80EditMode ifTrue:[ |
3160 | 1503 |
(cursorLine == list size |
1504 |
and:[cursorLine ~~ line]) ifTrue:[ |
|
1505 |
newCol := (self listAt:(list size)) size + 1. |
|
1506 |
] |
|
1419 | 1507 |
]. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1508 |
self setValidatedCursorCol:newCol. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1509 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1510 |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1511 |
"Modified: / 20.6.1998 / 18:19:06 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1512 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1513 |
|
1580
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1514 |
cursorMovementAllowed |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1515 |
"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
|
1516 |
(via button-click, or cursor-key with selection). |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1517 |
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
|
1518 |
in special subclasses (such as a terminal view), where |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1519 |
this is not wanted" |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1520 |
|
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1521 |
^ true |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1522 |
|
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1523 |
"Created: / 18.6.1998 / 14:11:16 / cg" |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1524 |
! |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1525 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1526 |
cursorReturn |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1527 |
"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
|
1528 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1529 |
|wasOn| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1530 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1531 |
self checkForExistingLine:(cursorLine + 1). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1532 |
cursorVisibleLine notNil ifTrue:[ |
3160 | 1533 |
nFullLinesShown notNil ifTrue:[ |
1534 |
(cursorVisibleLine >= nFullLinesShown) ifTrue:[self scrollDown] |
|
1535 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1536 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1537 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1538 |
wasOn := self hideCursor. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1539 |
self setValidatedCursorLine:(cursorLine + 1) col:1. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1540 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1541 |
|
674 | 1542 |
"Modified: 22.5.1996 / 18:27:34 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1543 |
! |
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 |
cursorRight |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1546 |
"move cursor to right" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1547 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1548 |
|l| |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1549 |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
1550 |
self st80EditMode ifTrue:[ |
3160 | 1551 |
l := (self listAt:cursorLine). |
1552 |
cursorCol >= (l size + 1) ifTrue:[ |
|
1553 |
cursorLine < list size ifTrue:[ |
|
1554 |
self cursorReturn. |
|
1555 |
]. |
|
1556 |
^ self |
|
1557 |
] |
|
1558 |
]. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1559 |
self cursorCol:(cursorCol + 1) |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1560 |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1561 |
"Modified: / 20.6.1998 / 18:19:07 / cg" |
259
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 |
|
1833 | 1564 |
cursorShown:aBoolean |
1565 |
"change cursor visibility |
|
1566 |
return true if cursor was visible before." |
|
1567 |
||
1568 |
|oldState| |
|
1569 |
||
1570 |
oldState := cursorShown. |
|
1571 |
||
1572 |
aBoolean ifTrue:[ |
|
3160 | 1573 |
self drawCursor. |
1833 | 1574 |
] ifFalse:[ |
3160 | 1575 |
(cursorShown and:[shown]) ifTrue: [ |
1576 |
self undrawCursor. |
|
1577 |
]. |
|
1833 | 1578 |
]. |
1579 |
cursorShown := aBoolean. |
|
1580 |
||
1581 |
^ oldState |
|
1582 |
||
1583 |
"Modified: / 30.3.1999 / 15:32:43 / stefan" |
|
1584 |
"Created: / 30.3.1999 / 15:59:30 / stefan" |
|
1585 |
! |
|
1586 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1587 |
cursorTab |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1588 |
"move cursor to next tabstop" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1589 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1590 |
self cursorCol:(self nextTabAfter:cursorCol). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1591 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1592 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1593 |
cursorToBeginOfLine |
3020
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1594 |
"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
|
1595 |
|
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1596 |
|textStart l| |
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1597 |
|
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1598 |
l := self listAt:cursorLine. |
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1599 |
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
|
1600 |
cursorCol > textStart ifTrue:[ |
3160 | 1601 |
self cursorCol:textStart |
3020
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1602 |
] ifFalse:[ |
3160 | 1603 |
self cursorCol:1 |
3020
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1604 |
] |
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1605 |
|
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1606 |
"Created: / 8.8.2004 / 18:51:21 / janfrog" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1607 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1608 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1609 |
cursorToBottom |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1610 |
"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
|
1611 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1612 |
|wasOn newTop| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1613 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1614 |
wasOn := self hideCursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1615 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1616 |
newTop := list size - nFullLinesShown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1617 |
(newTop < 1) ifTrue:[ |
3160 | 1618 |
newTop := 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1619 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1620 |
self scrollToLine:newTop. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1621 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1622 |
self setValidatedCursorLine:(list size) col:1. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1623 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1624 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1625 |
|
674 | 1626 |
"Modified: 22.5.1996 / 18:27:45 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1627 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1628 |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1629 |
cursorToCharacterPosition:pos |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1630 |
"compute line/col from character position (1..) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1631 |
and move the cursor onto that char" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1632 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1633 |
|line col| |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1634 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1635 |
line := self lineOfCharacterPosition:pos. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1636 |
col := pos - (self characterPositionOfLine:line col:1) + 1. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1637 |
self cursorLine:line col:col |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1638 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1639 |
"Created: / 15.1.1998 / 21:55:33 / cg" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1640 |
! |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1641 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1642 |
cursorToEnd |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1643 |
"move cursor down below last line of text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1644 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1645 |
|wasOn newTop lineNr line| |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1646 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1647 |
lineNr := list size. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1648 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1649 |
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
|
1650 |
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
|
1651 |
(line isEmptyOrNil) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1652 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1653 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1654 |
]. |
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 |
wasOn := self hideCursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1657 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1658 |
lineNr := lineNr + 1. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1659 |
newTop := lineNr - nFullLinesShown. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1660 |
(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
|
1661 |
newTop := 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1662 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1663 |
self scrollToLine:newTop. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1664 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1665 |
self setValidatedCursorLine:lineNr col:1. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1666 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1667 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1668 |
|
674 | 1669 |
"Modified: 22.5.1996 / 18:27:53 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1670 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1671 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1672 |
cursorToEndOfLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1673 |
"move cursor to end of current line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1674 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1675 |
|line| |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1676 |
|
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1677 |
line := (self listAt:cursorLine). |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1678 |
self cursorCol:(line size + 1) |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1679 |
|
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1680 |
"Modified: 13.8.1997 / 15:34:02 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1681 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1682 |
|
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1683 |
cursorToEndOfText |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1684 |
"move cursor to the end of the text (behinf last character in last line)" |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1685 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1686 |
|wasOn newTop| |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1687 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1688 |
wasOn := self hideCursor. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1689 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1690 |
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
|
1691 |
(newTop < 1) ifTrue:[ |
3160 | 1692 |
newTop := 1 |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1693 |
]. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1694 |
self scrollToLine:newTop. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1695 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1696 |
self setValidatedCursorLine:list size. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1697 |
self setCursorCol:(self validateCursorCol:(self listAt:cursorLine) size inLine:cursorLine). |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1698 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1699 |
self makeCursorVisibleAndShowCursor:wasOn. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1700 |
! |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1701 |
|
3310 | 1702 |
cursorToEndOfWord |
1703 |
"move the cursor to the end of the word" |
|
1704 |
||
1705 |
(cursorLine > list size) ifTrue:[^ self]. |
|
1706 |
||
1707 |
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
|
1708 |
: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
|
1709 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1710 |
self cursorLine:endLine col:endCol+1 |
3310 | 1711 |
] |
1712 |
||
1713 |
"Created: / 28-06-2006 / 19:16:30 / cg" |
|
1714 |
! |
|
1715 |
||
131 | 1716 |
cursorToFirstVisibleLine |
1717 |
"place cursor into the first visible line; do not scroll." |
|
1718 |
||
1719 |
self cursorLine:(self visibleLineToAbsoluteLine:1) col:1 |
|
1720 |
! |
|
1721 |
||
1722 |
cursorToLastVisibleLine |
|
1723 |
"place cursor into the first visible line; do not scroll." |
|
1724 |
||
1725 |
self cursorLine:(self visibleLineToAbsoluteLine:nFullLinesShown) col:1 |
|
1726 |
! |
|
1727 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1728 |
cursorToNextWord |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1729 |
"move the cursor to the beginning of the next word" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1730 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1731 |
|col line searching| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1732 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1733 |
(cursorLine > list size) ifTrue:[^ self]. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1734 |
|
3890 | 1735 |
self |
1736 |
wordAtLine:cursorLine col:cursorCol do:[ |
|
1737 |
:beginLine :beginCol :endLine :endCol :style | |
|
1738 |
||
1739 |
line := endLine. |
|
1740 |
col := endCol + 1. |
|
1741 |
searching := true. |
|
1742 |
[searching |
|
1743 |
and:[(self characterAtLine:line col:col) isSeparator]] whileTrue:[ |
|
1744 |
self wordAtLine:line col:col do:[ |
|
1745 |
:beginLine :beginCol :endLine :endCol :style | |
|
1746 |
||
1747 |
(line > list size) ifTrue:[ |
|
1748 |
"break out" |
|
1749 |
searching := false |
|
1750 |
] ifFalse:[ |
|
1751 |
line := endLine. |
|
1752 |
col := endCol + 1. |
|
1753 |
] |
|
1754 |
] |
|
1755 |
]. |
|
1756 |
self cursorLine:line col:col |
|
1757 |
] |
|
121 | 1758 |
! |
1759 |
||
499 | 1760 |
cursorToPreviousWord |
1761 |
"move the cursor to the beginning of this or the previous word" |
|
1762 |
||
1763 |
|col line searching l| |
|
1764 |
||
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1765 |
(cursorLine > list size) ifTrue:[^ self]. "/ this is rubbish |
499 | 1766 |
|
1767 |
self wordAtLine:cursorLine col:cursorCol do:[ |
|
3160 | 1768 |
:beginLine :beginCol :endLine :endCol :style | |
1769 |
||
1770 |
line := beginLine. |
|
1771 |
col := beginCol. |
|
1772 |
style == #wordLeft ifTrue:[ |
|
1773 |
col := col + 1 |
|
1774 |
]. |
|
1775 |
||
1776 |
(cursorLine == line |
|
1777 |
and:[cursorCol == col]) ifTrue:[ |
|
1778 |
searching := true. |
|
1779 |
||
1780 |
col > 1 ifTrue:[ |
|
1781 |
col := col - 1. |
|
1782 |
]. |
|
1783 |
||
1784 |
[searching] whileTrue:[ |
|
1785 |
(col == 1) ifTrue:[ |
|
1786 |
line == 1 ifTrue:[ |
|
1787 |
searching := false |
|
1788 |
] ifFalse:[ |
|
1789 |
line := line - 1. |
|
1790 |
l := list at:line. |
|
1791 |
col := l size + 1. |
|
1792 |
] |
|
1793 |
] ifFalse:[ |
|
1794 |
(self characterAtLine:line col:col) isSeparator ifFalse:[ |
|
1795 |
self wordAtLine:line col:col do:[ |
|
1796 |
:beginLine :beginCol :endLine :endCol :style | |
|
1797 |
||
1798 |
line := beginLine. |
|
1799 |
col := beginCol. |
|
1800 |
style == #wordLeft ifTrue:[ |
|
1801 |
col := col + 1 |
|
1802 |
]. |
|
1803 |
searching := false. |
|
1804 |
] |
|
1805 |
] ifTrue:[ |
|
1806 |
col := col - 1 |
|
1807 |
] |
|
1808 |
] |
|
1809 |
] |
|
1810 |
]. |
|
1811 |
self cursorLine:line col:col |
|
499 | 1812 |
] |
1813 |
||
1814 |
"Created: 8.3.1996 / 21:52:48 / cg" |
|
1815 |
"Modified: 8.3.1996 / 22:12:45 / cg" |
|
1816 |
! |
|
1817 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1818 |
cursorToTop |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1819 |
"move cursor to absolute home" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1820 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1821 |
self cursorLine:1 col:1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1822 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1823 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1824 |
cursorUp |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1825 |
"move cursor up; scroll if at start of visible text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1826 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1827 |
self cursorUp:1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1828 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1829 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1830 |
cursorUp:n |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1831 |
"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
|
1832 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1833 |
|wasOn nv nl| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1834 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1835 |
cursorLine isNil ifTrue:[ |
3725
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1836 |
self setCursorLine:(firstLineShown + nFullLinesShown - 1). |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1837 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1838 |
nl := cursorLine - n. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1839 |
nl < 1 ifTrue:[nl := 1]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1840 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1841 |
(nl ~~ cursorLine) ifTrue: [ |
3725
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1842 |
wasOn := self hideCursor. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1843 |
cursorVisibleLine notNil ifTrue:[ |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1844 |
nv := cursorVisibleLine - n. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1845 |
nv < 1 ifTrue:[ |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1846 |
self scrollUp:(nv negated + 1) |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1847 |
]. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1848 |
]. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1849 |
self setValidatedCursorLine:nl col:cursorCol. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1850 |
"/ wasOn ifTrue:[self showCursor]. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1851 |
self makeCursorVisibleAndShowCursor:wasOn. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1852 |
] |
672 | 1853 |
|
674 | 1854 |
"Modified: 22.5.1996 / 18:28:11 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1855 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1856 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1857 |
cursorVisibleLine:visibleLineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1858 |
"put cursor to visibleline/col" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1859 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1860 |
|wasOn newCol listLine| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1861 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1862 |
wasOn := self hideCursor. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1863 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1864 |
listLine := self visibleLineToAbsoluteLine:visibleLineNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1865 |
self setValidatedCursorLine:listLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1866 |
cursorVisibleLine := visibleLineNr. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1867 |
|
676 | 1868 |
newCol := colNr. |
1869 |
(newCol < 1) ifTrue:[ |
|
3160 | 1870 |
newCol := 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1871 |
]. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1872 |
self setValidatedCursorCol:newCol. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1873 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1874 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1875 |
|
1597
5fdcfcedb91c
fixed cursor positioning after replaceStringAtCursor.
Claus Gittinger <cg@exept.de>
parents:
1596
diff
changeset
|
1876 |
"Modified: / 20.6.1998 / 18:40:28 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1877 |
! |
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 |
cursorX:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1880 |
"put cursor to position next to x/y coordinate in view" |
121 | 1881 |
|
1882 |
|line col| |
|
1883 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1884 |
line := self visibleLineOfY:y. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1885 |
col := self colOfX:x inVisibleLine:line. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1886 |
self cursorVisibleLine:line col:col. |
121 | 1887 |
! |
1888 |
||
1889 |
drawCursor |
|
1890 |
"draw the cursor if shown and cursor is visible. |
|
1891 |
(but not, if there is a selection - to avoid confusion)" |
|
1892 |
||
1893 |
shown ifTrue:[ |
|
3160 | 1894 |
cursorVisibleLine notNil ifTrue:[ |
1895 |
self hasSelection ifFalse:[ |
|
1896 |
self drawCursorCharacter |
|
1897 |
] |
|
1898 |
] |
|
121 | 1899 |
] |
1900 |
! |
|
1901 |
||
1902 |
drawCursor:cursorType with:fgColor and:bgColor |
|
1903 |
"draw a cursor; the argument cursorType specifies what type |
|
125 | 1904 |
of cursor should be drawn. |
728
3ef81000ee8c
new cursorTypes: #bigCaret and #bigSolidCaret
Claus Gittinger <cg@exept.de>
parents:
698
diff
changeset
|
1905 |
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret |
3160 | 1906 |
#bigCaret and #bigSolidCaret" |
2085
4498b1a50d72
fixed undrawCursor, when there is italic text
Claus Gittinger <cg@exept.de>
parents:
2072
diff
changeset
|
1907 |
|
2570 | 1908 |
|x y w char y2 x1 x2 oldPaint oldClip| |
121 | 1909 |
|
1910 |
self hasSelection ifTrue:[ |
|
3160 | 1911 |
" |
1912 |
hide cursor, if there is a selection |
|
1913 |
" |
|
1914 |
^ super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
|
121 | 1915 |
]. |
1916 |
||
1334 | 1917 |
cursorType == #none ifTrue:[ |
3160 | 1918 |
^ self |
1334 | 1919 |
]. |
1920 |
||
121 | 1921 |
cursorType == #block ifTrue:[ |
3160 | 1922 |
super drawVisibleLine:cursorVisibleLine |
1923 |
col:cursorCol |
|
1924 |
with:fgColor |
|
1925 |
and:bgColor. |
|
1926 |
^ self |
|
121 | 1927 |
]. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
1928 |
x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x. |
121 | 1929 |
y := self yOfVisibleLine:cursorVisibleLine. |
1930 |
||
1449
2a54bdfff203
eliminated direct refs to paint instvar
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
1931 |
oldPaint := self paint. "/ do not clobber GC |
121 | 1932 |
cursorType == #frame ifTrue:[ |
3160 | 1933 |
super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
1934 |
||
1935 |
char := self characterUnderCursor asString. |
|
1936 |
self paint:bgColor. |
|
1937 |
self displayRectangleX:x y:y |
|
1938 |
width:(font widthOf:char) height:fontHeight. |
|
133 | 1939 |
] ifFalse:[ |
3160 | 1940 |
self paint:bgColor. |
1941 |
cursorType == #ibeam ifTrue:[ |
|
1942 |
x1 := x - 1. |
|
1943 |
y2 := y + fontHeight - 1. |
|
1944 |
self displayLineFromX:x1 y:y toX:x1 y:y2. |
|
1945 |
self displayLineFromX:x y:y toX:x y:y2. |
|
1946 |
^ self |
|
1947 |
]. |
|
1948 |
||
1949 |
cursorType == #Ibeam ifTrue:[ |
|
1950 |
x1 := x - 1. |
|
1951 |
y := y + 1. |
|
1952 |
y2 := y + fontHeight - 1. |
|
1953 |
self displayLineFromX:x1 y:y toX:x1 y:y2. |
|
1954 |
self displayLineFromX:x y:y toX:x y:y2. |
|
1955 |
self displayLineFromX:x1-2 y:y toX:x+2 y:y. |
|
1956 |
self displayLineFromX:x1-2 y:y2 toX:x+2 y:y2. |
|
1957 |
^ self |
|
1958 |
]. |
|
1959 |
||
1960 |
y := y + fontHeight - 3. |
|
1961 |
((cursorType == #bigCaret) or:[cursorType == #bigSolidCaret]) ifTrue:[ |
|
1962 |
w := (fontWidth * 2 // 3) max:4. |
|
1963 |
y2 := y + w + (w//2). |
|
1964 |
] ifFalse:[ |
|
1965 |
w := (fontWidth // 2) max:4. |
|
1966 |
y2 := y + w. |
|
1967 |
]. |
|
1968 |
x1 := x - w. |
|
1969 |
x2 := x + w. |
|
1970 |
||
1971 |
oldClip := self clippingRectangleOrNil. |
|
1972 |
self clippingRectangle:(margin@margin extent:(width-margin) @ (height-margin)). |
|
1973 |
||
1974 |
cursorType == #caret ifTrue:[ |
|
1975 |
self lineWidth:2. |
|
1976 |
self displayLineFromX:x1 y:y2 toX:x y:y. |
|
1977 |
self displayLineFromX:x y:y toX:x2 y:y2. |
|
1978 |
] ifFalse:[ |
|
1979 |
"anything else: solidCaret" |
|
1980 |
||
1981 |
self fillPolygon:(Array with:(x1 @ y2) |
|
1982 |
with:(x @ y) |
|
1983 |
with:(x2 @ y2)) |
|
1984 |
]. |
|
1985 |
||
1986 |
self clippingRectangle:oldClip |
|
121 | 1987 |
]. |
133 | 1988 |
self paint:oldPaint. |
662
4bcdf0cce3a7
dont let caret cursor become too small (with small fonts)
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
1989 |
|
2088 | 1990 |
"Modified: / 15.12.1999 / 22:24:17 / cg" |
121 | 1991 |
! |
1992 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1993 |
drawCursorCharacter |
3160 | 1994 |
"draw the cursor. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1995 |
(i.e. the cursor if no selection) |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1996 |
- helper for many cursor methods" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1997 |
|
3160 | 1998 |
(hasKeyboardFocus |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
1999 |
and:[self enabled |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
2000 |
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
|
2001 |
self drawFocusCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2002 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
2003 |
self drawNoFocusCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2004 |
] |
1817
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
2005 |
|
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
2006 |
"Modified: / 23.3.1999 / 13:52:48 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2007 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2008 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2009 |
drawFocusCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2010 |
"draw the cursor when the focus is in the view." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2011 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2012 |
self hasSelection ifTrue:[ |
3160 | 2013 |
^ super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
1334 | 2014 |
]. |
2015 |
cursorType == #none ifTrue:[ |
|
3160 | 2016 |
^ self undrawCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2017 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2018 |
self drawCursor:cursorType with:cursorFgColor and:cursorBgColor. |
1334 | 2019 |
|
2020 |
"Modified: 22.9.1997 / 00:16:38 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2021 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2022 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2023 |
drawNoFocusCursor |
3160 | 2024 |
"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
|
2025 |
|
1334 | 2026 |
|cType| |
2027 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2028 |
self hasSelection ifTrue:[ |
3160 | 2029 |
^ super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
121 | 2030 |
]. |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
2031 |
|
1334 | 2032 |
cType := cursorTypeNoFocus ? cursorType. |
2033 |
cType == #none ifTrue:[ |
|
3160 | 2034 |
^ self undrawCursor |
1334 | 2035 |
]. |
2036 |
||
2037 |
cType == #block ifTrue:[ |
|
3160 | 2038 |
^ self drawCursor:#frame with:cursorNoFocusFgColor and:cursorBgColor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2039 |
]. |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
2040 |
|
1334 | 2041 |
^ self drawCursor:cType with:cursorNoFocusFgColor and:cursorNoFocusFgColor. |
2042 |
||
2043 |
"Modified: 22.9.1997 / 00:16:13 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2044 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2045 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2046 |
gotoLine:aLineNumber |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2047 |
"position cursor onto line, aLineNumber. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2048 |
Make certain that this line is visible" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2049 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2050 |
self makeLineVisible:aLineNumber. |
2951 | 2051 |
self unselect. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2052 |
self cursorLine:aLineNumber col:1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2053 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2054 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2055 |
hideCursor |
1833 | 2056 |
"make cursor invisible if currently invisible" |
2057 |
||
2058 |
^ self cursorShown:false |
|
2059 |
||
2060 |
"Modified: / 30.3.1999 / 16:02:28 / stefan" |
|
121 | 2061 |
! |
2062 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2063 |
makeCursorVisible |
3160 | 2064 |
"scroll text to make cursorline visible |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2065 |
(i.e. to have cursorLine in visible area)" |
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 |
|line col| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2068 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2069 |
cursorLine notNil ifTrue:[ |
3160 | 2070 |
line := cursorLine. |
2071 |
col := cursorCol. |
|
2072 |
" |
|
2073 |
if there is a selection, its better to |
|
2074 |
have its start being visible, instead of the end |
|
2075 |
" |
|
2076 |
(selectionStartLine notNil |
|
2077 |
and:[selectionEndLine notNil]) ifTrue:[ |
|
2078 |
expandingTop ~~ false ifTrue:[ |
|
2079 |
line := selectionStartLine. |
|
2080 |
col := selectionStartCol. |
|
2081 |
] ifFalse:[ |
|
2082 |
line := selectionEndLine. |
|
2083 |
col := selectionEndCol |
|
2084 |
] |
|
2085 |
]. |
|
2086 |
self makeLineVisible:line. |
|
2087 |
self makeColVisible:col inLine:line |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2088 |
] |
479
fae6d1251888
fixed Shift-Cursor selection & show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
2089 |
|
fae6d1251888
fixed Shift-Cursor selection & show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
2090 |
"Modified: 6.3.1996 / 13:46:46 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2091 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2092 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2093 |
makeCursorVisibleAndShowCursor:flag |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2094 |
"scroll to make cursorLine visible; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2095 |
if flag is true, draw the cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2096 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2097 |
self makeCursorVisible. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2098 |
flag ifTrue:[self showCursor] |
121 | 2099 |
! |
2100 |
||
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2101 |
setCursorCol:colNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2102 |
"strictly private: set the cursorCol" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2103 |
|
2815 | 2104 |
cursorCol := (colNr max:1). |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2105 |
cursorColHolder value:cursorCol. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2106 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2107 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2108 |
setCursorLine:lineNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2109 |
"strictly private: set the cursorLine" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2110 |
|
3303 | 2111 |
"/ self assert:(lineNr notNil). |
2112 |
||
2113 |
cursorLine := (lineNr ? 1). |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2114 |
cursorLineHolder value:cursorLine. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2115 |
self updateCursorVisibleLine. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2116 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2117 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2118 |
setCursorLine:lineNr col:colNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2119 |
"strictly private: set the cursorLine, col and update the visibleLine" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2120 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2121 |
self setCursorLine:lineNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2122 |
self setCursorCol:colNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2123 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2124 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2125 |
setValidatedCursorCol:colNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2126 |
"strictly private: set the cursorCol" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2127 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2128 |
self setCursorCol:(self validateCursorCol:colNr inLine:cursorLine). |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2129 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2130 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2131 |
setValidatedCursorLine:lineNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2132 |
"strictly private: set the cursorLine and update the visibleLine" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2133 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2134 |
self setCursorLine:(self validateCursorLine:lineNr). |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2135 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2136 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2137 |
setValidatedCursorLine:lineNr col:colNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2138 |
"strictly private: set the cursorLine, col and update the visibleLine" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2139 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2140 |
self setValidatedCursorLine:lineNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2141 |
self setValidatedCursorCol:colNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2142 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2143 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2144 |
showCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2145 |
"make cursor visible if currently invisible" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2146 |
|
1833 | 2147 |
^ self cursorShown:true |
2148 |
||
2149 |
"Modified: / 30.3.1999 / 16:02:34 / stefan" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2150 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2151 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2152 |
undrawCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2153 |
"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
|
2154 |
|
2085
4498b1a50d72
fixed undrawCursor, when there is italic text
Claus Gittinger <cg@exept.de>
parents:
2072
diff
changeset
|
2155 |
|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
|
2156 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2157 |
cursorVisibleLine notNil ifTrue:[ |
3160 | 2158 |
prevCol := cursorCol - 1. |
2159 |
||
2160 |
"/ if there is any italic stuff in the cursor line, |
|
2161 |
"/ redraw it completely (because characters overlap). |
|
2162 |
cursorCol > 1 ifTrue:[ |
|
2163 |
(line := self listAt:cursorLine) notNil ifTrue:[ |
|
2164 |
line hasChangeOfEmphasis ifTrue:[ |
|
2165 |
line size >= (cursorCol-1) ifTrue:[ |
|
2166 |
e1 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol-1). |
|
2167 |
line size >= (cursorCol) ifTrue:[ |
|
2168 |
e2 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol). |
|
2169 |
line size >= (cursorCol+1) ifTrue:[ |
|
2170 |
e3 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol+1) |
|
2171 |
]. |
|
2172 |
]. |
|
2173 |
]. |
|
2174 |
(e1 notNil or:[e2 notNil or:[e3 notNil]]) ifTrue:[ |
|
2175 |
^ super redrawVisibleLine:cursorVisibleLine |
|
2176 |
] |
|
2177 |
] |
|
2178 |
] |
|
2179 |
]. |
|
2180 |
||
2181 |
((cursorType == #caret) |
|
2182 |
or:[cursorType == #solidCaret |
|
2183 |
or:[cursorType == #bigSolidCaret |
|
2184 |
or:[cursorType == #bigCaret |
|
2185 |
or:[cursorType == #Ibeam]]]]) ifTrue:[ |
|
2186 |
"caret-cursor touches 4 characters" |
|
2187 |
((cursorCol > 1) and:[fontIsFixedWidth]) ifTrue:[ |
|
2188 |
super redrawVisibleLine:cursorVisibleLine-1 from:prevCol to:cursorCol. |
|
2189 |
super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol. |
|
2190 |
super redrawVisibleLine:cursorVisibleLine+1 from:prevCol to:cursorCol. |
|
2191 |
] ifFalse:[ |
|
2192 |
"care for left margin" |
|
2193 |
super redrawVisibleLine:cursorVisibleLine; redrawVisibleLine:cursorVisibleLine+1. |
|
2194 |
]. |
|
2195 |
^ self |
|
2196 |
]. |
|
2197 |
||
2198 |
cursorType == #ibeam ifTrue:[ |
|
2199 |
"ibeam-cursor touches 2 characters" |
|
2200 |
cursorCol > 1 ifTrue:[ |
|
2201 |
super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol. |
|
2202 |
] ifFalse:[ |
|
2203 |
"care for left margin" |
|
2204 |
super redrawVisibleLine:cursorVisibleLine. |
|
2205 |
]. |
|
2206 |
^ self |
|
2207 |
]. |
|
2208 |
||
2209 |
"block cursor is simple - just one character under cursor" |
|
2210 |
||
2211 |
"/ however, if italic characters are involved, we must care |
|
2212 |
"/ for the chars before/after the cursor. |
|
2213 |
"/ We redraw the part of the previous character which got |
|
2214 |
"/ detroyed by the block cursor. |
|
2215 |
"/ (must change the clip, to avoid destroying the prev-prev character) |
|
2216 |
||
2217 |
line := self visibleAt:cursorVisibleLine. |
|
2218 |
(line notNil and:[line isText]) ifTrue:[ |
|
2219 |
cursorCol > 1 ifTrue:[ |
|
2220 |
oldClip := self clippingRectangleOrNil. |
|
2221 |
x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x. |
|
2222 |
y := self yOfVisibleLine:cursorVisibleLine. |
|
2223 |
self clippingRectangle:(x@y extent:((font width * 2) @ fontHeight)). |
|
2224 |
super redrawVisibleLine:cursorVisibleLine from:cursorCol-1 to:cursorCol. |
|
2225 |
self clippingRectangle:oldClip. |
|
2226 |
^ self. |
|
2227 |
]. |
|
2228 |
]. |
|
2229 |
super redrawVisibleLine:cursorVisibleLine col:cursorCol |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2230 |
] |
728
3ef81000ee8c
new cursorTypes: #bigCaret and #bigSolidCaret
Claus Gittinger <cg@exept.de>
parents:
698
diff
changeset
|
2231 |
|
2088 | 2232 |
"Modified: / 15.12.1999 / 22:25:59 / cg" |
121 | 2233 |
! |
2234 |
||
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2235 |
updateCursorVisibleLine |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2236 |
"strictly private: set the visibleLine from the cursorLine. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2237 |
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
|
2238 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2239 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2240 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2241 |
|
672 | 2242 |
validateCursorCol:col inLine:line |
674 | 2243 |
"check of col is a valid cursor position; return a new col-nr if not. |
3160 | 2244 |
Here, no limits are enforced (and col is returned), |
2245 |
but it may be redefined in EditFields or views which dont like the |
|
674 | 2246 |
cursor to be positioned behind the end of a textLine (vi/st-80 behavior)" |
672 | 2247 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
2248 |
|l max| |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
2249 |
|
1419 | 2250 |
"/ in ST80 mode, |
2707 | 2251 |
"/ the cursor may not be positioned beyond the |
2252 |
"/ end of a line or beyond the last line of the text |
|
3160 | 2253 |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2254 |
self st80EditMode ifTrue:[ |
3160 | 2255 |
l := (self listAt:line). |
2256 |
max := l size + 1. |
|
2257 |
col > max ifTrue:[ |
|
2258 |
^ max |
|
2259 |
] |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
2260 |
]. |
672 | 2261 |
^ col |
2262 |
||
1419 | 2263 |
"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
|
2264 |
"Modified: / 20.6.1998 / 18:19:24 / cg" |
674 | 2265 |
! |
2266 |
||
2267 |
validateCursorLine:line |
|
2268 |
"check of line is a valid cursor line; return a fixed line-nr if not. |
|
3160 | 2269 |
Here, no limits are enforced (and line is returned), but it may be |
674 | 2270 |
redefined in views which dont like the cursor to be positioned |
2271 |
behind the end of the text (vi/st-80 behavior), or want to |
|
2272 |
skip reserved regions" |
|
2273 |
||
1419 | 2274 |
"/ |
2275 |
"/ in st80Mode, the cursor may not be positioned |
|
2707 | 2276 |
"/ beyond the last line |
1419 | 2277 |
"/ |
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2278 |
self st80EditMode ifTrue:[ |
3160 | 2279 |
^ (line min:(list size)) max:1 |
1419 | 2280 |
]. |
674 | 2281 |
^ line |
2282 |
||
1419 | 2283 |
"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
|
2284 |
"Modified: / 20.6.1998 / 18:19:26 / cg" |
672 | 2285 |
! |
2286 |
||
121 | 2287 |
withCursorOffDo:aBlock |
2288 |
"evaluate aBlock with cursor off; turn it on afterwards." |
|
2289 |
||
2290 |
(shown not or:[cursorShown not]) ifTrue:[ |
|
3160 | 2291 |
^ aBlock value |
121 | 2292 |
]. |
2293 |
self hideCursor. |
|
2522
d80496af7eaf
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2506
diff
changeset
|
2294 |
aBlock ensure:[ |
3160 | 2295 |
self showCursor |
121 | 2296 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2297 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2298 |
|
2589 | 2299 |
!EditTextView methodsFor:'drag & drop'! |
2300 |
||
2301 |
allowDrop:aBoolean |
|
3236 | 2302 |
"enable/disable drop support" |
2303 |
||
2589 | 2304 |
aBoolean ifFalse:[ |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2305 |
dropTarget := nil. |
2589 | 2306 |
] ifTrue:[ |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2307 |
dropTarget isNil ifTrue:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2308 |
dropTarget := DropTarget |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2309 |
receiver:self |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2310 |
argument:nil |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2311 |
dropSelector:#'drop:' |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2312 |
canDropSelector:#'canDrop:' |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2313 |
] |
3236 | 2314 |
]. |
2315 |
! |
|
2316 |
||
3412 | 2317 |
canDrop:aDropContext |
2318 |
"public from d&d. |
|
2319 |
I accept textObjects and fileObjects only." |
|
2320 |
||
2321 |
aDropContext sourceWidget == self ifTrue:[^ false]. |
|
2322 |
^ self canDropObjects:aDropContext dropObjects |
|
2323 |
||
2324 |
"Modified: / 13-10-2006 / 17:41:09 / cg" |
|
2325 |
! |
|
2326 |
||
2327 |
canDropObjects:aCollectionOfDropObjects |
|
2328 |
"public from d&d. |
|
2329 |
I accept textObjects and fileObjects only." |
|
2589 | 2330 |
|
2331 |
self checkModificationsAllowed ifFalse:[^ false]. |
|
2332 |
||
3412 | 2333 |
aCollectionOfDropObjects isEmpty ifTrue:[ ^ false ]. |
2334 |
^ aCollectionOfDropObjects conform:[:obj| (obj isTextObject or:[obj isFileObject])] |
|
2335 |
||
2336 |
"Created: / 13-10-2006 / 15:56:57 / cg" |
|
2337 |
"Modified: / 13-10-2006 / 17:41:14 / cg" |
|
2338 |
! |
|
2339 |
||
2340 |
drop:aDropContext |
|
2341 |
"public from d&d. |
|
2342 |
drop objects (new API)" |
|
2343 |
||
2344 |
self dropObjects:(aDropContext dropObjects) |
|
2345 |
||
2346 |
"Modified: / 13-10-2006 / 17:41:19 / cg" |
|
2347 |
! |
|
2348 |
||
2349 |
dropFileObject:aDropObject |
|
2589 | 2350 |
"drop objects |
3236 | 2351 |
For bw. compatibility, also collections of drop objects are handled (may vanish)" |
2352 |
||
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2353 |
|answer text fn pasteWhat sensor dontAskAgainHolder enforcedDropMode| |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2354 |
|
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2355 |
pasteWhat := #name. |
3412 | 2356 |
|
2357 |
fn := aDropObject asFilename. |
|
2358 |
(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
|
2359 |
enforcedDropMode := UserPreferences current enforcedDropModeForFiles. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2360 |
(enforcedDropMode notNil |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2361 |
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
|
2362 |
pasteWhat := enforcedDropMode. |
3886 | 2363 |
] ifFalse:[ |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2364 |
sensor := self sensor. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2365 |
(sensor shiftDown or:[sensor ctrlDown]) ifTrue:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2366 |
pasteWhat := #name. |
3886 | 2367 |
] ifFalse:[ |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2368 |
(sensor metaDown) ifTrue:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2369 |
pasteWhat := #contents. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2370 |
] ifFalse:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2371 |
dontAskAgainHolder := false asValue. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2372 |
answer := Dialog |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2373 |
confirmWithCancel:(resources |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2374 |
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
|
2375 |
with:fn name allBold) |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2376 |
labels:#( 'Cancel' 'Name' 'Contents' ) |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2377 |
values:#( nil #name #contents ) |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2378 |
default:#contents |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2379 |
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
|
2380 |
title:(resources string:'Drop What'). |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2381 |
answer isNil ifTrue:[ ^ self ]. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2382 |
|
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2383 |
dontAskAgainHolder value ifTrue:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2384 |
UserPreferences current enforcedDropModeForFiles:#contents |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2385 |
]. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2386 |
pasteWhat := answer. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2387 |
] |
3886 | 2388 |
] |
2389 |
]. |
|
2390 |
]. |
|
2391 |
||
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2392 |
pasteWhat == #name ifTrue:[ |
3886 | 2393 |
text := fn pathName |
2394 |
] ifFalse:[ |
|
2395 |
self withWaitCursorDo:[ |
|
3799 | 2396 |
text := fn contentsOfEntireFile |
3886 | 2397 |
] |
2398 |
]. |
|
2399 |
||
3799 | 2400 |
self |
2401 |
undoablePaste:text |
|
2402 |
info:'Drop File'. |
|
3412 | 2403 |
|
2404 |
"Created: / 13-10-2006 / 17:38:31 / cg" |
|
3495 | 2405 |
"Modified: / 28-07-2007 / 13:27:09 / cg" |
3412 | 2406 |
! |
2407 |
||
2408 |
dropObject:aDropObject |
|
2409 |
"drop objects |
|
2410 |
For bw. compatibility, also collections of drop objects are handled (may vanish)" |
|
2411 |
||
3415 | 2412 |
|text| |
2413 |
||
3412 | 2414 |
(aDropObject isFileObject) ifTrue:[ |
3799 | 2415 |
self dropFileObject:aDropObject |
3412 | 2416 |
] ifFalse:[ |
3799 | 2417 |
aDropObject isTextObject ifTrue:[ |
2418 |
text := aDropObject theObject. |
|
2419 |
text isStringCollection ifTrue:[ |
|
2420 |
text := text asStringWithoutFinalCR |
|
2421 |
]. |
|
2422 |
] ifFalse:[ |
|
2423 |
text := aDropObject theObject asString |
|
2424 |
]. |
|
2425 |
self |
|
2426 |
undoablePaste:text |
|
2427 |
info:'Drop'. |
|
3412 | 2428 |
]. |
2429 |
||
2430 |
"Created: / 13-10-2006 / 17:37:05 / cg" |
|
3495 | 2431 |
"Modified: / 28-07-2007 / 13:26:53 / cg" |
3412 | 2432 |
! |
2433 |
||
2434 |
dropObjects:aCollectionOfDropObjects |
|
2435 |
"public from d&d. |
|
2436 |
drop objects (old API)" |
|
2437 |
||
3868 | 2438 |
aCollectionOfDropObjects do:[:el | |
2439 |
self dropObject:el |
|
3412 | 2440 |
]. |
2441 |
||
2442 |
"Created: / 13-10-2006 / 15:59:40 / cg" |
|
2443 |
"Modified: / 13-10-2006 / 17:41:23 / cg" |
|
2589 | 2444 |
! ! |
2445 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2446 |
!EditTextView methodsFor:'editing'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2447 |
|
313
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2448 |
copyAndDeleteSelection |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2449 |
"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
|
2450 |
|
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2451 |
selectionStartLine notNil ifTrue:[ |
3160 | 2452 |
self setClipboardText:(self selection). |
2453 |
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
|
2454 |
]. |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2455 |
|
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2456 |
"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
|
2457 |
! |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2458 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2459 |
deleteCharAtCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2460 |
"delete single character under cursor; does not merge lines" |
121 | 2461 |
|
2462 |
|wasOn| |
|
2463 |
||
2464 |
wasOn := self hideCursor. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2465 |
self deleteCharAtLine:cursorLine col:cursorCol. |
121 | 2466 |
wasOn ifTrue:[self showCursor] |
2467 |
! |
|
2468 |
||
827 | 2469 |
deleteCharAtLine:lineNr col:colNr |
2470 |
"delete a single character at colNr in line lineNr" |
|
2471 |
||
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2472 |
self st80EditMode ifTrue:[ |
3160 | 2473 |
(self listAt:cursorLine) size + 1 = colNr ifTrue:[ |
2474 |
| wasOn | |
|
2475 |
wasOn := self hideCursor. |
|
2476 |
self |
|
2477 |
cursorReturn; |
|
2478 |
cursorCol:1; |
|
2479 |
deleteCharBeforeCursor. |
|
2480 |
wasOn ifTrue:[ self showCursor]. |
|
2481 |
^ self. |
|
2482 |
]. |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2483 |
]. |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2484 |
|
827 | 2485 |
self deleteCharsAtLine:lineNr fromCol:colNr toCol:colNr |
2486 |
! |
|
2487 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2488 |
deleteCharBeforeCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2489 |
"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
|
2490 |
|
2491 | 2491 |
|soCol wasOn lineNrAboveCursor ln prevTab| |
121 | 2492 |
|
2493 |
wasOn := self hideCursor. |
|
2491 | 2494 |
autoIndent ifTrue:[ |
3160 | 2495 |
prevTab := (self prevTabBefore:cursorCol) max:1. |
2496 |
ln := (list at:cursorLine) ? ''. |
|
2497 |
ln size < prevTab ifTrue:[ |
|
2498 |
ln := ln , (String new:prevTab withAll:Character space). |
|
2499 |
]. |
|
2500 |
(ln copyTo:prevTab) isBlank ifTrue:[ |
|
2501 |
(ln copyFrom:prevTab+1) isBlank ifTrue:[ |
|
2502 |
cursorCol > prevTab ifTrue:[ |
|
2503 |
self cursorLine:cursorLine col:prevTab. |
|
2504 |
wasOn ifTrue:[ self showCursor ]. |
|
2505 |
^ self |
|
2506 |
]. |
|
2507 |
] ifFalse:[ |
|
2508 |
self deleteFromLine:cursorLine col:prevTab toLine:cursorLine col:cursorCol-1. |
|
2509 |
self cursorLine:cursorLine col:prevTab. |
|
2510 |
wasOn ifTrue:[ self showCursor ]. |
|
2511 |
^ self. |
|
2512 |
] |
|
2513 |
]. |
|
827 | 2514 |
]. |
2515 |
||
2491 | 2516 |
"/ (autoIndent |
2517 |
"/ and:[cursorCol ~~ 1 |
|
3160 | 2518 |
"/ and:[cursorLine <= (list size)]]) |
2491 | 2519 |
"/ ifTrue:[ |
2520 |
"/ soCol := (self leftIndentForLine:cursorLine) + 1. |
|
2521 |
"/ |
|
2522 |
"/ (cursorCol == soCol and:[soCol > 1]) ifTrue:[ |
|
2523 |
"/ ln := list at:cursorLine. |
|
2524 |
"/ (ln notNil and:[(ln indexOfNonSeparatorStartingAt:1) < soCol]) ifTrue:[ |
|
2525 |
"/ soCol := 1 |
|
2526 |
"/ ] |
|
2527 |
"/ ] |
|
2528 |
"/ ] ifFalse:[ |
|
3160 | 2529 |
soCol := 1. |
2491 | 2530 |
"/ ]. |
2531 |
||
1419 | 2532 |
(cursorCol ~~ soCol and:[cursorCol ~~ 1]) ifTrue:[ |
3160 | 2533 |
" |
2534 |
somewhere in the middle of a line |
|
2535 |
" |
|
2536 |
self cursorLeft. |
|
2537 |
self deleteCharAtLine:cursorLine col:cursorCol. |
|
1419 | 2538 |
] ifFalse:[ |
3160 | 2539 |
" |
2540 |
at begin of line - merge with previous line; |
|
2541 |
except for the very first line. |
|
2542 |
" |
|
2543 |
(cursorLine == 1) ifFalse:[ |
|
2544 |
lineNrAboveCursor := self validateCursorLine:(cursorLine - 1). |
|
2545 |
lineNrAboveCursor < cursorLine ifTrue:[ |
|
2546 |
(lineNrAboveCursor > 0 and:[lineNrAboveCursor > list size]) ifTrue:[ |
|
2547 |
"/ we are beyond the end of the text. |
|
2548 |
"/ move the cursor to the previous line. |
|
2549 |
self cursorLine:lineNrAboveCursor col:1. |
|
2550 |
] ifFalse:[ |
|
2551 |
self mergeLine:lineNrAboveCursor removeBlanks:false. |
|
2552 |
] |
|
2553 |
] |
|
2554 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2555 |
]. |
827 | 2556 |
wasOn ifTrue:[ self showCursor ] |
2557 |
||
1419 | 2558 |
"Modified: / 16.1.1998 / 22:33:04 / cg" |
827 | 2559 |
! |
2560 |
||
2561 |
deleteCharsAtLine:lineNr fromCol:colNr |
|
2562 |
"delete characters from colNr up to the end in line lineNr" |
|
2563 |
||
2564 |
|line| |
|
2565 |
||
2566 |
(line := self listAt:lineNr) notNil ifTrue:[ |
|
3160 | 2567 |
self deleteCharsAtLine:lineNr fromCol:colNr toCol:(line size) |
827 | 2568 |
] |
2569 |
||
2570 |
! |
|
2571 |
||
2572 |
deleteCharsAtLine:lineNr toCol:colNr |
|
2573 |
"delete characters from start up to colNr in line lineNr" |
|
2574 |
||
2575 |
self deleteCharsAtLine:lineNr fromCol:1 toCol:colNr |
|
2576 |
||
2577 |
||
121 | 2578 |
! |
2579 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2580 |
deleteCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2581 |
"delete the line where the cursor sits" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2582 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2583 |
self deleteLine:cursorLine |
121 | 2584 |
! |
2585 |
||
2385
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2586 |
deleteFromCharacterPosition:charPos1 to:charPos2 |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2587 |
"delete a substring at a character position" |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2588 |
|
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2589 |
|line1 col1 line2 col2| |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2590 |
|
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2591 |
line1 := self lineOfCharacterPosition:charPos1. |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2592 |
col1 := charPos1 - (self characterPositionOfLine:line1 col:1) + 1. |
2725
eccf283b2efb
deleteFromCharacterPos - fixed
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
2593 |
col1 == 0 ifTrue:[ |
3160 | 2594 |
line1 := line1 - 1. |
2595 |
col1 := (self listAt:line1) size + 1. |
|
2725
eccf283b2efb
deleteFromCharacterPos - fixed
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
2596 |
]. |
2385
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2597 |
|
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2598 |
line2 := self lineOfCharacterPosition:charPos2. |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2599 |
col2 := charPos2 - (self characterPositionOfLine:line2 col:1) + 1. |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2600 |
|
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2601 |
self deleteFromLine:line1 col:col1 toLine:line2 col:col2. |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2602 |
! |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2603 |
|
2954 | 2604 |
deleteFromLine:startLine col:startCol toLine:endLine col:endCol |
2605 |
"delete all text from startLine/startCol to endLine/endCol - |
|
2606 |
joining lines if nescessary" |
|
2607 |
||
2608 |
|line newLine lineSize nMore| |
|
2609 |
||
2610 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
2611 |
list isNil ifTrue:[^ self]. |
|
2612 |
startLine > list size ifTrue:[ ^ self]. "/ deleted space below text |
|
2613 |
||
2614 |
(startLine == endLine) ifTrue:[ |
|
3160 | 2615 |
"/ delete chars within a line |
2616 |
self deleteCharsAtLine:startLine fromCol:startCol toCol:endCol. |
|
2617 |
^ self |
|
2954 | 2618 |
]. |
2619 |
||
2620 |
((startCol == 1) and:[endCol == 0]) ifTrue:[ |
|
3160 | 2621 |
"/ delete full lines only |
2622 |
endLine > startLine ifTrue:[ |
|
2623 |
self deleteFromLine:startLine toLine:(endLine - 1) |
|
2624 |
]. |
|
2625 |
^ self |
|
2954 | 2626 |
]. |
2627 |
||
2628 |
"/ delete right rest of 1st line |
|
2629 |
self deleteCharsAtLine:startLine fromCol:startCol. |
|
2630 |
||
2631 |
"/ delete the inner lines ... |
|
2632 |
endLine > (startLine + 1) ifTrue:[ |
|
3160 | 2633 |
self deleteFromLine:(startLine + 1) toLine:(endLine - 1) |
2954 | 2634 |
]. |
2635 |
||
2636 |
(endCol ~~ 0) ifTrue:[ |
|
3160 | 2637 |
"/ delete the left rest of the last line |
2638 |
||
2639 |
self deleteCharsAtLine:(startLine + 1) toCol:endCol. |
|
2640 |
||
2641 |
"/ must add blanks, if startCol lies beyond end of startLine |
|
2642 |
||
2643 |
line := list at:startLine. |
|
2644 |
lineSize := line size. |
|
2645 |
(startCol > lineSize) ifTrue:[ |
|
2646 |
newLine := line. |
|
2647 |
line isNil ifTrue:[ |
|
2648 |
newLine := String new:(startCol - 1) |
|
2649 |
] ifFalse:[ |
|
2650 |
nMore := startCol - 1 - lineSize. |
|
2651 |
nMore > 0 ifTrue:[ |
|
2652 |
newLine := line , (line species new:nMore) |
|
2653 |
] |
|
2654 |
]. |
|
2655 |
newLine ~~ line ifTrue:[ |
|
2656 |
list at:startLine put:newLine. |
|
2657 |
]. |
|
2658 |
"/ TODO: remember old maxwidth of linerange, |
|
2659 |
"/ only clear widthOfWidestLine, if this max |
|
2660 |
"/ length was (one of) the longest. |
|
2661 |
"/ avoids slow delete with huge texts. |
|
2662 |
widthOfWidestLine := nil. "/ i.e. unknown |
|
2663 |
self textChanged. |
|
2664 |
] |
|
2954 | 2665 |
]. |
2666 |
||
2667 |
"/ merge the left rest of 1st line with right rest of last line into one |
|
2668 |
self mergeLine:startLine removeBlanks:false |
|
2669 |
||
2670 |
"Modified: / 10.11.1998 / 23:52:59 / cg" |
|
2671 |
! |
|
2672 |
||
827 | 2673 |
deleteLine:lineNr |
2674 |
"delete line" |
|
2675 |
||
2676 |
self deleteFromLine:lineNr toLine:lineNr |
|
2677 |
||
2678 |
||
2679 |
! |
|
2680 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2681 |
deleteLinesWithoutRedrawFrom:startLine to:endLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2682 |
"delete lines - no redraw; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2683 |
return true, if something was really deleted" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2684 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2685 |
|lastLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2686 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
2687 |
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
|
2688 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2689 |
(list isNil or:[startLine > list size]) ifTrue:[^ false]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2690 |
(endLine > list size) ifTrue:[ |
3160 | 2691 |
lastLine := list size |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2692 |
] ifFalse:[ |
3160 | 2693 |
lastLine := endLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2694 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2695 |
list removeFromIndex:startLine toIndex:lastLine. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2696 |
"/ TODO: remember old maxwidth of linerange, |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2697 |
"/ only clear widthOfWidestLine, if this max |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2698 |
"/ length was (one of) the longest. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2699 |
"/ avoids slow delete with huge texts. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2700 |
widthOfWidestLine := nil. "/ i.e. unknown |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2701 |
self textChanged. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2702 |
^ true |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2703 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2704 |
"Modified: / 10.11.1998 / 23:55:29 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2705 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2706 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2707 |
deleteSelection |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2708 |
"delete the selection" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2709 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2710 |
|wasOn startLine startCol endLine endCol| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2711 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
2712 |
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
|
2713 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2714 |
selectionStartLine notNil ifTrue:[ |
3160 | 2715 |
wasOn := self hideCursor. |
2716 |
||
2717 |
startLine := selectionStartLine. |
|
2718 |
startCol := selectionStartCol. |
|
2719 |
endLine := selectionEndLine. |
|
2720 |
endCol := selectionEndCol. |
|
2721 |
self unselectWithoutRedraw. |
|
2722 |
self deleteFromLine:startLine col:startCol toLine:endLine col:endCol. |
|
2723 |
self setCursorLine:startLine col:startCol. |
|
2724 |
||
2725 |
self makeCursorVisibleAndShowCursor:wasOn |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2726 |
] |
121 | 2727 |
! |
2728 |
||
2157
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2729 |
deleteWordBeforeCursor |
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2730 |
"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
|
2731 |
|
2952 | 2732 |
|wasOn beginCol beginLine endCol endLine| |
2157
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2733 |
|
3799 | 2734 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
2735 |
||
2157
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2736 |
wasOn := self hideCursor. |
3799 | 2737 |
self |
2738 |
undoableDo:[ |
|
2739 |
endCol := cursorCol-1. |
|
2740 |
endLine := cursorLine. |
|
2741 |
self cursorToPreviousWord. |
|
2742 |
beginCol := cursorCol. |
|
2743 |
beginLine := cursorLine. |
|
2744 |
self deleteFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
|
2745 |
] |
|
2746 |
info:'Delete Word'. |
|
2157
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2747 |
wasOn ifTrue:[ self showCursor ]. |
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2748 |
|
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2749 |
"Modified: / 22.2.2000 / 23:59:04 / cg" |
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2750 |
! |
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2751 |
|
121 | 2752 |
insertCharAtCursor:aCharacter |
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2753 |
"insert a single character at cursor-position - advance cursor." |
121 | 2754 |
|
2755 |
|wasOn| |
|
2756 |
||
2757 |
wasOn := self hideCursor. |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2758 |
aCharacter == Character tab ifTrue:[ |
3160 | 2759 |
"/ needs special care to advance cursor correctly |
2760 |
self insertTabAtCursor |
|
121 | 2761 |
] ifFalse:[ |
3160 | 2762 |
self insert:aCharacter atLine:cursorLine col:cursorCol. |
2763 |
aCharacter == (Character cr) ifTrue:[ |
|
2764 |
self cursorReturn |
|
2765 |
] ifFalse:[ |
|
2766 |
self cursorRight. |
|
2767 |
]. |
|
121 | 2768 |
]. |
2769 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2770 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2771 |
"Modified: / 12.6.1998 / 21:50:20 / cg" |
121 | 2772 |
! |
2773 |
||
641 | 2774 |
insertLine:aString before:lineNr |
2775 |
"insert the line aString before line lineNr" |
|
2776 |
||
2777 |
^ self insertLines:(Array with:aString) from:1 to:1 before:lineNr. |
|
2778 |
||
2779 |
"Modified: 14.5.1996 / 13:42:54 / cg" |
|
2780 |
! |
|
2781 |
||
155 | 2782 |
insertLines:aStringCollection before:lineNr |
2783 |
"insert a bunch before line lineNr" |
|
2784 |
||
2785 |
self insertLines:aStringCollection from:1 to:aStringCollection size before:lineNr |
|
2786 |
||
2787 |
"Modified: 6.9.1995 / 20:51:03 / claus" |
|
2788 |
! |
|
2789 |
||
654 | 2790 |
insertLines:lines withCR:withCr |
3160 | 2791 |
"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
|
2792 |
Cursor is moved behind insertion. |
641 | 2793 |
If withCr is true, append cr after last line" |
2794 |
||
2795 |
|start end nLines wasOn| |
|
2796 |
||
2797 |
lines notNil ifTrue:[ |
|
3160 | 2798 |
nLines := lines size. |
2799 |
(nLines == 1) ifTrue:[ |
|
2800 |
self insertStringAtCursor:(lines at:1). |
|
2801 |
withCr ifTrue:[ |
|
2802 |
self insertCharAtCursor:(Character cr) |
|
2803 |
] |
|
2804 |
] ifFalse:[ |
|
2805 |
(cursorCol ~~ 1) ifTrue:[ |
|
2806 |
self insertStringAtCursor:(lines at:1). |
|
2807 |
self insertCharAtCursor:(Character cr). |
|
2808 |
start := 2 |
|
2809 |
] ifFalse:[ |
|
2810 |
start := 1 |
|
2811 |
]. |
|
2812 |
withCr ifTrue:[ |
|
2813 |
end := nLines |
|
2814 |
] ifFalse:[ |
|
2815 |
end := nLines - 1 |
|
2816 |
]. |
|
2817 |
(start < nLines) ifTrue:[ |
|
2818 |
(end >= start) ifTrue:[ |
|
2819 |
wasOn := self hideCursor. |
|
2820 |
self insertLines:lines from:start to:end before:cursorLine. |
|
2821 |
self setCursorLine:(cursorLine + (end - start + 1)). |
|
2822 |
wasOn ifTrue:[self showCursor]. |
|
2823 |
] |
|
2824 |
]. |
|
2825 |
withCr ifFalse:[ |
|
2826 |
"last line without cr" |
|
2827 |
self insertStringAtCursor:(lines at:nLines) |
|
2828 |
] |
|
2829 |
] |
|
641 | 2830 |
] |
654 | 2831 |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2832 |
"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
|
2833 |
"Modified: / 12.6.1998 / 21:51:16 / cg" |
654 | 2834 |
! |
2835 |
||
2836 |
insertLines:lines withCr:withCr |
|
2837 |
"insert a bunch of lines at cursor position. Cursor |
|
2838 |
is moved behind insertion. |
|
2839 |
If withCr is true, append cr after last line" |
|
2840 |
||
2363 | 2841 |
<resource:#obsolete> |
2842 |
||
1292 | 2843 |
self obsoleteMethodWarning:'use #insertLines:withCR:'. |
2844 |
self insertLines:lines withCR:withCr. |
|
2845 |
||
2846 |
"Modified: 31.7.1997 / 23:07:22 / cg" |
|
641 | 2847 |
! |
2848 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2849 |
insertSelectedStringAtCursor:aString |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2850 |
"insert the argument, aString at cursor position and select it" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2851 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2852 |
|startLine startCol| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2853 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2854 |
startLine := cursorLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2855 |
startCol := cursorCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2856 |
self insertStringAtCursor:aString. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2857 |
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
|
2858 |
toLine:cursorLine col:(cursorCol - 1). |
3514
98e103cad51d
insertSelectedStringAtCursor: - make selection visible afterwards;
Michael Beyl <mb@exept.de>
parents:
3510
diff
changeset
|
2859 |
self makeSelectionVisible. |
259
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 |
|
1935
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2862 |
insertString:aString atCharacterPosition:charPos |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2863 |
"insert the argument, aString at a character position" |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2864 |
|
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2865 |
|line col| |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2866 |
|
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2867 |
line := self lineOfCharacterPosition:charPos. |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2868 |
col := charPos - (self characterPositionOfLine:line col:1) + 1. |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2869 |
self insertString:aString atLine:line col:col |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2870 |
! |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2871 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2872 |
insertString:aString atLine:lineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2873 |
"insert the string, aString at line/col; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2874 |
handle cr's correctly" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2875 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2876 |
|start "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2877 |
stop "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2878 |
end "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2879 |
subString c |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2880 |
l "{ Class: SmallInteger }" | |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2881 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2882 |
aString isNil ifTrue:[^ self]. |
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2883 |
(aString includes:(Character cr)) ifFalse:[ |
3160 | 2884 |
^ self insertStringWithoutCRs:aString atLine:lineNr col:colNr |
121 | 2885 |
]. |
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2886 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2887 |
l := lineNr. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2888 |
c := colNr. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2889 |
start := 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2890 |
end := aString size. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2891 |
[start <= end] whileTrue:[ |
3160 | 2892 |
stop := aString indexOf:(Character cr) startingAt:start. |
2893 |
stop == 0 ifTrue:[ |
|
2894 |
stop := end + 1 |
|
2895 |
]. |
|
2896 |
subString := aString copyFrom:start to:(stop - 1). |
|
2897 |
self insertStringWithoutCRs:subString atLine:l col:c. |
|
2898 |
(stop <= end) ifTrue:[ |
|
2899 |
c := c + subString size. |
|
2900 |
self insert:(Character cr) atLine:l col:c. |
|
2901 |
l := l + 1. |
|
2902 |
c := 1 |
|
2903 |
]. |
|
2904 |
start := stop + 1 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2905 |
] |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
2906 |
|
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2907 |
"Modified: / 10.6.1998 / 19:03:59 / cg" |
121 | 2908 |
! |
2909 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2910 |
insertStringAtCursor:aString |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2911 |
"insert the argument, aString at cursor position |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2912 |
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
|
2913 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2914 |
aString isNil ifTrue:[ |
3160 | 2915 |
"new:" |
2916 |
self insertCharAtCursor:(Character cr). |
|
2917 |
^ self |
|
105 | 2918 |
]. |
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2919 |
(aString includes:(Character cr)) ifFalse:[ |
3160 | 2920 |
^ self insertStringWithoutCRsAtCursor:aString |
105 | 2921 |
]. |
2922 |
||
654 | 2923 |
self insertLines:aString asStringCollection withCR:false. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2924 |
|
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2925 |
"Modified: / 10.6.1998 / 19:03:21 / cg" |
105 | 2926 |
! |
2927 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2928 |
insertStringWithoutCRs:aString atLine:lineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2929 |
"insert aString (which has no crs) at lineNr/colNr" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2930 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2931 |
self withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2932 |
shown ifTrue:[self redrawLine:lineNr from:colNr] |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
2933 |
|
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
2934 |
"Modified: / 5.4.1998 / 16:51:14 / cg" |
105 | 2935 |
! |
2936 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2937 |
insertStringWithoutCRsAtCursor:aString |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2938 |
"insert a string (which has no crs) at cursor position |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2939 |
- advance cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2940 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2941 |
|wasOn oldLen newLen deltaLen| |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2942 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2943 |
aString size > 0 ifTrue:[ |
3160 | 2944 |
wasOn := self hideCursor. |
2945 |
(aString includes:Character tab) ifTrue:[ |
|
2946 |
self checkForExistingLine:cursorLine. |
|
2947 |
oldLen := (list at:cursorLine) size. |
|
2948 |
self insertString:aString atLine:cursorLine col:cursorCol. |
|
2949 |
newLen := (list at:cursorLine) size. |
|
2950 |
deltaLen := newLen - oldLen. |
|
2951 |
] ifFalse:[ |
|
2952 |
self insertString:aString atLine:(cursorLine ? 1) col:cursorCol. |
|
2953 |
deltaLen := aString size. |
|
2954 |
]. |
|
2955 |
self setCursorCol:(cursorCol + deltaLen). |
|
2956 |
wasOn ifTrue:[self showCursor] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2957 |
] |
1563
b4eb49efdfcd
fixed cursor positioning if inserting a string with tabs.
Claus Gittinger <cg@exept.de>
parents:
1561
diff
changeset
|
2958 |
|
b4eb49efdfcd
fixed cursor positioning if inserting a string with tabs.
Claus Gittinger <cg@exept.de>
parents:
1561
diff
changeset
|
2959 |
"Modified: / 10.6.1998 / 20:43:52 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2960 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2961 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2962 |
insertTabAtCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2963 |
"insert spaces to next tab" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2964 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2965 |
|wasOn nextTab| |
105 | 2966 |
|
121 | 2967 |
wasOn := self hideCursor. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2968 |
nextTab := self nextTabAfter:cursorCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2969 |
self insertStringAtCursor:(String new:(nextTab - cursorCol)). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2970 |
self makeCursorVisibleAndShowCursor:wasOn. |
105 | 2971 |
! |
2972 |
||
3542 | 2973 |
joinLines |
3890 | 2974 |
"join lines (remove line-break)" |
2975 |
||
3583 | 2976 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
2977 |
||
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
2978 |
self |
3890 | 2979 |
undoableDo:[ |
2980 |
|line col lineLen| |
|
2981 |
||
2982 |
line := cursorLine. |
|
2983 |
col := cursorCol. |
|
2984 |
lineLen := (list at:line) size. |
|
2985 |
col > lineLen ifTrue:[ |
|
2986 |
self insertString:(String new:col-lineLen) atLine:line col:col+1. |
|
2987 |
] ifFalse:[ |
|
2988 |
self deleteCharsAtLine:line fromCol:col toCol:lineLen. |
|
2989 |
]. |
|
2990 |
self mergeLine:line removeBlanks:true. |
|
2991 |
self cursorLine:line col:col. |
|
2992 |
] |
|
2993 |
info:'Join' |
|
3542 | 2994 |
! |
2995 |
||
2952 | 2996 |
mergeLine:lineNr |
2997 |
"merge line lineNr with line lineNr+1" |
|
2998 |
||
2999 |
self mergeLine:lineNr removeBlanks:true |
|
3000 |
||
3001 |
"Modified: 9.9.1997 / 09:28:03 / cg" |
|
3002 |
! |
|
3003 |
||
2506 | 3004 |
parenthizeSelectionWith:openingCharacter and:closingCharacter |
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3005 |
|newSelectionEnd| |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3006 |
|
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3007 |
self hasSelection ifFalse:[^ self]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3008 |
|
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3009 |
newSelectionEnd := selectionEndCol. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3010 |
|
2506 | 3011 |
(self characterAtLine:selectionStartLine col:selectionStartCol) == openingCharacter ifTrue:[ |
3160 | 3012 |
(self characterAtLine:selectionEndLine col:selectionEndCol) == closingCharacter ifTrue:[ |
3013 |
self deleteCharAtLine:selectionEndLine col:selectionEndCol. |
|
3014 |
newSelectionEnd := newSelectionEnd-1. |
|
3015 |
]. |
|
3016 |
self deleteCharAtLine:selectionStartLine col:selectionStartCol. |
|
3017 |
selectionStartLine == selectionEndLine ifTrue:[ |
|
3018 |
newSelectionEnd := newSelectionEnd-1. |
|
3019 |
] |
|
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3020 |
] ifFalse:[ |
3160 | 3021 |
self insert:closingCharacter atLine:selectionEndLine col:selectionEndCol+1. |
3022 |
newSelectionEnd := newSelectionEnd+1. |
|
3023 |
self insert:openingCharacter atLine:selectionStartLine col:selectionStartCol. |
|
3024 |
selectionStartLine == selectionEndLine ifTrue:[ |
|
3025 |
newSelectionEnd := newSelectionEnd+1. |
|
3026 |
] |
|
3027 |
]. |
|
3028 |
self |
|
3029 |
selectFromLine:selectionStartLine col:selectionStartCol |
|
3030 |
toLine:selectionEndLine col:newSelectionEnd. |
|
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3031 |
! |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3032 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3033 |
removeTrailingBlankLines |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3034 |
"remove all blank lines at end of text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3035 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3036 |
|lastLine "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3037 |
line finished| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3038 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3039 |
lastLine := list size. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3040 |
finished := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3041 |
[finished] whileFalse:[ |
3160 | 3042 |
(lastLine <= 1) ifTrue:[ |
3043 |
finished := true |
|
3044 |
] ifFalse:[ |
|
3045 |
line := list at:lastLine. |
|
3046 |
line notNil ifTrue:[ |
|
3047 |
line isBlank ifTrue:[ |
|
3048 |
list at:lastLine put:nil. |
|
3049 |
line := nil |
|
3050 |
] |
|
3051 |
]. |
|
3052 |
line notNil ifTrue:[ |
|
3053 |
finished := true |
|
3054 |
] ifFalse:[ |
|
3055 |
lastLine := lastLine - 1 |
|
3056 |
] |
|
3057 |
] |
|
118 | 3058 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3059 |
(lastLine ~~ list size) ifTrue:[ |
3160 | 3060 |
list grow:lastLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3061 |
"/ self textChanged |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3062 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3063 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3064 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3065 |
replace:patternArg by:replacePatternArg all:all ignoreCase:ign |
3430 | 3066 |
|pattern replacePattern| |
3067 |
||
3068 |
pattern := patternArg string. |
|
3069 |
replacePattern := replacePatternArg string. |
|
3070 |
^ (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
|
3071 |
self rememberSearchPattern:pattern. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3072 |
self rememberSearchPattern:replacePattern. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3073 |
LastSearchIgnoredCase := ign. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3074 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3075 |
undoableDo:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3076 |
all ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3077 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3078 |
replaceString:pattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3079 |
to:replacePattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3080 |
ignoreCase:ign |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3081 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3082 |
(self selectionAsString notNil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3083 |
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
|
3084 |
ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3085 |
self replaceSelectionWith:replacePattern. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3086 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3087 |
search:pattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3088 |
ignoreCase:ign |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3089 |
forward:(lastSearchDirection = #forward). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3090 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3091 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3092 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3093 |
info:'Replace' |
3430 | 3094 |
] |
3095 |
||
3096 |
"Created: / 11-07-2006 / 11:19:57 / fm" |
|
3097 |
! |
|
3098 |
||
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3099 |
replaceCharAtCursor:aCharacter |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3100 |
"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
|
3101 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3102 |
|wasOn| |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3103 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3104 |
wasOn := self hideCursor. |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3105 |
aCharacter == (Character cr) ifTrue:[ |
3160 | 3106 |
self cursorReturn |
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3107 |
] ifFalse:[ |
3160 | 3108 |
self replace:aCharacter atLine:cursorLine col:cursorCol. |
3109 |
self cursorRight. |
|
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3110 |
]. |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3111 |
self makeCursorVisibleAndShowCursor:wasOn. |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3112 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3113 |
"Created: 6.3.1996 / 12:27:42 / cg" |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3114 |
! |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3115 |
|
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3116 |
replaceFromCharacterPosition:charPos1 to:charPos2 with:newString |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3117 |
"replace a substring at a character position" |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3118 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3119 |
self insertString:newString atCharacterPosition:charPos1. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3120 |
self deleteFromCharacterPosition:charPos1+newString size to:charPos2+newString size. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3121 |
! |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3122 |
|
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3123 |
replaceLines:lines withCR:withCr |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3124 |
"replace a bunch of lines at cursor position. Cursor |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3125 |
is moved behind replacement. |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3126 |
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
|
3127 |
after the last line" |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3128 |
|
1809 | 3129 |
|line col nLines wasOn| |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3130 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3131 |
lines notNil ifTrue:[ |
3160 | 3132 |
wasOn := self hideCursor. |
3133 |
nLines := lines size. |
|
3134 |
line := cursorLine. |
|
3135 |
col := cursorCol. |
|
3136 |
lines keysAndValuesDo:[:i :l | |
|
3137 |
self replaceString:l atLine:line col:col. |
|
3138 |
(i ~~ nLines or:[withCr]) ifTrue:[ |
|
3139 |
line := line + 1. |
|
3140 |
col := 1. |
|
3141 |
] ifFalse:[ |
|
3142 |
col := col + (l size). |
|
3143 |
] |
|
3144 |
]. |
|
3145 |
self cursorLine:line col:col. |
|
3146 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
3147 |
"/ wasOn ifTrue:[self showCursor]. |
|
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3148 |
] |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3149 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3150 |
"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
|
3151 |
"Modified: / 12.6.1998 / 22:05:51 / cg" |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3152 |
! |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3153 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3154 |
replaceSelectionBy:something |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3155 |
"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
|
3156 |
leave cursor after insertion" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3157 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3158 |
self replaceSelectionBy:something keepCursor:false |
105 | 3159 |
! |
3160 |
||
3161 |
replaceSelectionBy:something keepCursor:keep |
|
3162 |
"delete the selection (if any) and insert something, a character or string; |
|
3163 |
leave cursor after insertion or leave it, depending on keep" |
|
3164 |
||
3165 |
|sel l c| |
|
3166 |
||
3167 |
l := cursorLine. |
|
3168 |
c := cursorCol. |
|
3169 |
||
3170 |
sel := self selection. |
|
3171 |
sel notNil ifTrue:[ |
|
4010 | 3172 |
lastStringToReplace := sel. |
3173 |
lastStringFromReplace := lastStringToReplace. |
|
3174 |
self deleteSelection. |
|
3175 |
replacing := true. |
|
3176 |
lastReplacement := ''. |
|
3177 |
undoSupport actionInfo:'replace'. |
|
3161 | 3178 |
]. |
3179 |
||
3180 |
something isCharacter ifTrue:[ |
|
4010 | 3181 |
lastReplacement notNil ifTrue:[ |
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3182 |
"/ "XXX - replacing text with spaces ..." |
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3183 |
"/ (lastReplacement endsWith:Character space) ifTrue:[ |
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3184 |
"/ lastReplacement := lastReplacement copyWithoutLast:1 "copyTo:(lastReplacement size - 1)". |
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3185 |
"/ lastReplacement := lastReplacement copyWith:something. |
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3186 |
"/ lastReplacement := lastReplacement copyWith:Character space |
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3187 |
"/ ] ifFalse:[ |
4010 | 3188 |
lastReplacement := lastReplacement copyWith:something. |
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3189 |
"/ ] |
4010 | 3190 |
]. |
3191 |
self isInInsertMode ifTrue:[ |
|
3192 |
self insertCharAtCursor:something |
|
3193 |
] ifFalse:[ |
|
3194 |
self replaceCharAtCursor:something |
|
3195 |
] |
|
105 | 3196 |
] ifFalse:[ |
4010 | 3197 |
something isString ifTrue:[ |
3198 |
lastReplacement := something. |
|
3199 |
self isInInsertMode ifTrue:[ |
|
3200 |
self insertStringAtCursor:something |
|
3201 |
] ifFalse:[ |
|
3202 |
self replaceStringAtCursor:something |
|
3203 |
] |
|
3204 |
] ifFalse:[ |
|
3205 |
Transcript showCR:'EditTextView: non String-or-Character in replace'. |
|
3206 |
]. |
|
105 | 3207 |
]. |
3208 |
keep ifTrue:[ |
|
4010 | 3209 |
self cursorLine:l col:c |
105 | 3210 |
] |
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3211 |
|
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3212 |
"Modified: 9.10.1996 / 16:14:35 / cg" |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3213 |
! |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3214 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3215 |
replaceString:aString to:aNewString ignoreCase:ign |
3549 | 3216 |
|continue count| |
3217 |
||
3218 |
self cursorToTop. |
|
3219 |
self selectFromBeginning. |
|
3220 |
count := 0. |
|
3221 |
continue := true. |
|
3222 |
[ continue ] whileTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3223 |
(self selectionAsString notNil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3224 |
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
|
3225 |
ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3226 |
self replaceSelectionWith:aNewString. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3227 |
count := count + 1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3228 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3229 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3230 |
searchFwd:aString |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3231 |
ignoreCase:ign |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3232 |
ifAbsent:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3233 |
Dialog |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3234 |
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
|
3235 |
, count printString , ' times'. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3236 |
continue := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3237 |
]. |
3549 | 3238 |
]. |
3430 | 3239 |
|
3240 |
"Created: / 10-07-2006 / 16:42:48 / fm" |
|
3241 |
! |
|
3242 |
||
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3243 |
replaceStringAtCursor:aString |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3244 |
"replace multiple characters at cursor-position - advance cursor" |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3245 |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3246 |
|wasOn i1 i2| |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3247 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3248 |
wasOn := self hideCursor. |
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3249 |
(aString includes:Character tab) ifTrue:[ |
3160 | 3250 |
"/ need special care for TAB (to move cursor correctly) |
3251 |
i1 := 1. |
|
3252 |
[i1 ~~ 0] whileTrue:[ |
|
3253 |
i2 := aString indexOf:Character tab startingAt:i1. |
|
3254 |
i2 ~~ 0 ifTrue:[ |
|
3255 |
i1 ~~ i2 ifTrue:[ |
|
3256 |
self replaceString:(aString copyFrom:i1 to:i2-1) atLine:cursorLine col:cursorCol. |
|
3257 |
self cursorCol:(cursorCol + (i2 - i1)). |
|
3258 |
]. |
|
3259 |
self replaceTABAtCursor. |
|
3260 |
i2 := i2 + 1. |
|
3261 |
] ifFalse:[ |
|
3262 |
self replaceString:(aString copyFrom:i1) atLine:cursorLine col:cursorCol. |
|
3263 |
self cursorCol:(cursorCol + (aString size - i1 + 1)). |
|
3264 |
]. |
|
3265 |
i1 := i2. |
|
3266 |
] |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3267 |
] ifFalse:[ |
3160 | 3268 |
self replaceString:aString atLine:cursorLine col:cursorCol. |
3269 |
self cursorCol:(cursorCol + aString size). |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3270 |
]. |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3271 |
self makeCursorVisibleAndShowCursor:wasOn. |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3272 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3273 |
"Created: / 9.6.1998 / 20:33:20 / cg" |
1597
5fdcfcedb91c
fixed cursor positioning after replaceStringAtCursor.
Claus Gittinger <cg@exept.de>
parents:
1596
diff
changeset
|
3274 |
"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
|
3275 |
! |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3276 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3277 |
replaceTABAtCursor |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3278 |
"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
|
3279 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3280 |
|wasOn nextTab| |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3281 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3282 |
wasOn := self hideCursor. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3283 |
nextTab := self nextTabAfter:cursorCol. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3284 |
self replaceStringAtCursor:(String new:(nextTab - cursorCol)). |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3285 |
self makeCursorVisibleAndShowCursor:wasOn. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3286 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3287 |
"Created: / 12.6.1998 / 21:53:23 / cg" |
3890 | 3288 |
! |
3289 |
||
3290 |
wrapLines |
|
3291 |
"wrap lines (insert line-break)" |
|
3292 |
||
3293 |
|lineLength answerString string| |
|
3294 |
||
3295 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
3296 |
||
3297 |
self hasSelection ifFalse:[ |
|
3298 |
self selectLine:cursorLine. |
|
3299 |
]. |
|
3300 |
string := self selectionAsString. |
|
3301 |
string isEmptyOrNil ifTrue:[ |
|
3302 |
Dialog information:(resources string:'Nothing selected.'). |
|
3303 |
^ self. |
|
3304 |
]. |
|
3305 |
||
3306 |
answerString := Dialog request:(resources string:'Line length (wrap after how many chars)?') initialAnswer:80. |
|
3307 |
lineLength := Number readFrom:answerString onError:nil. |
|
3308 |
lineLength < 1 ifTrue:[ |
|
3309 |
lineLength := 1. |
|
3310 |
]. |
|
3311 |
||
3312 |
self |
|
3313 |
undoableDo:[ |
|
3314 |
|inStream line col lineLen lastGoodCol lastStartCol word| |
|
3315 |
||
3316 |
line := selectionStartLine. |
|
3317 |
col := selectionStartCol. |
|
3318 |
||
3319 |
self cutSelection. |
|
3320 |
self cursorLine:line col:col. |
|
3321 |
||
3322 |
lastGoodCol := col. |
|
3323 |
||
3324 |
inStream := string readStream. |
|
3325 |
[ inStream atEnd ] whileFalse:[ |
|
3326 |
[inStream atEnd not and:[inStream peek isSeparator]] whileTrue:[ inStream next ]. |
|
3327 |
word := WriteStream on:(String new:10). |
|
3328 |
[inStream atEnd not and:[inStream peek isSeparator not]] whileTrue:[ word nextPut:inStream next ]. |
|
3329 |
(col + 1 + word size > lineLength) ifTrue:[ |
|
3330 |
self insertCharAtCursor:(Character cr). |
|
3331 |
col := 1. |
|
3332 |
] ifFalse:[ |
|
3333 |
col ~~ 1 ifTrue:[ |
|
3334 |
self insertStringAtCursor:' '. |
|
3335 |
col := col + 1. |
|
3336 |
] |
|
3337 |
]. |
|
3338 |
self insertStringAtCursor:word contents. |
|
3339 |
col := col + word size. |
|
3340 |
]. |
|
3341 |
] |
|
3342 |
info:'Wrap' |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3343 |
! ! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3344 |
|
2752 | 3345 |
!EditTextView methodsFor:'editing-basic'! |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3346 |
|
2952 | 3347 |
basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol |
3549 | 3348 |
"delete characters from startCol to endCol in line lineNr" |
3349 |
||
1803
ac7cc1b99407
scroll left as required, if deleting characters of the longest line,
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
3350 |
|line lineSize newLine start stop prevWidth newWidth| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3351 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3352 |
line := self listAt:lineNr. |
827 | 3353 |
|
3160 | 3354 |
(self checkModificationsAllowed and:[line notNil]) ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3355 |
lineSize := line size. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3356 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3357 |
startCol == 0 ifFalse:[ start := startCol ] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3358 |
ifTrue:[ start := 1 ]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3359 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3360 |
endCol > lineSize ifFalse:[ stop := endCol ] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3361 |
ifTrue:[ stop := lineSize ]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3362 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3363 |
stop >= start ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3364 |
start ~~ 1 ifTrue:[ newLine := line copyFrom:1 to:(start-1) ] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3365 |
ifFalse:[ newLine := '' ]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3366 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3367 |
stop == lineSize ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3368 |
line bitsPerCharacter > newLine bitsPerCharacter ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3369 |
newLine := line string species fromString:newLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3370 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3371 |
newLine := newLine, (line copyFrom:(stop + 1) to:lineSize) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3372 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3373 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3374 |
(trimBlankLines and:[newLine isBlank]) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3375 |
newLine := nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3376 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3377 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3378 |
prevWidth := self widthOfLine:lineNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3379 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3380 |
list at:lineNr put:newLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3381 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3382 |
(prevWidth = widthOfWidestLine) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3383 |
"/ remember old width of this line, |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3384 |
"/ only clear widthOfWidestLine, if this lines |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3385 |
"/ length was (one of) the longest. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3386 |
"/ avoids slow delete with huge texts. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3387 |
widthOfWidestLine := nil. "i.e. unknown" |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3388 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3389 |
"/ scroll left if reqiured |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3390 |
viewOrigin x > 0 ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3391 |
newWidth := self widthOfLine:lineNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3392 |
newWidth < (viewOrigin x + width) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3393 |
self scrollHorizontalTo:(newWidth |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3394 |
- width |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3395 |
+ margin + margin |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3396 |
+ (font widthOf:' ')) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3397 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3398 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3399 |
self textChanged. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3400 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3401 |
self textChanged "/ textChangedButNoSizeChange |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3402 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3403 |
self redrawLine:lineNr from:start. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3404 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3405 |
] |
827 | 3406 |
] |
3407 |
||
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3408 |
"Modified: / 11.11.1998 / 00:01:09 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3409 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3410 |
|
2952 | 3411 |
basicDeleteFromLine:startLineNr toLine:endLineNr |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3412 |
"delete some lines" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3413 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3414 |
|wasOn nLines| |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3415 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3416 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3417 |
list isNil ifTrue:[^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3418 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3419 |
wasOn := self hideCursor. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3420 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3421 |
"/ isnt this the same as: |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3422 |
"/ self deleteLinesWithoutRedrawFrom:startLineNr to:endLineNr. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3423 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3424 |
list removeFromIndex:startLineNr toIndex:(endLineNr min:list size). |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3425 |
"/ TODO: remember old maxwidth of linerange, |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3426 |
"/ only clear widthOfWidestLine, if this max |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3427 |
"/ length was (one of) the longest. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3428 |
"/ avoids slow delete with huge texts. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3429 |
widthOfWidestLine := nil. "/ i.e. unknown |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3430 |
self textChanged. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3431 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3432 |
self redrawFromLine:startLineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3433 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3434 |
nLines := list size. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3435 |
(firstLineShown >= nLines) ifTrue:[ |
3160 | 3436 |
self makeLineVisible:nLines |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3437 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3438 |
wasOn ifTrue:[self showCursor]. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3439 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3440 |
"Modified: / 10.11.1998 / 23:55:05 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3441 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3442 |
|
2952 | 3443 |
basicDeleteLineWithoutRedraw:lineNr |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3444 |
"delete line - no redraw; |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3445 |
return true, if something was really deleted" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3446 |
|
2952 | 3447 |
self checkModificationsAllowed ifFalse:[ ^ false]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3448 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3449 |
(list isNil or:[lineNr > list size]) ifTrue:[^ false]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3450 |
list removeIndex:lineNr. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3451 |
"/ TODO: remember old maxwidth of linerange, |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3452 |
"/ only clear widthOfWidestLine, if this max |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3453 |
"/ length was (one of) the longest. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3454 |
"/ avoids slow delete with huge texts. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3455 |
widthOfWidestLine := nil. "/ i.e. unknown |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3456 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3457 |
^ true |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3458 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3459 |
"Modified: / 10.11.1998 / 23:53:24 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3460 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3461 |
|
2952 | 3462 |
basicInsert:aCharacter atLine:lineNr col:colNr |
3160 | 3463 |
"insert a single character at lineNr/colNr; |
827 | 3464 |
set emphasis to character at current position" |
3465 |
||
1929
8e70fb7c9701
fixed handling of italic text when inserting
Claus Gittinger <cg@exept.de>
parents:
1928
diff
changeset
|
3466 |
|line lineSize newLine drawCharacterOnly attribute oldClip x y| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3467 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3468 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3469 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3470 |
aCharacter == (Character cr) ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3471 |
self splitLine:lineNr before:colNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3472 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3473 |
]. |
827 | 3474 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3475 |
drawCharacterOnly := false. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3476 |
self checkForExistingLine:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3477 |
line := list at:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3478 |
lineSize := line size. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3479 |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
3480 |
self st80EditMode ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3481 |
(trimBlankLines |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3482 |
and:[colNr > lineSize |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3483 |
and:[aCharacter == Character space]]) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3484 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3485 |
] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3486 |
]. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3487 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3488 |
(lineSize == 0) ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3489 |
newLine := aCharacter asString species new:colNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3490 |
drawCharacterOnly := true |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3491 |
] ifFalse: [ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3492 |
(colNr > lineSize) ifTrue: [ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3493 |
colNr == (lineSize +1) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3494 |
attribute := line emphasisAt:lineSize |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3495 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3496 |
newLine := line species new:colNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3497 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3498 |
drawCharacterOnly := true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3499 |
] ifFalse: [ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3500 |
attribute := line emphasisAt:colNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3501 |
newLine := line species new:(lineSize + 1). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3502 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3503 |
newLine replaceFrom:1 to:(colNr - 1) with:line startingAt:1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3504 |
newLine replaceFrom:(colNr + 1) to:(lineSize + 1) with:line startingAt:colNr |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3505 |
] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3506 |
]. |
827 | 3507 |
|
2869
48d830f0aea5
insertCharacter: care for wide chars
Claus Gittinger <cg@exept.de>
parents:
2866
diff
changeset
|
3508 |
aCharacter asString bitsPerCharacter > newLine bitsPerCharacter ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3509 |
newLine := aCharacter asString species fromString:newLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3510 |
line isText ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3511 |
newLine := newLine asText |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3512 |
] |
2869
48d830f0aea5
insertCharacter: care for wide chars
Claus Gittinger <cg@exept.de>
parents:
2866
diff
changeset
|
3513 |
]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3514 |
newLine at:colNr put:aCharacter. |
827 | 3515 |
|
3516 |
attribute notNil ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3517 |
newLine emphasisAt:colNr put:attribute. |
827 | 3518 |
]. |
3519 |
||
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3520 |
aCharacter == (Character tab) ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3521 |
newLine := self withTabsExpanded:newLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3522 |
drawCharacterOnly := false |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3523 |
]. |
827 | 3524 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3525 |
list at:lineNr put:newLine. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3526 |
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
|
3527 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3528 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3529 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3530 |
shown ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3531 |
"/ care for italic text - in this case, we must also |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3532 |
"/ redraw the character before the insertion in order |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3533 |
"/ to fix the slanted piece of the character. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3534 |
"/ (but we must clip, to avoid destoying the character before) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3535 |
(newLine notNil and:[newLine isText]) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3536 |
colNr > 1 ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3537 |
cursorVisibleLine notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3538 |
oldClip := self clippingRectangleOrNil. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3539 |
x := (self xOfCol:colNr-1 inVisibleLine:cursorVisibleLine) - viewOrigin x. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3540 |
y := self yOfVisibleLine:cursorVisibleLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3541 |
drawCharacterOnly ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3542 |
self clippingRectangle:(x@y extent:((font width * 2) @ fontHeight)). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3543 |
self redrawLine:lineNr from:colNr-1 to:colNr |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3544 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3545 |
self clippingRectangle:(x@y extent:((width - x) @ fontHeight)). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3546 |
self redrawLine:lineNr from:colNr-1 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3547 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3548 |
self clippingRectangle:oldClip. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3549 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3550 |
^ self. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3551 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3552 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3553 |
drawCharacterOnly ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3554 |
self redrawLine:lineNr col:colNr |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3555 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3556 |
self redrawLine:lineNr from:colNr |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3557 |
] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3558 |
] |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3559 |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
3560 |
"Modified: / 20.6.1998 / 18:19:22 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3561 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3562 |
|
2952 | 3563 |
basicMergeLine:lineNr removeBlanks:removeBlanks |
1319 | 3564 |
"merge line lineNr with line lineNr+1" |
3565 |
||
827 | 3566 |
|leftPart rightPart bothParts nextLineNr i| |
3567 |
||
2356
6416beb0f23a
backSpace if behond end of text.
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3568 |
(list notNil and:[(list size) >= lineNr]) ifFalse:[ |
3160 | 3569 |
"/ empty list or beyond end of text |
3570 |
^ self |
|
827 | 3571 |
]. |
3572 |
leftPart := self listAt:lineNr. |
|
3573 |
||
3574 |
leftPart isNil ifTrue:[ |
|
3160 | 3575 |
leftPart := ''. |
3576 |
autoIndent ifTrue:[ |
|
3577 |
(i := self leftIndentForLine:cursorLine) == 0 ifFalse:[ |
|
3578 |
leftPart := String new:i |
|
3579 |
] |
|
3580 |
] |
|
827 | 3581 |
]. |
3582 |
self cursorLine:lineNr col:((leftPart size) + 1). |
|
3583 |
nextLineNr := self validateCursorLine:(lineNr + 1). |
|
3584 |
||
3585 |
nextLineNr > (list size) ifFalse:[ |
|
3160 | 3586 |
(rightPart := self listAt:nextLineNr) isNil ifTrue:[ |
3587 |
rightPart := '' |
|
3588 |
] ifFalse:[ |
|
3589 |
removeBlanks ifTrue:[ |
|
3590 |
rightPart := rightPart withoutLeadingSeparators. |
|
3591 |
] |
|
3592 |
]. |
|
3593 |
||
3594 |
bothParts := leftPart , rightPart. |
|
3595 |
(trimBlankLines and:[bothParts isBlank]) ifTrue:[bothParts := nil]. |
|
3596 |
list at:lineNr put:bothParts. |
|
3597 |
self redrawLine:lineNr. |
|
3598 |
self deleteLine:nextLineNr |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3599 |
] |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3600 |
|
1319 | 3601 |
"Created: 9.9.1997 / 09:27:38 / cg" |
3602 |
"Modified: 9.9.1997 / 09:28:27 / cg" |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3603 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3604 |
|
2952 | 3605 |
basicReplace:aCharacter atLine:lineNr col:colNr |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3606 |
"replace a single character at lineNr/colNr" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3607 |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3608 |
|line lineSize newLine drawCharacterOnly| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3609 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3610 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3611 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3612 |
aCharacter == (Character cr) ifTrue:[ |
3160 | 3613 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3614 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3615 |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3616 |
drawCharacterOnly := true. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3617 |
self checkForExistingLine:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3618 |
line := list at:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3619 |
lineSize := line size. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3620 |
|
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3621 |
(trimBlankLines |
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3622 |
and:[colNr > lineSize |
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3623 |
and:[aCharacter == Character space]]) ifTrue:[ |
3160 | 3624 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3625 |
]. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3626 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3627 |
(lineSize == 0) ifTrue:[ |
3160 | 3628 |
newLine := aCharacter asString species new:colNr. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3629 |
] ifFalse: [ |
3160 | 3630 |
(colNr > lineSize) ifTrue: [ |
3631 |
newLine := line species new:colNr. |
|
3632 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
|
3633 |
] ifFalse: [ |
|
3634 |
newLine := line copy. |
|
3635 |
] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3636 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3637 |
newLine at:colNr put:aCharacter. |
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3638 |
aCharacter == (Character tab) ifTrue:[ |
3160 | 3639 |
newLine := self withTabsExpanded:newLine. |
3640 |
drawCharacterOnly := false |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3641 |
]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3642 |
list at:lineNr put:newLine. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3643 |
widthOfWidestLine notNil ifTrue:[ |
3160 | 3644 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3645 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3646 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3647 |
shown ifTrue:[ |
3160 | 3648 |
drawCharacterOnly ifTrue:[ |
3649 |
self redrawLine:lineNr col:colNr |
|
3650 |
] ifFalse:[ |
|
3651 |
self redrawLine:lineNr from:colNr |
|
3652 |
] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3653 |
] |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3654 |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3655 |
"Created: / 6.3.1996 / 12:29:20 / cg" |
1559
cecf77805bff
expand tabs in #replaceAll:...
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
3656 |
"Modified: / 10.6.1998 / 18:50:18 / cg" |
105 | 3657 |
! |
3658 |
||
3235 | 3659 |
basicReplaceString:aString atLine:lineNr col:colNr |
3660 |
"replace multiple characters starting at lineNr/colNr. |
|
3661 |
This is not prepared to encounter special chars (except TAB) |
|
3662 |
in the string." |
|
3663 |
||
3664 |
|line lineSize newLine endCol| |
|
3665 |
||
3666 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
3667 |
||
3668 |
self checkForExistingLine:lineNr. |
|
3669 |
line := list at:lineNr. |
|
3670 |
lineSize := line size. |
|
3671 |
||
3672 |
endCol := colNr + aString size - 1. |
|
3673 |
(lineSize == 0) ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3674 |
newLine := aString species new:endCol. |
3235 | 3675 |
] ifFalse: [ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3676 |
(endCol > lineSize) ifTrue: [ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3677 |
aString isText ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3678 |
newLine := aString species new:endCol. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3679 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3680 |
newLine := line species new:endCol. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3681 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3682 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3683 |
] ifFalse: [ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3684 |
aString isText ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3685 |
newLine := aString species new:line size. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3686 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3687 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3688 |
newLine := line copy. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3689 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3690 |
] |
3235 | 3691 |
]. |
3692 |
newLine replaceFrom:colNr with:aString. |
|
3693 |
(aString includes:(Character tab)) ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3694 |
newLine := self withTabsExpanded:newLine. |
3235 | 3695 |
]. |
3696 |
list at:lineNr put:newLine. |
|
3697 |
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
|
3698 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
3235 | 3699 |
]. |
3700 |
self textChanged. |
|
3701 |
shown ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3702 |
self redrawLine:lineNr from:colNr |
3235 | 3703 |
] |
3704 |
||
3705 |
"Created: / 11.6.1998 / 10:38:32 / cg" |
|
3706 |
"Modified: / 20.6.1998 / 20:23:50 / cg" |
|
3707 |
! |
|
3708 |
||
2952 | 3709 |
basicSplitLine:lineNr before:colNr |
3710 |
"split the line linNr before colNr; the right part (from colNr) |
|
3711 |
is cut off and inserted after lineNr; the view is redrawn" |
|
3712 |
||
3160 | 3713 |
|line lineSize leftRest rightRest visLine w h mustWait |
2952 | 3714 |
srcY "{ Class: SmallInteger }" | |
3715 |
||
3027 | 3716 |
list isNil ifTrue:[ ^ self ]. |
3717 |
lineNr > (list size) ifTrue:[ ^ self ]. |
|
3718 |
||
3719 |
(colNr == 1) ifTrue:[ |
|
3160 | 3720 |
self nonUndoableDo:[ |
3721 |
self insertLine:nil before:lineNr. |
|
3722 |
]. |
|
3723 |
^ self |
|
3027 | 3724 |
]. |
3725 |
||
3726 |
line := list at:lineNr. |
|
3727 |
line isNil ifFalse:[ |
|
3160 | 3728 |
lineSize := line size. |
3729 |
(colNr <= lineSize) ifTrue:[ |
|
3730 |
rightRest := line copyFrom:colNr to:lineSize. |
|
3731 |
(colNr > 1) ifTrue:[ |
|
3732 |
leftRest := line copyTo:(colNr - 1) |
|
3733 |
] |
|
3734 |
] ifFalse:[ |
|
3735 |
leftRest := line |
|
3736 |
] |
|
3027 | 3737 |
]. |
3738 |
leftRest notNil ifTrue:[ |
|
3160 | 3739 |
(trimBlankLines and:[leftRest isBlank]) ifTrue:[leftRest := nil] |
3027 | 3740 |
]. |
3741 |
list at:lineNr put:leftRest. |
|
3742 |
self nonUndoableDo:[ |
|
3160 | 3743 |
self withoutRedrawInsertLine:rightRest before:(lineNr + 1). |
3027 | 3744 |
]. |
3745 |
visLine := self listLineToVisibleLine:(lineNr). |
|
3746 |
visLine notNil ifTrue:[ |
|
3160 | 3747 |
w := self widthForScrollBetween:lineNr |
3748 |
and:(firstLineShown + nLinesShown). |
|
3749 |
srcY := topMargin + (visLine * fontHeight). |
|
3750 |
h := ((nLinesShown - visLine - 1) * fontHeight). |
|
3751 |
(mustWait := (w > 0 and:[h > 0])) ifTrue:[ |
|
3752 |
self catchExpose. |
|
3753 |
self |
|
3754 |
copyFrom:self |
|
3755 |
x:textStartLeft y:srcY |
|
3756 |
toX:textStartLeft y:(srcY + fontHeight) |
|
3757 |
width:w |
|
3758 |
height:((nLinesShown - visLine - 1) * fontHeight) |
|
3759 |
async:true. |
|
3760 |
]. |
|
3761 |
self redrawLine:lineNr. |
|
3762 |
self redrawLine:(lineNr + 1). |
|
3763 |
mustWait ifTrue:[self waitForExpose] |
|
3027 | 3764 |
]. |
3765 |
widthOfWidestLine := nil. "/ unknown |
|
3766 |
self textChanged. |
|
2952 | 3767 |
|
3768 |
"Modified: 29.1.1997 / 13:03:22 / cg" |
|
3769 |
! |
|
3770 |
||
3771 |
basicWithoutRedrawInsertLine:aString before:lineNr |
|
3772 |
"insert the argument, aString before line lineNr; the string |
|
3773 |
becomes line nileNr; everything else is moved down; the view |
|
3774 |
is not redrawn" |
|
3775 |
||
3776 |
|line| |
|
3777 |
||
3778 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
3779 |
||
3780 |
line := aString. |
|
3781 |
line notNil ifTrue:[ |
|
3160 | 3782 |
line isString ifTrue:[ |
3783 |
line isBlank ifTrue:[ |
|
3784 |
line := nil |
|
3785 |
] ifFalse:[ |
|
3786 |
(line includes:(Character tab)) ifTrue:[ |
|
3787 |
line := self withTabsExpanded:line |
|
3788 |
] |
|
3789 |
] |
|
3790 |
] |
|
2952 | 3791 |
]. |
3792 |
list isNil ifTrue: [ |
|
3160 | 3793 |
list := StringCollection new:lineNr |
2952 | 3794 |
] ifFalse: [ |
3160 | 3795 |
list grow:((list size + 1) max:lineNr) |
3796 |
]. |
|
3797 |
||
3798 |
"I have changed 'replaceFrom:to:with:startingAt:' to correctly handle |
|
2952 | 3799 |
overlapping copy - if it didn't, we had to use:" |
3800 |
" |
|
3801 |
index := list size. |
|
3802 |
[index > lineNr] whileTrue: [ |
|
3160 | 3803 |
pIndex := index - 1. |
3804 |
list at:index put:(list at:pIndex). |
|
3805 |
index := pIndex |
|
2952 | 3806 |
]. |
3807 |
" |
|
3808 |
list replaceFrom:(lineNr + 1) to:(list size) with:list startingAt:lineNr. |
|
3809 |
list at:lineNr put:line. |
|
3810 |
self contentsChanged |
|
3811 |
||
3812 |
"Modified: / 10.6.1998 / 19:00:56 / cg" |
|
3813 |
! |
|
3814 |
||
2954 | 3815 |
basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr |
3816 |
"insert a bunch of lines before line lineNr; the view is not redrawn" |
|
3817 |
||
3818 |
|newLine newLines nLines| |
|
3819 |
||
3820 |
nLines := end - start + 1. |
|
3821 |
newLines := Array new:(lines size). |
|
3822 |
start to:end do:[:index | |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3823 |
newLine := lines at:index. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3824 |
newLine notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3825 |
newLine isString ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3826 |
newLine isBlank ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3827 |
newLine := nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3828 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3829 |
(newLine includes:(Character tab)) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3830 |
newLine := self withTabsExpanded:newLine |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3831 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3832 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3833 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3834 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3835 |
newLines at:index put:newLine |
2954 | 3836 |
]. |
3837 |
list isNil ifTrue: [ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3838 |
list := StringCollection new:(lineNr + nLines + 1) |
2954 | 3839 |
] ifFalse: [ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3840 |
list grow:((list size + nLines) max:(lineNr + nLines - 1)) |
3160 | 3841 |
]. |
3842 |
||
3843 |
"I have changed 'replaceFrom:to:with:startingAt:' to correctly handle |
|
2954 | 3844 |
overlapping copy - if it didn't, we had to use:" |
3845 |
" |
|
3846 |
index := list size. |
|
3847 |
[index > lineNr] whileTrue: [ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3848 |
pIndex := index - 1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3849 |
list at:index put:(list at:pIndex). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3850 |
index := pIndex |
2954 | 3851 |
]. |
3852 |
" |
|
3853 |
list replaceFrom:(lineNr + nLines) to:(list size) with:list startingAt:lineNr. |
|
3854 |
list replaceFrom:lineNr to:(lineNr + nLines - 1) with:newLines startingAt:start. |
|
3855 |
self contentsChanged |
|
3856 |
||
3857 |
"Modified: / 10.6.1998 / 19:01:16 / cg" |
|
3858 |
! |
|
3859 |
||
3860 |
basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr |
|
3861 |
"insert aString (which has no crs) at lineNr/colNr" |
|
3862 |
||
3863 |
|isText strLen line lineSize newLine stringType sz| |
|
3864 |
||
3865 |
(aString notNil) ifFalse:[ ^ self]. |
|
3866 |
||
3867 |
strLen := aString size. |
|
3868 |
self checkForExistingLine:lineNr. |
|
3869 |
||
3870 |
stringType := aString string species. |
|
3871 |
isText := aString isText. |
|
3872 |
line := list at:lineNr. |
|
3873 |
||
3874 |
line notNil ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3875 |
lineSize := line size. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3876 |
line isString ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3877 |
stringType := line species |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3878 |
] ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3879 |
line bitsPerCharacter > aString bitsPerCharacter ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3880 |
stringType := line string species |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3881 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3882 |
line isText ifTrue:[ isText := true ] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3883 |
]. |
2954 | 3884 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3885 |
lineSize := 0 |
2954 | 3886 |
]. |
3887 |
||
3888 |
((colNr == 1) and:[lineSize == 0]) ifTrue: [ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3889 |
newLine := aString |
2954 | 3890 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3891 |
(lineSize == 0 or:[colNr > lineSize]) ifTrue: [ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3892 |
sz := colNr + strLen - 1 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3893 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3894 |
sz := lineSize + strLen |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3895 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3896 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3897 |
isText ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3898 |
newLine := stringType new:sz |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3899 |
] ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3900 |
newLine := Text string:(stringType new:sz) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3901 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3902 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3903 |
(lineSize ~~ 0) ifTrue: [ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3904 |
(colNr > lineSize) ifTrue: [ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3905 |
newLine replaceFrom:1 to:lineSize |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3906 |
with:line startingAt:1 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3907 |
] ifFalse: [ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3908 |
newLine replaceFrom:1 to:(colNr - 1) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3909 |
with:line startingAt:1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3910 |
newLine replaceFrom:(colNr + strLen) to:(lineSize + strLen) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3911 |
with:line startingAt:colNr |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3912 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3913 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3914 |
newLine replaceFrom:(colNr max:1) to:(colNr + strLen - 1) with:aString startingAt:1 |
2954 | 3915 |
]. |
3916 |
||
3917 |
(aString includes:(Character tab)) ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3918 |
newLine := self withTabsExpanded:newLine |
2954 | 3919 |
]. |
3920 |
||
3921 |
list at:lineNr put:newLine. |
|
3922 |
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
|
3923 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:newLine). |
2954 | 3924 |
]. |
3925 |
self textChanged. |
|
3926 |
||
3927 |
"Modified: / 10.6.1998 / 19:01:52 / cg" |
|
3928 |
! |
|
3929 |
||
2952 | 3930 |
deleteCharsAtLine:lineNr fromCol:startCol toCol:endCol |
3549 | 3931 |
"delete characters from startCol to endCol in line lineNr" |
3932 |
||
2952 | 3933 |
|deleted| |
3934 |
||
3935 |
deleted := self textFromLine:lineNr col:startCol toLine:lineNr col:endCol. |
|
3936 |
self basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol. |
|
3115 | 3937 |
self addUndo:(PasteString line:lineNr col:startCol string:deleted info:'delete'). |
2952 | 3938 |
! |
3939 |
||
3940 |
deleteFromLine:startLineNr toLine:endLineNr |
|
3941 |
"delete some lines" |
|
3942 |
||
3943 |
|deleted| |
|
3944 |
||
3945 |
deleted := self textFromLine:startLineNr col:1 toLine:endLineNr+1 col:0. |
|
3946 |
self basicDeleteFromLine:startLineNr toLine:endLineNr. |
|
3115 | 3947 |
self addUndo:(PasteString line:startLineNr col:1 string:deleted info:'delete'). |
2952 | 3948 |
! |
3949 |
||
3950 |
deleteLineWithoutRedraw:lineNr |
|
3951 |
"delete line - no redraw; |
|
3952 |
return true, if something was really deleted" |
|
3953 |
||
3954 |
|deleted ret| |
|
3955 |
||
3956 |
deleted := self textFromLine:lineNr col:1 toLine:lineNr+1 col:0. |
|
3957 |
ret := self basicDeleteLineWithoutRedraw:lineNr. |
|
3115 | 3958 |
self addUndo:(PasteString line:lineNr col:1 string:deleted info:'delete'). |
2952 | 3959 |
^ ret. |
3960 |
! |
|
3961 |
||
3962 |
insert:aCharacter atLine:lineNr col:colNr |
|
3160 | 3963 |
"insert a single character at lineNr/colNr; |
2952 | 3964 |
set emphasis to character at current position" |
3965 |
||
3966 |
self basicInsert:aCharacter atLine:lineNr col:colNr. |
|
3967 |
aCharacter ~~ Character cr ifTrue:[ |
|
3160 | 3968 |
self addUndo:(DeleteCharacters line:lineNr col:colNr info:'insert'). |
2952 | 3969 |
] |
3970 |
! |
|
3971 |
||
3972 |
insertLines:someText from:start to:end before:lineNr |
|
3973 |
"insert a bunch of lines before line lineNr" |
|
3974 |
||
2954 | 3975 |
|text indent visLine w nLines "{ Class: SmallInteger }" |
3976 |
srcY "{ Class: SmallInteger }" |
|
3977 |
dstY "{ Class: SmallInteger }" | |
|
3978 |
||
3979 |
autoIndent ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3980 |
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
|
3981 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3982 |
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
|
3983 |
ln notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3984 |
line := ln withoutLeadingSeparators. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3985 |
(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
|
3986 |
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
|
3987 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3988 |
line |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3989 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3990 |
nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3991 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3992 |
]. |
2954 | 3993 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3994 |
text := someText |
2954 | 3995 |
]. |
3996 |
||
3997 |
visLine := self listLineToVisibleLine:lineNr. |
|
3998 |
(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
|
3999 |
self withoutRedrawInsertLines:text |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4000 |
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
|
4001 |
before:lineNr. |
2954 | 4002 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4003 |
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
|
4004 |
((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
|
4005 |
self withoutRedrawInsertLines:text |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4006 |
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
|
4007 |
before:lineNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4008 |
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
|
4009 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4010 |
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
|
4011 |
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
|
4012 |
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
|
4013 |
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
|
4014 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4015 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4016 |
"/ scroll ... |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4017 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4018 |
" |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4019 |
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
|
4020 |
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
|
4021 |
" |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4022 |
self catchExpose. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4023 |
self withoutRedrawInsertLines:text |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4024 |
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
|
4025 |
before:lineNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4026 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4027 |
copyFrom:self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4028 |
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
|
4029 |
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
|
4030 |
width:w |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4031 |
height:(height - dstY) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4032 |
async:true. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4033 |
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
|
4034 |
self waitForExpose |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4035 |
]. |
2954 | 4036 |
]. |
4037 |
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
|
4038 |
text do:[:line | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4039 |
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
|
4040 |
] |
2954 | 4041 |
]. |
4042 |
self textChanged. |
|
4043 |
||
4044 |
"Modified: 29.1.1997 / 13:02:39 / cg" |
|
2952 | 4045 |
! |
4046 |
||
4047 |
mergeLine:lineNr removeBlanks:removeBlanks |
|
4048 |
"merge line lineNr with line lineNr+1" |
|
4049 |
||
4050 |
|len| |
|
4051 |
||
3583 | 4052 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
4053 |
||
2952 | 4054 |
len := (self listAt:lineNr) size. |
4055 |
self nonUndoableDo:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4056 |
self basicMergeLine:lineNr removeBlanks:removeBlanks. |
2952 | 4057 |
]. |
4058 |
self addUndo:(PasteString new line:lineNr col:len+1 string:(Character cr asString) selected:false). |
|
4059 |
! |
|
4060 |
||
4061 |
replace:aCharacter atLine:lineNr col:colNr |
|
4062 |
"replace a single character at lineNr/colNr" |
|
4063 |
||
4064 |
|originalChar| |
|
4065 |
||
4066 |
originalChar := self characterAtLine:lineNr col:colNr. |
|
4067 |
self basicReplace:aCharacter atLine:lineNr col:colNr. |
|
3235 | 4068 |
self addUndo:(ReplaceCharacters line:lineNr col:colNr character:originalChar info:'replace'). |
2952 | 4069 |
! |
4070 |
||
3131 | 4071 |
replaceContentsWith:newContents |
4072 |
"replace everything" |
|
4073 |
||
4074 |
|originalContents| |
|
4075 |
||
4076 |
originalContents := self contents. |
|
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
4077 |
self contents:newContents keepUndoHistory:true. |
3131 | 4078 |
self addUndo:(ReplaceContents text:originalContents info:'replace'). |
4079 |
! |
|
4080 |
||
3130 | 4081 |
replaceLine:lineNr with:newText |
4082 |
"replace a line at lineNr" |
|
4083 |
||
4084 |
|originalLine| |
|
4085 |
||
4086 |
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
|
4087 |
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
|
4088 |
self checkForExistingLine:lineNr |
3479
5f9c6ff4fe6d
care for non-existing line when replacing (i.e. comment)
Claus Gittinger <cg@exept.de>
parents:
3476
diff
changeset
|
4089 |
]. |
3130 | 4090 |
self list at:lineNr put:newText. |
4091 |
self addUndo:(ReplaceLine line:lineNr string:originalLine info:'replace'). |
|
4092 |
self invalidateLine:lineNr. |
|
3479
5f9c6ff4fe6d
care for non-existing line when replacing (i.e. comment)
Claus Gittinger <cg@exept.de>
parents:
3476
diff
changeset
|
4093 |
|
5f9c6ff4fe6d
care for non-existing line when replacing (i.e. comment)
Claus Gittinger <cg@exept.de>
parents:
3476
diff
changeset
|
4094 |
"Modified: / 12-04-2007 / 09:31:33 / cg" |
3130 | 4095 |
! |
4096 |
||
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
4097 |
replaceString:aString atLine:lineNr col:colNr |
1557 | 4098 |
"replace multiple characters starting at lineNr/colNr. |
3235 | 4099 |
This is not prepared to encounter special chars (except TAB) in the string." |
4100 |
||
4101 |
|originalString| |
|
1557 | 4102 |
|
4103 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
4104 |
||
3235 | 4105 |
originalString := self textFromLine:lineNr col:colNr toLine:lineNr col:colNr+aString size-1. |
4106 |
||
4107 |
self basicReplaceString:aString atLine:lineNr col:colNr. |
|
4108 |
self addUndo:(ReplaceCharacters line:lineNr col:colNr characters:originalString info:'replace'). |
|
1557 | 4109 |
! |
4110 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4111 |
splitLine:lineNr before:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4112 |
"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
|
4113 |
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
|
4114 |
|
2952 | 4115 |
self basicSplitLine:lineNr before:colNr. |
3115 | 4116 |
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
|
4117 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4118 |
|
3130 | 4119 |
withoutRedrawAt:lineNr put:aString |
4120 |
"replace a line at lineNr" |
|
4121 |
||
4122 |
|originalLine| |
|
4123 |
||
4124 |
originalLine := self listAt:lineNr. |
|
4125 |
self addUndo:(ReplaceLine line:lineNr string:originalLine info:'replace'). |
|
4126 |
super withoutRedrawAt:lineNr put:aString. |
|
4127 |
! |
|
4128 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4129 |
withoutRedrawInsertLine:aString before:lineNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4130 |
"insert the argument, aString before line lineNr; the string |
2954 | 4131 |
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
|
4132 |
is not redrawn" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4133 |
|
2952 | 4134 |
self basicWithoutRedrawInsertLine:aString before:lineNr. |
3115 | 4135 |
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
|
4136 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4137 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4138 |
withoutRedrawInsertLines:lines from:start to:end before:lineNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4139 |
"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
|
4140 |
|
2954 | 4141 |
self basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr. |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
4142 |
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
|
4143 |
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
|
4144 |
]. |
121 | 4145 |
! |
4146 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4147 |
withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4148 |
"insert aString (which has no crs) at lineNr/colNr" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4149 |
|
2954 | 4150 |
self basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr. |
3115 | 4151 |
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
|
4152 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4153 |
|
2752 | 4154 |
!EditTextView methodsFor:'event handling'! |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4155 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4156 |
buttonPress:button x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4157 |
"hide the cursor when button is activated" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4158 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4159 |
hasKeyboardFocus := true. |
2589 | 4160 |
dragIsActive := false. |
4161 |
||
1817
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
4162 |
cursorShown ifTrue: [ |
3915
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4163 |
self drawCursor |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4164 |
]. |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4165 |
|
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4166 |
(button == 1) ifTrue:[ |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4167 |
self hideCursor |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4168 |
]. |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4169 |
"/ 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
|
4170 |
"/ |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4171 |
"/ (button == #paste) ifTrue:[ |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4172 |
"/ self pasteOrReplace. |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4173 |
"/ ^ self |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4174 |
"/ ]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4175 |
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
|
4176 |
|
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
4177 |
"Modified: / 23.3.1999 / 13:51:40 / cg" |
121 | 4178 |
! |
4179 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4180 |
buttonRelease:button x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4181 |
"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
|
4182 |
|
3789
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4183 |
|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
|
4184 |
|
3915
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4185 |
(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
|
4186 |
typeOfSelection := nil. |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4187 |
|
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4188 |
dragIsActive ifTrue:[ |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4189 |
self unselect |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4190 |
]. |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4191 |
selectionStartLine isNil ifTrue:[ |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4192 |
clickCol notNil ifTrue:[ |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4193 |
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
|
4194 |
newCursorCol := clickCol. |
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4195 |
|
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4196 |
cursorType ~~ #block ifTrue:[ |
3790 | 4197 |
clickPos notNil ifTrue:[ |
4198 |
"/ we do something special, if the text-cursor's type is not a block-cursor |
|
4199 |
"/ (i.e. if its an ibeam). |
|
4200 |
"/ adjust clickCol if the user clicked in the right third of a character. |
|
4201 |
x1 := self xOfCol:clickCol inVisibleLine:clickLine. |
|
4202 |
x2 := self xOfCol:clickCol+1 inVisibleLine:clickLine. |
|
4203 |
x2_3 := x1 + ((x2-x1) * (2/3)). |
|
4204 |
(clickPos x >= x2_3) ifTrue:[ newCursorCol := clickCol+1 ]. |
|
4205 |
]. |
|
3789
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4206 |
]. |
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4207 |
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
|
4208 |
] |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4209 |
] |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4210 |
] ifFalse:[ |
4010 | 4211 |
lastStringFromReplace := 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
|
4212 |
]. |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4213 |
self showCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4214 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4215 |
super buttonRelease:button x:x y:y |
1580
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
4216 |
|
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
4217 |
"Modified: / 18.6.1998 / 14:14:05 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4218 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4219 |
|
2580 | 4220 |
cursorKeyPress:key shifted:shifted |
2730
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
4221 |
|n| |
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
4222 |
|
2606
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
4223 |
self changeTypeOfSelectionTo:nil. |
2580 | 4224 |
|
4225 |
(key == #CursorRight) ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4226 |
(shifted and:[selectionStartLine isNil]) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4227 |
selectionStartLine := selectionEndLine := clickStartLine := cursorLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4228 |
selectionStartCol := selectionEndCol := clickStartCol := cursorCol. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4229 |
expandingTop := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4230 |
self validateNewSelection. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4231 |
self redrawLine:selectionStartLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4232 |
^ self. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4233 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4234 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4235 |
selectionStartLine notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4236 |
self cursorMovementAllowed ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4237 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4238 |
"/ treat the whole selection as cursor |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4239 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4240 |
self setCursorLine:(selectionEndLine ? selectionStartLine). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4241 |
selectionEndCol == 0 ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4242 |
selectionEndCol := 1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4243 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4244 |
self setCursorCol:selectionEndCol. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4245 |
shifted ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4246 |
self expandSelectionRight. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4247 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4248 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4249 |
self unselect; makeCursorVisible. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4250 |
cursorCol == 1 ifTrue:[^ self]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4251 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4252 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4253 |
self cursorRight. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4254 |
^ self |
2580 | 4255 |
]. |
4256 |
(key == #CursorDown) ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4257 |
(shifted and:[selectionStartLine isNil]) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4258 |
selectionStartLine := clickStartLine := cursorLine. selectionEndLine := cursorLine + 1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4259 |
selectionStartCol := clickStartCol := selectionEndCol := cursorCol. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4260 |
selectionEndCol == 1 ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4261 |
selectionEndCol := 0. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4262 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4263 |
self validateNewSelection. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4264 |
self redrawLine:selectionStartLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4265 |
expandingTop := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4266 |
self redrawLine:selectionEndLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4267 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4268 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4269 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4270 |
selectionStartLine notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4271 |
self cursorMovementAllowed ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4272 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4273 |
"/ treat the whole selection as cursor |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4274 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4275 |
self setCursorLine:(selectionEndLine ? selectionStartLine). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4276 |
self setCursorCol:selectionStartCol. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4277 |
cursorCol == 0 ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4278 |
self setCursorCol:1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4279 |
self setCursorLine:(cursorLine - 1). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4280 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4281 |
self makeCursorVisible. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4282 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4283 |
shifted ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4284 |
clickLine := cursorLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4285 |
clickCol := cursorCol. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4286 |
self expandSelectionDown. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4287 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4288 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4289 |
self unselect. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4290 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4291 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4292 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4293 |
n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorDown). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4294 |
self cursorDown:n. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4295 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4296 |
"/ flush keyboard to avoid runaway cursor |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4297 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4298 |
self sensor flushKeyboardFor:self. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4299 |
^ self |
2580 | 4300 |
]. |
4301 |
(key == #CursorLeft or:[key == #CursorUp]) ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4302 |
(shifted and:[selectionStartLine isNil]) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4303 |
expandingTop := true. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4304 |
key == #CursorLeft ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4305 |
cursorCol > 1 ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4306 |
selectionStartLine := selectionEndLine := clickStartLine := cursorLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4307 |
selectionEndCol := clickStartCol := cursorCol-1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4308 |
selectionStartCol := cursorCol-1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4309 |
self validateNewSelection. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4310 |
self redrawLine:selectionStartLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4311 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4312 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4313 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4314 |
cursorLine > 1 ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4315 |
selectionEndLine := clickStartLine := cursorLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4316 |
selectionEndCol := selectionStartCol := clickStartCol := cursorCol. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4317 |
selectionStartLine := cursorLine - 1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4318 |
selectionEndCol == 1 ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4319 |
selectionEndCol := 0. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4320 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4321 |
self validateNewSelection. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4322 |
self redrawFromLine:selectionStartLine to:cursorLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4323 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4324 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4325 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4326 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4327 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4328 |
selectionStartLine notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4329 |
self cursorMovementAllowed ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4330 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4331 |
"/ treat the whole selection as cursor |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4332 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4333 |
self setCursorLine:selectionStartLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4334 |
self setCursorCol:selectionStartCol. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4335 |
(key == #CursorLeft) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4336 |
self setCursorCol:(cursorCol+1). "/ compensate for followup crsr-left |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4337 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4338 |
self makeCursorVisible. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4339 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4340 |
shifted ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4341 |
(key == #CursorUp) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4342 |
clickLine := cursorLine. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4343 |
self expandSelectionUp. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4344 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4345 |
self expandSelectionLeft. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4346 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4347 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4348 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4349 |
self unselect. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4350 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4351 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4352 |
(key == #CursorLeft) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4353 |
self cursorLeft. ^self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4354 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4355 |
(key == #CursorUp) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4356 |
n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorUp). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4357 |
self cursorUp:n. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4358 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4359 |
"/ flush keyboard to avoid runaway cursor |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4360 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4361 |
self sensor flushKeyboardFor:self. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4362 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4363 |
]. |
2580 | 4364 |
]. |
4365 |
! |
|
4366 |
||
2952 | 4367 |
doKeyPress:key x:x y:y |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4368 |
"handle keyboard input" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4369 |
|
3781 | 4370 |
<resource: #keyboard (#Paste #Insert #Cut #Again #AgainForAll |
4371 |
#Replace #Undo #Redo #Accept |
|
3780 | 4372 |
#Delete #BasicDelete #BackSpace #BasicBackspace |
4373 |
#SelectWord #DeleteSpaces #Join |
|
4374 |
#SearchMatchingParent #SelectMatchingParents |
|
4375 |
#SelectToEnd #SelectFromBeginning |
|
4376 |
#BeginOfLine #EndOfLine #NextWord #PreviousWord |
|
4377 |
#CursorRight #CursorDown #CursorLeft #CursorUp |
|
4378 |
#Return #Tab #BackTab #NonInsertingTab #Escape |
|
4379 |
#GotoLine #BeginOfText #EndOfText |
|
4380 |
#SelectLine #ExpandSelectionByLine |
|
4381 |
#InsertLine #DeleteLine |
|
4382 |
#SelectLineFromBeginning |
|
4383 |
#LearnKeyboardMacro #ExecuteKeyboardMacro #ToggleInsertMode |
|
4384 |
#'F*' #'f*')> |
|
2017 | 4385 |
|
3799 | 4386 |
|fKeyMacros shiftPressed ctrlPressed i event cmdMacro macroName| |
2184
fb634dc3e606
learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
4387 |
|
fb634dc3e606
learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
4388 |
event := WindowGroup lastEventQuerySignal query. |
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
4389 |
shiftPressed := event hasShift. |
3976 | 4390 |
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
|
4391 |
|
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4392 |
(key == #LearnKeyboardMacro) ifTrue:[ |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4393 |
self toggleLearnMode. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4394 |
^ self |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4395 |
]. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4396 |
(key == #ExecuteKeyboardMacro) ifTrue:[ |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4397 |
self executeLearnedKeyboardMacro. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4398 |
^ self. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4399 |
]. |
3799 | 4400 |
(key == #Undo) ifTrue:[self undo. ^self]. |
4401 |
(key == #Redo) ifTrue:[self redo. ^self]. |
|
4402 |
||
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4403 |
self learnMode ifTrue:[ |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4404 |
learnedMacro add:event. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4405 |
]. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4406 |
|
2416
56acdd9e31b5
lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents:
2406
diff
changeset
|
4407 |
cmdMacro := UserPreferences current functionKeySequences at:key ifAbsent:nil. |
56acdd9e31b5
lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents:
2406
diff
changeset
|
4408 |
cmdMacro notNil ifTrue:[ |
3780 | 4409 |
self |
3786 | 4410 |
undoableDo:[ self executeKeyboardMacro:cmdMacro ] |
3780 | 4411 |
info: key. |
4412 |
^ self |
|
2416
56acdd9e31b5
lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents:
2406
diff
changeset
|
4413 |
]. |
56acdd9e31b5
lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents:
2406
diff
changeset
|
4414 |
|
3257 | 4415 |
(key == #BackSpace or:[key == #BasicBackspace]) ifTrue:[ |
3780 | 4416 |
selectionStartLine notNil ifTrue:[ |
4417 |
((key == #BasicBackspace) |
|
4418 |
or:[ UserPreferences current deleteSetsClipboardText not ]) |
|
4419 |
ifTrue:[ |
|
4420 |
self deleteSelection. |
|
4421 |
] ifFalse: [ |
|
4422 |
self copyAndDeleteSelection. |
|
4423 |
]. |
|
4424 |
^ self |
|
4425 |
]. |
|
4426 |
||
4427 |
self makeCursorVisible. |
|
4428 |
shiftPressed ifTrue:[ |
|
4429 |
self deleteWordBeforeCursor. |
|
4430 |
] ifFalse:[ |
|
4431 |
self deleteCharBeforeCursor. |
|
4432 |
]. |
|
4433 |
||
4434 |
^ self |
|
2205
230cf9cef6c3
searchPatter, if from selection (escape meta characters)
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
4435 |
]. |
2184
fb634dc3e606
learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
4436 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4437 |
(key isMemberOf:Character) ifTrue:[ |
3780 | 4438 |
self handleNonCommandKey:key. |
4439 |
^ self |
|
3235 | 4440 |
]. |
4441 |
||
3782
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4442 |
(key == #ToggleAutoIndent) ifTrue:[ |
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4443 |
self autoIndent:(autoIndent not). |
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4444 |
^ self. |
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4445 |
]. |
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4446 |
|
3235 | 4447 |
key == #ToggleInsertMode ifTrue:[ |
3782
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4448 |
self insertMode:(editMode value == EditMode insertMode) not. |
3780 | 4449 |
^ self. |
3160 | 4450 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4451 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4452 |
replacing := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4453 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4454 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4455 |
Fn pastes a key-sequence (but only if not overlayed with |
3780 | 4456 |
another function in the keyboard map) |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4457 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4458 |
see TextView>>:x:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4459 |
" |
1177
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
4460 |
(key at:1) asLowercase == $f ifTrue:[ |
3780 | 4461 |
(('[fF][0-9]' match:key) |
4462 |
or:['[fF][0-9][0-9]' match:key]) ifTrue:[ |
|
4463 |
shiftPressed ifFalse:[ |
|
4464 |
fKeyMacros := UserPreferences current functionKeySequences. |
|
4465 |
fKeyMacros notNil ifTrue:[ |
|
4466 |
(fKeyMacros includesKey:key) ifTrue:[ |
|
4467 |
self pasteOrReplace:(fKeyMacros at:key) asStringCollection. |
|
4468 |
^ self |
|
4469 |
] |
|
4470 |
] |
|
4471 |
] |
|
4472 |
]. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4473 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4474 |
|
2506 | 4475 |
(key == #'Ctrl8' or:[key == #'Ctrl9']) ifTrue:[ |
3780 | 4476 |
self parenthizeSelectionWith:$( and:$). |
4477 |
^ self. |
|
2506 | 4478 |
]. |
4479 |
(key == #'Ctrl2') ifTrue:[ |
|
3780 | 4480 |
self parenthizeSelectionWith:$" and:$". |
4481 |
^ self. |
|
2506 | 4482 |
]. |
4483 |
(key == #'Ctrl#') ifTrue:[ |
|
3780 | 4484 |
self parenthizeSelectionWith:$' and:$'. |
4485 |
^ self. |
|
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4486 |
]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4487 |
|
274
6df4bb990f04
handle accept where acceptAction is define (this was a historic leftover)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
4488 |
(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
|
4489 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4490 |
((key == #Paste) or:[key == #Insert]) ifTrue:[self pasteOrReplace. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4491 |
(key == #Cut) ifTrue:[self cut. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4492 |
(key == #Again) ifTrue:[self again. ^self]. |
3781 | 4493 |
(key == #AgainForAll) ifTrue:[self multipleAgain. ^self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4494 |
|
3542 | 4495 |
(key == #Join) ifTrue:[self joinLines. ^self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4496 |
(key == #Replace) ifTrue:[self replace. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4497 |
(key == #SelectWord) ifTrue:[ |
3780 | 4498 |
self makeCursorVisible. |
4499 |
self selectWordUnderCursor. |
|
4500 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4501 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4502 |
|
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4503 |
(key == #SearchMatchingParent) ifTrue:[self searchForMatchingParenthesis. ^ self]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4504 |
(key == #SelectMatchingParents) ifTrue:[self searchForAndSelectMatchingParenthesis. ^ self]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4505 |
(key == #SelectToEnd) ifTrue:[self selectUpToEnd. ^ self]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4506 |
(key == #SelectFromBeginning) ifTrue:[self selectFromBeginning. ^ self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4507 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4508 |
" disabled - nobody liked it ... |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4509 |
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
|
4510 |
|
1304
173d00c195f9
flush pending keyboard events in cursor-up/down
Claus Gittinger <cg@exept.de>
parents:
1300
diff
changeset
|
4511 |
(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
|
4512 |
(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
|
4513 |
(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
|
4514 |
(key == #Ctrlp) ifTrue:[self unselect. self cursorUp. ^ self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4515 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4516 |
|
1675
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
4517 |
(key == #BeginOfLine) ifTrue:[ |
3780 | 4518 |
shiftPressed ifTrue: [ |
4519 |
"/ "Original St/X code - now use Ctrl modifier" |
|
4520 |
"/ self unselect. |
|
4521 |
"/ self cursorHome. |
|
4522 |
"Jan's modification" |
|
4523 |
self addToSelectionAfter:[ self cursorToBeginOfLine ]. |
|
4524 |
] ifFalse: [ |
|
4525 |
self unselect. |
|
4526 |
ctrlPressed ifTrue:[ |
|
4527 |
self cursorHome. |
|
4528 |
] ifFalse:[ |
|
4529 |
self cursorToBeginOfLine. |
|
4530 |
] |
|
4531 |
]. |
|
4532 |
^ self |
|
1675
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
4533 |
]. |
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
4534 |
(key == #EndOfLine) ifTrue:[ |
3780 | 4535 |
shiftPressed ifTrue:[ |
4536 |
"/ "Original St/X code - now use Ctrl modifier" |
|
4537 |
"/ self unselect. |
|
4538 |
"/ self cursorToBottom |
|
4539 |
"Jan's modification" |
|
4540 |
self addToSelectionAfter:[ self cursorToEndOfLine ] . |
|
4541 |
] ifFalse:[ |
|
4542 |
self unselect. |
|
4543 |
ctrlPressed ifTrue:[ |
|
4544 |
self cursorToBottom |
|
4545 |
] ifFalse:[ |
|
4546 |
self cursorToEndOfLine. |
|
4547 |
] |
|
4548 |
]. |
|
4549 |
^ self |
|
1675
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
4550 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4551 |
(key == #NextWord) ifTrue:[self cursorToNextWord. ^self]. |
3310 | 4552 |
(key == #EndOfWord) ifTrue:[self cursorToEndOfWord. ^self]. |
499 | 4553 |
(key == #PreviousWord) ifTrue:[self cursorToPreviousWord. ^self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4554 |
(key == #GotoLine) ifTrue:[self gotoLine. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4555 |
|
2580 | 4556 |
(key == #CursorRight |
4557 |
or:[key == #CursorDown |
|
4558 |
or:[key == #CursorLeft |
|
4559 |
or:[key == #CursorUp]]]) ifTrue:[ |
|
3780 | 4560 |
self cursorKeyPress:key shifted:shiftPressed. |
4561 |
^ self. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4562 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4563 |
|
3257 | 4564 |
(key == #NonInsertingReturn) ifTrue:[ |
3780 | 4565 |
self unselect. self cursorReturn. |
4566 |
^ self |
|
3257 | 4567 |
]. |
4568 |
||
4569 |
(key == #Return) ifTrue:[ |
|
3780 | 4570 |
shiftPressed ifTrue:[ |
4571 |
self unselect. self cursorReturn. |
|
4572 |
^ self |
|
4573 |
]. |
|
4574 |
self isReadOnly ifTrue:[ |
|
4575 |
self unselect; makeCursorVisible. |
|
4576 |
self cursorReturn |
|
4577 |
] ifFalse:[ |
|
4578 |
self isInInsertMode ifFalse:[ |
|
4579 |
self cursorReturn. |
|
4580 |
autoIndent == true ifTrue:[ |
|
4581 |
i := self leftIndentForLine:(cursorLine + 1). |
|
4582 |
self cursorCol:(i+1 max:1) |
|
4583 |
] |
|
4584 |
] ifTrue:[ |
|
4585 |
"/ old version just unselected ... |
|
4586 |
"/ self unselect; makeCursorVisible. |
|
4587 |
||
4588 |
"/ new version deletes ... |
|
4589 |
typeOfSelection == #paste ifTrue:[ |
|
4590 |
self unselect; makeCursorVisible. |
|
4591 |
] ifFalse:[ |
|
4592 |
self copyAndDeleteSelection. |
|
4593 |
]. |
|
4594 |
self insertCharAtCursor:(Character cr). |
|
4595 |
autoIndent == true ifTrue:[ |
|
4596 |
i := self leftIndentForLine:cursorLine. |
|
4597 |
self indentFromLine:cursorLine toLine:cursorLine. |
|
4598 |
self cursorCol:(i+1 max:1) |
|
4599 |
]. |
|
4600 |
]. |
|
4601 |
]. |
|
4602 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4603 |
]. |
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
|
4604 |
|
2819
a7a41dfb9df7
BackTab / NonInsertingTab modifiers now defined in keyboard.rc
ca
parents:
2817
diff
changeset
|
4605 |
(key == #NonInsertingTab) ifTrue:[ |
3780 | 4606 |
self unselect. self cursorTab. |
4607 |
^ self |
|
2819
a7a41dfb9df7
BackTab / NonInsertingTab modifiers now defined in keyboard.rc
ca
parents:
2817
diff
changeset
|
4608 |
]. |
3422
a0c68e8bd56e
tab with line selection means: indent/undent
Claus Gittinger <cg@exept.de>
parents:
3416
diff
changeset
|
4609 |
((key == #BackTab) or:[(key == #Tab)]) ifTrue:[ |
3780 | 4610 |
self tabMeansNextField ifTrue:[^ super keyPress:key x:x y:y]. |
4611 |
||
4612 |
self hasSelection ifTrue:[ |
|
4613 |
selectStyle == #line ifTrue:[ |
|
4614 |
fKeyMacros := UserPreferences current functionKeySequences. |
|
4615 |
fKeyMacros notNil ifTrue:[ |
|
4616 |
((key == #Tab) and:[shiftPressed not]) ifTrue:[ |
|
3799 | 4617 |
macroName := #IndentBy4. |
3780 | 4618 |
] ifFalse:[ |
3799 | 4619 |
macroName := #UndentBy4. |
3780 | 4620 |
]. |
3799 | 4621 |
macroName notNil ifTrue:[ |
4622 |
cmdMacro := fKeyMacros at:macroName ifAbsent:nil. |
|
3780 | 4623 |
self |
3786 | 4624 |
undoableDo:[ self executeKeyboardMacro:cmdMacro ] |
3799 | 4625 |
info:macroName. |
3780 | 4626 |
^ self |
4627 |
]. |
|
4628 |
]. |
|
4629 |
] |
|
4630 |
]. |
|
4631 |
||
4632 |
self unselect. |
|
4633 |
(key == #Tab) ifTrue:[ |
|
4634 |
(shiftPressed or:[self isInInsertMode not]) ifTrue:[ |
|
4635 |
self cursorTab. |
|
4636 |
^ self |
|
4637 |
]. |
|
4638 |
self insertTabAtCursor. |
|
4639 |
^ self |
|
4640 |
]. |
|
4641 |
self cursorBacktab. |
|
4642 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4643 |
]. |
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
|
4644 |
|
2883
6cdb4a5a7b5e
shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents:
2880
diff
changeset
|
4645 |
"/ key == #DeleteSpaces ifTrue:[ |
6cdb4a5a7b5e
shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents:
2880
diff
changeset
|
4646 |
(key == #Delete) ifTrue:[ |
3780 | 4647 |
shiftPressed ifTrue:[ |
4648 |
[(cursorCol <= (self listAt:cursorLine) size) |
|
4649 |
and:[self characterUnderCursor isSeparator]] whileTrue:[ |
|
4650 |
self makeCursorVisible. |
|
4651 |
self deleteCharAtCursor. |
|
4652 |
]. |
|
4653 |
^ self |
|
4654 |
] |
|
2883
6cdb4a5a7b5e
shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents:
2880
diff
changeset
|
4655 |
]. |
6cdb4a5a7b5e
shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents:
2880
diff
changeset
|
4656 |
|
870 | 4657 |
(key == #Delete |
4658 |
or:[key == #BasicDelete]) ifTrue:[ |
|
3780 | 4659 |
selectionStartLine notNil ifTrue:[ |
4660 |
((key == #BasicDelete) |
|
4661 |
or:[UserPreferences current deleteSetsClipboardText not]) ifTrue:[ |
|
4662 |
self deleteSelection. |
|
4663 |
] ifFalse:[ |
|
4664 |
self copyAndDeleteSelection. |
|
4665 |
]. |
|
4666 |
^ self |
|
4667 |
]. |
|
4668 |
self makeCursorVisible. |
|
4669 |
self deleteCharAtCursor. |
|
4670 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4671 |
]. |
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
|
4672 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4673 |
(key == #BeginOfText) ifTrue:[ "i.e. HOME" |
3780 | 4674 |
self unselect. |
4675 |
cursorVisibleLine == 1 ifTrue:[ |
|
4676 |
self cursorHome. |
|
4677 |
] ifFalse:[ |
|
4678 |
self cursorToFirstVisibleLine |
|
4679 |
]. |
|
4680 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4681 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4682 |
(key == #EndOfText) ifTrue:[ "i.e. END" |
3780 | 4683 |
self unselect. |
4684 |
cursorVisibleLine == nFullLinesShown ifTrue:[ |
|
4685 |
self cursorToBottom. |
|
4686 |
] ifFalse:[ |
|
4687 |
self cursorToLastVisibleLine |
|
4688 |
]. |
|
4689 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4690 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4691 |
((key == #Escape) |
3257 | 4692 |
or:[key == #SelectLineFromBeginning]) ifTrue:[ |
3780 | 4693 |
self makeCursorVisible. |
4694 |
self unselect. self selectCursorLineFromBeginning. |
|
4695 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4696 |
]. |
3257 | 4697 |
(key == #SelectLine) ifTrue:[ |
3780 | 4698 |
self makeCursorVisible. |
4699 |
self unselect. self selectCursorLine. |
|
4700 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4701 |
]. |
3257 | 4702 |
(key == #ExpandSelectionByLine) ifTrue:[ |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4703 |
"/ self makeCursorVisible. |
3780 | 4704 |
self selectExpandCursorLine. |
4705 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4706 |
]. |
3257 | 4707 |
(key == #DeleteLine) ifTrue:[ |
3780 | 4708 |
self makeCursorVisible. |
4709 |
self unselect. self deleteCursorLine. |
|
4710 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4711 |
]. |
3257 | 4712 |
(key == #InsertLine) ifTrue:[ |
3780 | 4713 |
self makeCursorVisible. |
4714 |
self unselect. self insertLine:nil before:cursorLine. |
|
4715 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4716 |
]. |
3781 | 4717 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4718 |
super keyPress:key x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4719 |
|
3310 | 4720 |
"Modified: / 06-02-1998 / 11:59:59 / stefan" |
3422
a0c68e8bd56e
tab with line selection means: indent/undent
Claus Gittinger <cg@exept.de>
parents:
3416
diff
changeset
|
4721 |
"Modified: / 28-10-2006 / 15:37:47 / cg" |
121 | 4722 |
! |
4723 |
||
2952 | 4724 |
executeKeyboardMacro:cmdMacro |
4725 |
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
|
4726 |
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
|
4727 |
ex return. |
2952 | 4728 |
] do:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4729 |
AbortOperationRequest handle:[:ex | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4730 |
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
|
4731 |
ex return. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4732 |
] do:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4733 |
Parser |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4734 |
evaluate:cmdMacro asString |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4735 |
receiver:self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4736 |
notifying:nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4737 |
compile:false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4738 |
]. |
2952 | 4739 |
]. |
4740 |
! |
|
4741 |
||
4742 |
handleNonCommandKey:keyArg |
|
4743 |
|selStartLine selStartCol selEndLine selEndCol sel key| |
|
4744 |
||
4745 |
self isReadOnly ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4746 |
self flash. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4747 |
^ self. |
2952 | 4748 |
]. |
4749 |
||
4750 |
key := keyArg. |
|
4751 |
||
4752 |
typeOfSelection == #paste ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4753 |
"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
|
4754 |
self unselect |
2952 | 4755 |
]. |
4756 |
||
4757 |
selStartLine := selectionStartLine. |
|
4758 |
selStartCol := self selectionStartCol. |
|
4759 |
selEndLine := selectionEndLine. |
|
4760 |
selEndCol := self selectionEndCol. |
|
4761 |
sel := self selection. |
|
4762 |
||
4763 |
(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
|
4764 |
key := CharacterEncoder encode:key from:#'iso10646-1' into:characterEncoding. |
2952 | 4765 |
]. |
4766 |
||
4767 |
"replace selection by what is typed in - |
|
3235 | 4768 |
if word was selected with a space, keep it. |
4769 |
if there was no selection, the keys character is inserted" |
|
4770 |
||
4771 |
editMode value isInsertAndSelectMode ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4772 |
selectionStartLine := selectionStartCol := selectionEndLine := selectionEndCol := nil. |
3235 | 4773 |
]. |
2952 | 4774 |
|
4775 |
(selectStyle == #wordLeft) ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4776 |
self replaceSelectionBy:(' ' , key asString) |
2952 | 4777 |
] ifFalse:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4778 |
(selectStyle == #wordRight) ifTrue:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4779 |
self replaceSelectionBy:(key asString , ' '). |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4780 |
self cursorLeft |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4781 |
] ifFalse:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4782 |
self replaceSelectionBy:key |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4783 |
] |
3160 | 4784 |
]. |
2952 | 4785 |
selectStyle := nil. |
4786 |
||
3235 | 4787 |
editMode value isInsertAndSelectMode ifTrue:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4788 |
selectionStartLine := selStartLine. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4789 |
selectionStartCol := selStartCol. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4790 |
selectionEndLine := selEndLine. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4791 |
selectionEndCol := selEndCol. |
3235 | 4792 |
]. |
4793 |
||
2952 | 4794 |
showMatchingParenthesis ifTrue:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4795 |
"emacs style parenthesis shower" |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4796 |
(ExecutingMacroQuery query ? false) ifFalse:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4797 |
"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
|
4798 |
otherwise its too anoying. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4799 |
" |
2952 | 4800 |
" |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4801 |
(#( $( $) $[ $] ${ $} ) includes:key) ifTrue:[ |
2952 | 4802 |
" |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4803 |
(#( $) $] $} ) includes:key) ifTrue:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4804 |
self |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4805 |
searchForMatchingParenthesisFromLine:cursorLine col:(cursorCol - 1) |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4806 |
ifFound:[:line :col | |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4807 |
|savLine savCol sensor| |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4808 |
|
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4809 |
self withCursor:Cursor eye do:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4810 |
savLine := cursorLine. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4811 |
savCol := cursorCol. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4812 |
self cursorLine:line col:col. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4813 |
device flush. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4814 |
|
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4815 |
"/ 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
|
4816 |
"/ arrives in the meantime ... |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4817 |
|
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4818 |
sensor := self sensor. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4819 |
5 timesRepeat:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4820 |
(sensor hasKeyPressEventFor:self) ifFalse:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4821 |
Processor activeProcess millisecondDelay:40. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4822 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4823 |
]. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4824 |
self cursorLine:savLine col:savCol |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4825 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4826 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4827 |
ifNotFound:[self showNotFound] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4828 |
onError:[self beep] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4829 |
]. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4830 |
] |
2952 | 4831 |
]. |
4832 |
||
4833 |
"/ true "autoExpandWhileTyping" ifTrue:[ |
|
4834 |
"/ self wordAtLine:cursorLine col:cursorCol-1 do:[ |
|
4835 |
"/ :beginLine :beginCol :endLine :endCol :style | |
|
4836 |
"/ |
|
4837 |
"/ self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
|
4838 |
"/ self selection. |
|
4839 |
"/ typeOfSelection := #paste. |
|
3160 | 4840 |
"/ ]. |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4841 |
"/ ]. |
3235 | 4842 |
editMode value isInsertAndSelectMode ifTrue:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4843 |
selectionStartLine isNil ifTrue:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4844 |
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
|
4845 |
] ifFalse:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4846 |
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
|
4847 |
]. |
3235 | 4848 |
]. |
2952 | 4849 |
! |
4850 |
||
4851 |
keyPress:key x:x y:y |
|
4852 |
"handle keyboard input" |
|
4853 |
||
4854 |
self undoableDo:[ |
|
3160 | 4855 |
self doKeyPress:key x:x y:y |
2952 | 4856 |
]. |
4857 |
! |
|
4858 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4859 |
mapped |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4860 |
"view was made visible" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4861 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4862 |
super mapped. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
4863 |
self updateCursorVisibleLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4864 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4865 |
|
3268
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4866 |
requestAutoAccept |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4867 |
"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
|
4868 |
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
|
4869 |
|
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4870 |
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
|
4871 |
"/ nope - |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4872 |
^ false |
3268
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4873 |
]. |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4874 |
self accept. |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4875 |
^ true. |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4876 |
! |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4877 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4878 |
sizeChanged:how |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4879 |
"make certain, cursor is visible after the sizechange" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4880 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4881 |
|cv| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4882 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4883 |
cv := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4884 |
super sizeChanged:how. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4885 |
cv notNil ifTrue:[ |
3160 | 4886 |
self makeLineVisible:cursorLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4887 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4888 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4889 |
|
1807 | 4890 |
!EditTextView methodsFor:'focus handling'! |
4891 |
||
4892 |
hasKeyboardFocus:aBoolean |
|
4893 |
"sent by the windowGroup, a delegate or myself to make me show a block cursor |
|
4894 |
(otherwise, I would not know about this)" |
|
4895 |
||
4896 |
hasKeyboardFocus := aBoolean. |
|
3160 | 4897 |
(cursorShown |
4898 |
and:[self enabled |
|
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
4899 |
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
|
4900 |
self drawCursor |
1816
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
4901 |
]. |
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
4902 |
|
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
4903 |
"Modified: / 23.3.1999 / 13:49:35 / cg" |
1807 | 4904 |
! |
4905 |
||
4906 |
showFocus:explicit |
|
4907 |
"in addition to however my superclass thinks how a focusView is to be |
|
4908 |
displayed, show the cursor when I got the focus" |
|
4909 |
||
4910 |
self showCursor. |
|
4911 |
self hasKeyboardFocus:true. |
|
4912 |
super showFocus:explicit |
|
4913 |
||
4914 |
"Modified: 11.12.1996 / 16:56:54 / cg" |
|
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
4915 |
! |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
4916 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
4917 |
wantsFocusWithPointerEnter |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
4918 |
"return true, if I want the focus when |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
4919 |
the mouse pointer enters" |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
4920 |
|
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
4921 |
(UserPreferences current focusFollowsMouse ~~ false |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
4922 |
and:[(styleSheet at:#'editText.requestFocusOnPointerEnter' default:true) |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
4923 |
and:[self enabled |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
4924 |
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
|
4925 |
^ true |
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
4926 |
]. |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
4927 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
4928 |
^ false |
1807 | 4929 |
! ! |
4930 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4931 |
!EditTextView methodsFor:'formatting'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4932 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4933 |
indent |
3221 | 4934 |
"indent a line-range - this is done by searching for the |
4935 |
last non-empty line before the selection, and changing the indent |
|
4936 |
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
|
4937 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4938 |
|start end| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4939 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4940 |
selectionStartLine isNil ifTrue:[^ self]. |
3221 | 4941 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4942 |
start := selectionStartLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4943 |
end := selectionEndLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4944 |
(selectionEndCol == 0) ifTrue:[ |
3786 | 4945 |
end := end - 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4946 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4947 |
self unselect. |
3160 | 4948 |
self |
3786 | 4949 |
undoableDo:[self indentFromLine:start toLine:end] |
4950 |
info:'Indent' |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4951 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4952 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4953 |
indentFromLine:start toLine:end |
3221 | 4954 |
"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
|
4955 |
last non-empty line before start, and change the indent |
3221 | 4956 |
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
|
4957 |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4958 |
|leftStart delta d line spaces| |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4959 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4960 |
leftStart := self leftIndentForLine:start. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4961 |
(leftStart == 0) ifTrue:[^ self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4962 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4963 |
delta := leftStart - (self leftIndentOfLine:start). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4964 |
(delta == 0) ifTrue:[^ self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4965 |
(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
|
4966 |
spaces := String new:delta |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4967 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4968 |
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
|
4969 |
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
|
4970 |
line notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4971 |
line isBlank ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4972 |
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
|
4973 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4974 |
(delta > 0) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4975 |
line := spaces , line. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4976 |
widthOfWidestLine notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4977 |
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
|
4978 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4979 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4980 |
"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
|
4981 |
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
|
4982 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4983 |
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
|
4984 |
(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
|
4985 |
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
|
4986 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4987 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4988 |
widthOfWidestLine := nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4989 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4990 |
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
|
4991 |
self textChanged. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4992 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4993 |
] |
3221 | 4994 |
]. |
4995 |
"/ self redrawFromLine:start to:end |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4996 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4997 |
"Modified: 5.3.1996 / 14:59:18 / cg" |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4998 |
! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4999 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5000 |
leftIndentForLine:lineNr |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5001 |
"find an appropriate indent for a line. |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5002 |
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
|
5003 |
and returning its indent." |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5004 |
|
827 | 5005 |
"SHOULD GO TO ListView" |
5006 |
||
5007 |
|line lnr indent| |
|
5008 |
||
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5009 |
lnr := lineNr. |
827 | 5010 |
|
5011 |
[lnr ~~ 1] whileTrue:[ |
|
3160 | 5012 |
lnr := lnr - 1. |
5013 |
line := self listAt:lnr. |
|
5014 |
||
5015 |
line notNil ifTrue:[ |
|
5016 |
indent := line indexOfNonSeparatorStartingAt:1. |
|
5017 |
indent ~~ 0 ifTrue:[ |
|
5018 |
^ indent - 1 |
|
5019 |
] |
|
5020 |
] |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5021 |
]. |
827 | 5022 |
^ 0 |
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5023 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5024 |
"Created: 5.3.1996 / 14:58:53 / cg" |
105 | 5025 |
! ! |
5026 |
||
0 | 5027 |
!EditTextView methodsFor:'initialization'! |
5028 |
||
941 | 5029 |
fetchDeviceResources |
5030 |
"fetch device colors, to avoid reallocation at redraw time" |
|
5031 |
||
5032 |
super fetchDeviceResources. |
|
5033 |
||
1993 | 5034 |
cursorFgColor notNil ifTrue:[cursorFgColor := cursorFgColor onDevice:device]. |
5035 |
cursorBgColor notNil ifTrue:[cursorBgColor := cursorBgColor onDevice:device]. |
|
5036 |
cursorNoFocusFgColor notNil ifTrue:[cursorNoFocusFgColor := cursorNoFocusFgColor onDevice:device]. |
|
941 | 5037 |
|
5038 |
"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
|
5039 |
"Modified: 18.2.1997 / 15:02:46 / cg" |
941 | 5040 |
! |
5041 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5042 |
initEvents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5043 |
"enable enter/leave events in addition" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5044 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5045 |
super initEvents. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5046 |
self enableEnterLeaveEvents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5047 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5048 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5049 |
initStyle |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5050 |
"initialize style specific stuff" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5051 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5052 |
super initStyle. |
2088 | 5053 |
lineSpacing := 1. "/ for underwave - also looks better |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5054 |
lockUpdates := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5055 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5056 |
cursorFgColor := DefaultCursorForegroundColor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5057 |
cursorFgColor isNil ifTrue:[cursorFgColor := bgColor]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5058 |
cursorBgColor := DefaultCursorBackgroundColor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5059 |
cursorBgColor isNil ifTrue:[cursorBgColor := fgColor]. |
1334 | 5060 |
cursorType := cursorTypeNoFocus := DefaultCursorType. |
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
5061 |
DefaultCursorTypeNoFocus notNil ifTrue:[ |
3160 | 5062 |
cursorTypeNoFocus := DefaultCursorTypeNoFocus. |
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
5063 |
]. |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
5064 |
cursorNoFocusFgColor := DefaultCursorNoFocusForegroundColor. |
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
5065 |
cursorNoFocusFgColor isNil ifTrue:[ |
3160 | 5066 |
cursorType ~~ #block ifTrue:[ |
5067 |
cursorNoFocusFgColor := cursorBgColor |
|
5068 |
] ifFalse:[ |
|
5069 |
cursorNoFocusFgColor := cursorFgColor |
|
5070 |
] |
|
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
5071 |
]. |
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
5072 |
|
2088 | 5073 |
"Modified: / 15.12.1999 / 22:27:45 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5074 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5075 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5076 |
initialize |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5077 |
"initialize a new EditTextView; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5078 |
setup some instance variables" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5079 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5080 |
super initialize. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5081 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5082 |
self level:-1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5083 |
readOnly := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5084 |
fixedSize := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5085 |
exceptionBlock := [:errorText | ]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5086 |
cursorShown := prevCursorState := true. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5087 |
cursorLine := 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5088 |
cursorVisibleLine := 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5089 |
cursorCol := 1. |
2815 | 5090 |
cursorLineHolder := 1 asValue. |
5091 |
cursorColHolder := 1 asValue. |
|
2119 | 5092 |
modifiedChannel := ValueHolder with:false. |
5093 |
acceptChannel := ValueHolder with:false. |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
5094 |
acceptChannel addDependent:self. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5095 |
showMatchingParenthesis := false. |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
5096 |
hasKeyboardFocus := false. |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
5097 |
tabMeansNextField := false. |
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5098 |
autoIndent := false. |
3235 | 5099 |
editMode := EditMode insertMode asValue. |
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5100 |
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
|
5101 |
trimBlankLines := self st80EditMode not. |
2131 | 5102 |
cursorMovementWhenUpdating := #beginOfText. |
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
5103 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5104 |
"/ enable drop by default |
2589 | 5105 |
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
|
5106 |
|
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
5107 |
undoSupport := UndoSupport for:self. |
0 | 5108 |
! ! |
5109 |
||
2580 | 5110 |
!EditTextView methodsFor:'macros'! |
5111 |
||
5112 |
executeLearnedKeyboardMacro |
|
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5113 |
(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
|
5114 |
ExecutingMacroQuery |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5115 |
answer:true |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5116 |
do:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5117 |
learnedMacro do:[:event | |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5118 |
WindowGroup lastEventQuerySignal answer:event |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5119 |
do:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5120 |
self |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5121 |
dispatchEvent:event |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5122 |
withFocusOn:nil |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5123 |
delegate:false |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5124 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5125 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5126 |
]. |
2580 | 5127 |
] ifFalse:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5128 |
self flash. |
2580 | 5129 |
]. |
5130 |
! |
|
5131 |
||
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5132 |
learnMode |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5133 |
"true if currently learning" |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5134 |
|
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5135 |
^ (learnMode value ? false). |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5136 |
! |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5137 |
|
2580 | 5138 |
learnMode:aBoolean |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5139 |
"toggle the learn-mode" |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5140 |
|
2580 | 5141 |
|fg bg| |
5142 |
||
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5143 |
self learnModeHolder value:aBoolean. |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5144 |
|
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5145 |
aBoolean ifTrue:[ |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5146 |
learnedMacro := OrderedCollection new. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5147 |
fg := Color white. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5148 |
bg := Color black. |
2580 | 5149 |
] ifFalse:[ |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5150 |
cursorFgColor := fg := (DefaultCursorForegroundColor ? bgColor). |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5151 |
cursorBgColor := bg := (DefaultCursorBackgroundColor ? fgColor). |
2580 | 5152 |
]. |
5153 |
self cursorForegroundColor:fg backgroundColor:bg. |
|
5154 |
! |
|
5155 |
||
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5156 |
learnModeHolder |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5157 |
learnMode isNil ifTrue:[ |
3160 | 5158 |
learnMode := false asValue |
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5159 |
]. |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5160 |
^ learnMode |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5161 |
! |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5162 |
|
2580 | 5163 |
toggleLearnMode |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5164 |
"toggle the learn-mode" |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5165 |
|
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5166 |
self learnMode:(self learnMode not). |
2580 | 5167 |
! ! |
5168 |
||
121 | 5169 |
!EditTextView methodsFor:'menu actions'! |
5170 |
||
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5171 |
babelFishTranslate:fromToModeString |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5172 |
"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
|
5173 |
|
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5174 |
|original translated| |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5175 |
|
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5176 |
original := self selectionAsString. |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5177 |
original size == 0 ifTrue:[^ self]. |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5178 |
|
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5179 |
self withWaitCursorDo:[ |
3799 | 5180 |
SOAP::SoapImplError handle:[:ex | |
5181 |
Dialog warn:('Translation failed - WEB Service error:\\%1.' bindWith:ex description allBold) withCRs |
|
5182 |
] do:[ |
|
5183 |
translated := SOAP::BabelFishClient new translate:original mode:fromToModeString. |
|
5184 |
] |
|
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5185 |
]. |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5186 |
|
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5187 |
"/ v pasteOrReplace:translated |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5188 |
self cursorLine:(self selectionEndLine) col:(self selectionEndCol + 1). |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5189 |
self unselect. |
3799 | 5190 |
self |
5191 |
undoablePaste:translated |
|
5192 |
info:'Translate' |
|
3495 | 5193 |
|
5194 |
"Modified: / 28-07-2007 / 13:27:21 / cg" |
|
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5195 |
! |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5196 |
|
3517 | 5197 |
compareWithClipboard |
5198 |
"compare the selection against the clipboard contents" |
|
5199 |
||
5200 |
|t1 t2| |
|
5201 |
||
5202 |
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
|
5203 |
t2 isEmptyOrNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5204 |
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
|
5205 |
^ self. |
3517 | 5206 |
]. |
5207 |
||
5208 |
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
|
5209 |
t1 := self selectionAsString. |
3517 | 5210 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5211 |
t1 := self contents asString |
3517 | 5212 |
]. |
5213 |
t1 := t1 string. |
|
5214 |
||
5215 |
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
|
5216 |
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
|
5217 |
^ self. |
3517 | 5218 |
]. |
5219 |
DiffTextView |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5220 |
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
|
5221 |
and:t2 label:'Clipboard' |
3517 | 5222 |
! |
5223 |
||
121 | 5224 |
cut |
5225 |
"cut selection into copybuffer" |
|
5226 |
||
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5227 |
self deleteCopyToClipboard:true |
121 | 5228 |
! |
5229 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5230 |
defaultForGotoLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5231 |
"return a default value to show in the gotoLine box" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5232 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5233 |
cursorLine notNil ifTrue:[ |
3160 | 5234 |
^ cursorLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5235 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5236 |
^ super defaultForGotoLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5237 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5238 |
|
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5239 |
deleteCopyToClipboard:toClipboard |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5240 |
"cut selection into copybuffer" |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5241 |
|
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5242 |
|line col history sel s| |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5243 |
|
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5244 |
(self checkModificationsAllowed) ifFalse:[ |
3786 | 5245 |
self flash. |
5246 |
^ self |
|
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5247 |
]. |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5248 |
|
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5249 |
sel := self selection. |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5250 |
sel notNil ifTrue:[ |
4010 | 5251 |
lastStringToReplace := s := sel asStringWithCRs. |
3786 | 5252 |
line := selectionStartLine. |
5253 |
col := selectionStartCol. |
|
5254 |
||
5255 |
toClipboard ifTrue:[ |
|
5256 |
" |
|
5257 |
remember in CopyBuffer |
|
5258 |
" |
|
5259 |
self setClipboardText:sel. "/ lastString. |
|
5260 |
]. |
|
5261 |
||
5262 |
" |
|
5263 |
append to DeleteHistory (if there is one) |
|
5264 |
" |
|
5265 |
history := Smalltalk at:#DeleteHistory. |
|
5266 |
history notNil ifTrue:[ |
|
5267 |
history addAll:(sel asStringCollection). |
|
5268 |
history size > 1000 ifTrue:[ |
|
5269 |
history := history copyFrom:(history size - 1000) |
|
5270 |
]. |
|
5271 |
]. |
|
5272 |
||
5273 |
" |
|
5274 |
now, delete it |
|
5275 |
" |
|
5276 |
self |
|
5277 |
undoableDo:[self deleteSelection] |
|
5278 |
info:'Delete'. |
|
5279 |
lastReplacement := nil |
|
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5280 |
] ifFalse:[ |
3786 | 5281 |
" |
5282 |
a cut without selection will search&cut again |
|
5283 |
" |
|
5284 |
self undoableDo:[ |
|
5285 |
self again |
|
5286 |
] |
|
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5287 |
] |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5288 |
|
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5289 |
"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
|
5290 |
! |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5291 |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5292 |
editMenu |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5293 |
"return the views middleButtonMenu" |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5294 |
|
3781 | 5295 |
<resource: #keyboard (#Again #AgainForAll #Copy #Cut #Paste #Accept |
5296 |
#Find #GotoLine #SaveAs #Print |
|
3890 | 5297 |
#PasteFromHistory #Join #Wrap #Undo #Redo |
3781 | 5298 |
#ToggleAutoIndent #ToggleInsertMode |
5299 |
#LearnKeyboardMacro #ExecuteKeyboardMacro )> |
|
1261
bdb18f73205c
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1198
diff
changeset
|
5300 |
<resource: #programMenu> |
1054 | 5301 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5302 |
|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
|
5303 |
transSub sortSub what undoIdx redoIdx sensor main mainItems| |
1515 | 5304 |
|
2460 | 5305 |
items := #( |
3781 | 5306 |
('Redo' redo Redo ) |
5307 |
('Again (for All)' multipleAgain AgainForAll ) |
|
3731 | 5308 |
('-' ) |
5309 |
('Search...' search Find ) |
|
5310 |
('Goto Line...' gotoLine GotoLine ) |
|
5311 |
('-' ) |
|
5312 |
('Tools' tools ) |
|
5313 |
('-' ) |
|
5314 |
('Save As...' save SaveAs ) |
|
5315 |
('Print' doPrint Print ) |
|
5316 |
('=' ) |
|
5317 |
('Misc' misc ShiftCtrl) |
|
5318 |
). |
|
2460 | 5319 |
|
2866 | 5320 |
miscItems := #( |
3781 | 5321 |
('AutoIndent \c' autoIndent: ToggleAutoIndent ) |
5322 |
('InsertMode \c' insertMode: ToggleInsertMode ) |
|
3731 | 5323 |
('-' ) |
5324 |
('Paste Previous...' pasteOrReplaceFromHistory PasteFromHistory ) |
|
3781 | 5325 |
('Join Lines' joinLines Join ) |
3890 | 5326 |
('Wrap Lines' wrapLines Wrap ) |
3731 | 5327 |
('-' ) |
3781 | 5328 |
('Learn Macro' learnMode: LearnKeyboardMacro) |
5329 |
('Execute Macro' executeLearnedKeyboardMacro ExecuteKeyboardMacro ) |
|
3731 | 5330 |
('-' ) |
3811 | 5331 |
('Insert File...' insertFile ) |
5332 |
('Insert URL Contents...' insertURL ) |
|
3781 | 5333 |
('Insert new UUID' insertUUID ) |
5334 |
('Insert Date && Time' insertDateAndTime ) |
|
3732 | 5335 |
('-' ) |
5336 |
('Insert File as String Literal...' insertFileAsStringLiteral ) |
|
5337 |
('Paste as String Literal' pasteAsStringLiteral ) |
|
3731 | 5338 |
('-' ) |
5339 |
). |
|
3406
c5efa51e7929
dont offer CharacterSetView display in menu, if its not available.
Claus Gittinger <cg@exept.de>
parents:
3402
diff
changeset
|
5340 |
CharacterSetView notNil ifTrue:[ |
3731 | 5341 |
miscItems := miscItems , |
5342 |
#( |
|
5343 |
('Special Characters...' specialCharacters ) |
|
5344 |
). |
|
3406
c5efa51e7929
dont offer CharacterSetView display in menu, if its not available.
Claus Gittinger <cg@exept.de>
parents:
3402
diff
changeset
|
5345 |
]. |
c5efa51e7929
dont offer CharacterSetView display in menu, if its not available.
Claus Gittinger <cg@exept.de>
parents:
3402
diff
changeset
|
5346 |
miscItems := miscItems , |
3731 | 5347 |
#( |
5348 |
('Font...' changeFont ) |
|
2870 | 5349 |
"/ ('Encoding...' changeEncoding ) |
3731 | 5350 |
). |
2866 | 5351 |
|
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5352 |
translateItems := #( |
3731 | 5353 |
('English -> German' (babelFishTranslate: 'en_de') ) |
5354 |
('English -> French' (babelFishTranslate: 'en_fr') ) |
|
5355 |
('English -> Italian' (babelFishTranslate: 'en_it') ) |
|
5356 |
('English -> Spanish' (babelFishTranslate: 'en_es') ) |
|
5357 |
('English -> Portuguese' (babelFishTranslate: 'en_pt') ) |
|
5358 |
('-' ) |
|
5359 |
('German -> English' (babelFishTranslate: 'de_en') ) |
|
5360 |
('French -> English' (babelFishTranslate: 'fr_en') ) |
|
5361 |
('Italian -> English' (babelFishTranslate: 'it_en') ) |
|
5362 |
('Spanish -> English' (babelFishTranslate: 'es_en') ) |
|
5363 |
('Portuguese -> English' (babelFishTranslate: 'pt_en') ) |
|
5364 |
). |
|
3221 | 5365 |
|
5366 |
sortItems := #( |
|
3731 | 5367 |
('Lines' (sortSelection:ignoreCase: #lines false) ) |
5368 |
('Lines by First Word' (sortSelection:ignoreCase: #linesByFirstWord false) ) |
|
5369 |
('Lines by nth Word' (sortSelection:ignoreCase: #linesByNthWord false) ) |
|
5370 |
('Words' (sortSelection:ignoreCase: #words false) ) |
|
5371 |
('-' ) |
|
5372 |
('Lines (ignore case)' (sortSelection:ignoreCase: #lines true) ) |
|
5373 |
('Lines by First Word (ignore case)'(sortSelection:ignoreCase: #linesByFirstWord true) ) |
|
5374 |
('Lines by nth Word (ignore case)' (sortSelection:ignoreCase: #linesByNthWord true) ) |
|
5375 |
('Words (ignore case)' (sortSelection:ignoreCase: #words true) ) |
|
5376 |
). |
|
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5377 |
|
2762 | 5378 |
toolItems := #( |
3731 | 5379 |
('Indent' indent ) |
5380 |
('Sort' sort ) |
|
5381 |
('-' ) |
|
5382 |
('Google Spell' googleSpellingSuggestion ) |
|
5383 |
('Translate' babelFishTranslate ) |
|
5384 |
('Compare with Clipboard...' compareWithClipboard ) |
|
5385 |
). |
|
2762 | 5386 |
|
3623
f99c70d99425
close door to fileBrowser and workspace
Claus Gittinger <cg@exept.de>
parents:
3595
diff
changeset
|
5387 |
Smalltalk isStandAloneApp ifFalse:[ |
3731 | 5388 |
toolItems := toolItems , #( |
5389 |
('-' ) |
|
5390 |
('Open FileBrowser on It' openFileBrowserOnIt ) |
|
5391 |
('Open Workspace with It' openWorkspaceWithIt ) |
|
5392 |
). |
|
3623
f99c70d99425
close door to fileBrowser and workspace
Claus Gittinger <cg@exept.de>
parents:
3595
diff
changeset
|
5393 |
]. |
f99c70d99425
close door to fileBrowser and workspace
Claus Gittinger <cg@exept.de>
parents:
3595
diff
changeset
|
5394 |
|
2460 | 5395 |
sub := PopUpMenu itemList:items resources:resources performer:model. |
2461 | 5396 |
sub receiver:self. |
2460 | 5397 |
|
2919 | 5398 |
toolSub := PopUpMenu itemList:toolItems resources:resources performer:model. |
5399 |
toolSub receiver:self. |
|
5400 |
sub subMenuAt:#tools put:toolSub. |
|
5401 |
||
3495 | 5402 |
transSub := PopUpMenu itemList:translateItems resources:resources performer:model. |
5403 |
transSub receiver:self. |
|
5404 |
toolSub subMenuAt:#babelFishTranslate put:transSub. |
|
5405 |
||
5406 |
sortSub := PopUpMenu itemList:sortItems resources:resources performer:model. |
|
5407 |
sortSub receiver:self. |
|
5408 |
toolSub subMenuAt:#sort put:sortSub. |
|
3221 | 5409 |
|
2866 | 5410 |
subSub := PopUpMenu itemList:miscItems resources:resources performer:model. |
5411 |
subSub receiver:self. |
|
2952 | 5412 |
subSub checkToggleAt:#autoIndent: put:autoIndent. |
3235 | 5413 |
subSub checkToggleAt:#insertMode: put:(self isInInsertMode). |
2952 | 5414 |
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
|
5415 |
|
2866 | 5416 |
sub subMenuAt:#misc put:subSub. |
5417 |
||
3495 | 5418 |
mainItems := #( |
3731 | 5419 |
('Undo' undo Undo ) |
5420 |
('Again' again Again ) |
|
5421 |
('-' ) |
|
5422 |
('Cut' cut Cut ) |
|
5423 |
('Copy' copySelection Copy ) |
|
5424 |
('Paste' pasteOrReplace Paste ) |
|
5425 |
('-' ) |
|
5426 |
('Accept' accept Accept ) |
|
5427 |
('=' ) |
|
5428 |
('More' others Ctrl ) |
|
5429 |
). |
|
3495 | 5430 |
main := PopUpMenu itemList:mainItems resources:resources. |
5431 |
main subMenuAt:#others put:sub. |
|
5432 |
||
5433 |
sensor := self sensor. |
|
5434 |
(sensor notNil and:[sensor ctrlDown]) ifTrue:[ |
|
5435 |
sensor shiftDown ifTrue:[ |
|
3731 | 5436 |
m := subSub |
5437 |
] ifFalse:[ |
|
5438 |
m := sub |
|
5439 |
] |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5440 |
] ifFalse:[ |
3731 | 5441 |
m := main |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5442 |
]. |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5443 |
|
2676 | 5444 |
SOAP::GoogleClient isNil ifTrue:[ |
3731 | 5445 |
"/ GoogleClient new spellingSuggestionOf: 'Smmalltlaak and Soaap'. |
5446 |
m disable:#googleSpellingSuggestion |
|
2676 | 5447 |
]. |
5448 |
||
3811 | 5449 |
HTTPInterface isNil ifTrue:[ |
5450 |
m disableAll:#(insertURL) |
|
5451 |
]. |
|
5452 |
||
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
5453 |
self isReadOnly ifTrue:[ |
3731 | 5454 |
m disableAll:#(undo again multipleAgain redo |
5455 |
paste pasteOrReplace pasteOrReplaceFromHistory |
|
5456 |
cut indent autoIndent: insertMode: |
|
3811 | 5457 |
insertFile insertFileAsStringLiteral insertURL |
5458 |
babelFishTranslate googleSpellingSuggestion sort |
|
3731 | 5459 |
joinLines insertUUID insertDateAndTime pasteAsStringLiteral |
5460 |
specialCharacters) |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5461 |
]. |
2817 | 5462 |
self hasSelectionForCopy ifFalse:[ |
3731 | 5463 |
m disable:#copySelection. |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5464 |
]. |
2416
56acdd9e31b5
lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents:
2406
diff
changeset
|
5465 |
self hasSelection ifFalse:[ |
3731 | 5466 |
m disableAll:#(cut googleSpellingSuggestion babelFishTranslate openFileBrowserOnIt openWorkspaceWithIt sort indent). |
2762 | 5467 |
] ifTrue:[ |
3731 | 5468 |
(Error handle:[:ex | |
5469 |
ex return:false |
|
5470 |
] do:[ |
|
4042 | 5471 |
|fn| |
5472 |
fn := self selectionAsString. |
|
5473 |
fn asFilename exists or:[ fn withoutSeparators withoutQuotes asFilename exists ] |
|
3731 | 5474 |
]) ifFalse:[ |
5475 |
m disableAll:#(openFileBrowserOnIt). |
|
5476 |
] |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5477 |
]. |
2569 | 5478 |
self hasUndoAction ifFalse:[ |
3731 | 5479 |
m disable:#undo. |
3115 | 5480 |
] ifTrue:[ |
3731 | 5481 |
what := undoSupport undoActionInfo. |
5482 |
what notNil ifTrue:[ |
|
5483 |
undoIdx := m indexOf:#undo. |
|
5484 |
m labelAt:undoIdx put:(resources string:'Undo (%1)' with:what). |
|
5485 |
] |
|
1818
aa16d9b96e40
fixed cut to not compress multiple blanks.
Claus Gittinger <cg@exept.de>
parents:
1817
diff
changeset
|
5486 |
]. |
2952 | 5487 |
self hasRedoAction ifFalse:[ |
3731 | 5488 |
sub disable:#redo. |
3569
d3eec21d0ece
also show \"what-would-be-done\" in redo item
Claus Gittinger <cg@exept.de>
parents:
3566
diff
changeset
|
5489 |
] ifTrue:[ |
3731 | 5490 |
what := undoSupport redoActionInfo. |
5491 |
what notNil ifTrue:[ |
|
5492 |
redoIdx := sub indexOf:#redo. |
|
5493 |
sub labelAt:redoIdx put:(resources string:'Redo (%1)' with:what). |
|
5494 |
] |
|
2952 | 5495 |
]. |
1108 | 5496 |
acceptEnabled == false ifTrue:[ |
3731 | 5497 |
m disable:#accept |
1108 | 5498 |
]. |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5499 |
^ m. |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5500 |
|
3495 | 5501 |
"Modified: / 28-07-2007 / 13:15:38 / cg" |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5502 |
! |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5503 |
|
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5504 |
getTextSelectionFromHistory |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5505 |
|sel list box history| |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5506 |
|
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5507 |
history := device getCopyBufferHistory copy. |
3160 | 5508 |
list := history collect:[:entry | |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5509 |
|text shown| |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5510 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5511 |
text := entry asString string asCollectionOfLines. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5512 |
shown := text detect:[:line| line notEmptyOrNil] ifNone:[' ']. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5513 |
text size > 1 ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5514 |
shown := shown,(resources string:' ... [%1 lines]' with:text size). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5515 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5516 |
shown |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5517 |
]. |
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5518 |
box := ListSelectionBox |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5519 |
title:(resources string:'Clipboard History') |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5520 |
okText:(resources string:'Paste') |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5521 |
abortText:(resources string:'Cancel') |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5522 |
list:list |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5523 |
action:[:idx | idx notNil ifTrue:[sel := history at:idx]]. |
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5524 |
box useIndex:true. |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5525 |
box show. |
3160 | 5526 |
^ sel. |
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5527 |
! |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5528 |
|
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5529 |
getTextSelectionOrTextSelectionFromHistory |
2730
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
5530 |
|
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
5531 |
self sensor shiftDown ifTrue:[ |
3855 | 5532 |
^ self getTextSelectionFromHistory |
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5533 |
]. |
2724 | 5534 |
|
5535 |
"/ return either the (xterm-) selection or the clipBoard |
|
3160 | 5536 |
^ self |
3855 | 5537 |
getClipboardText:(self sensor ctrlDown |
5538 |
ifTrue:[#selection] |
|
5539 |
ifFalse:[#clipboard]) |
|
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5540 |
! |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5541 |
|
2676 | 5542 |
googleSpellingSuggestion |
5543 |
"insert the google-spelling suggestion for the selected text. |
|
5544 |
Requires that the SOAP stuff is loaded and working." |
|
5545 |
||
2677 | 5546 |
|text suggestion| |
2676 | 5547 |
|
5548 |
self withWaitCursorDo:[ |
|
3799 | 5549 |
text := self selection asString string withoutSeparators. |
5550 |
text size == 0 ifTrue:[^ self]. |
|
5551 |
||
5552 |
SOAP::SoapImplError handle:[:ex | |
|
5553 |
Dialog warn:('Spelling correction failed - WEB Service error:\\%1.' bindWith:ex description allBold) withCRs. |
|
5554 |
^ self. |
|
5555 |
] do:[ |
|
5556 |
suggestion := SOAP::GoogleClient new spellingSuggestionOf:text. |
|
5557 |
]. |
|
5558 |
suggestion size == 0 ifTrue:[ |
|
5559 |
Transcript showCR:'No SpellingSuggestion from Google for: ' , text. |
|
5560 |
^ self. |
|
5561 |
]. |
|
5562 |
]. |
|
5563 |
self |
|
5564 |
undoablePaste:suggestion |
|
5565 |
info:'Spelling Suggestion'. |
|
3495 | 5566 |
|
5567 |
"Modified: / 28-07-2007 / 13:25:10 / cg" |
|
2676 | 5568 |
! |
5569 |
||
3595 | 5570 |
insertDateAndTime |
5571 |
"insert the curent date and time string" |
|
5572 |
||
5573 |
typeOfSelection := nil. |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5574 |
self |
3786 | 5575 |
undoableDo:[ self pasteOrReplace:(Timestamp now printStringRFC1123Format)] |
3799 | 5576 |
info:'Paste Date and Time' |
3595 | 5577 |
! |
5578 |
||
2676 | 5579 |
insertFile |
3160 | 5580 |
"insert contents of a file |
2676 | 5581 |
- ask user for filename using a fileSelectionBox." |
5582 |
||
3731 | 5583 |
self insertFileAsStringLiteral:false |
5584 |
! |
|
5585 |
||
5586 |
insertFileAsStringLiteral |
|
5587 |
"insert a file's contents as a string literal. |
|
5588 |
Almost the same as the insert file, but single-quotes are doubled, |
|
5589 |
to make it a legal string literal" |
|
5590 |
||
5591 |
self insertFileAsStringLiteral:true |
|
5592 |
! |
|
5593 |
||
5594 |
insertFileAsStringLiteral:asStringLiteral |
|
5595 |
"insert contents of a file; either as-is or as a string literal. |
|
5596 |
- ask user for filename using a fileSelectionBox." |
|
5597 |
||
3409
d650e3ae9085
insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents:
3406
diff
changeset
|
5598 |
|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
|
5599 |
|
d650e3ae9085
insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents:
3406
diff
changeset
|
5600 |
((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
|
5601 |
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
|
5602 |
and:[ selFn isRegularFile ]]) |
d650e3ae9085
insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents:
3406
diff
changeset
|
5603 |
ifTrue:[ |
3731 | 5604 |
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
|
5605 |
]. |
2757
b98097eaf8dc
Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents:
2756
diff
changeset
|
5606 |
|
b98097eaf8dc
Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents:
2756
diff
changeset
|
5607 |
[ |
3731 | 5608 |
|why| |
5609 |
||
5610 |
file := Dialog |
|
5611 |
requestFileName:(resources string:'Insert Contents Of:') |
|
5612 |
default:initial |
|
5613 |
ok:(resources string:'Insert') |
|
5614 |
abort:(resources string:'Cancel') |
|
5615 |
pattern:nil |
|
5616 |
fromDirectory:directoryForFileDialog. |
|
5617 |
file isNil ifTrue:[ |
|
5618 |
"cancel" |
|
5619 |
^ self. |
|
5620 |
]. |
|
5621 |
file := file asFilename. |
|
5622 |
directoryForFileDialog := file. |
|
5623 |
||
5624 |
ok := file isReadable and:[file isDirectory not]. |
|
5625 |
ok ifFalse:[ |
|
5626 |
file isReadable ifFalse:[ |
|
5627 |
why := '%1 is unreadable.\\Please try again.' |
|
5628 |
] ifTrue:[ |
|
5629 |
why := '%1 is a directory.\\Please try again.' |
|
5630 |
]. |
|
5631 |
Dialog warn:(resources stringWithCRs:why with:file pathName). |
|
5632 |
]. |
|
2909 | 5633 |
] doUntil:[ok]. |
2757
b98097eaf8dc
Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents:
2756
diff
changeset
|
5634 |
|
b98097eaf8dc
Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents:
2756
diff
changeset
|
5635 |
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
|
5636 |
self |
3786 | 5637 |
undoableDo:[ self paste:(asStringLiteral ifTrue:[text storeString] ifFalse:[text]) ] |
3799 | 5638 |
info:'Paste File' |
3495 | 5639 |
|
5640 |
"Modified: / 28-07-2007 / 13:23:32 / cg" |
|
5641 |
! |
|
5642 |
||
3811 | 5643 |
insertURL |
5644 |
"insert contents of a URL |
|
5645 |
- ask user for URL using a dialog." |
|
5646 |
||
5647 |
self insertURLAsStringLiteral:false |
|
5648 |
! |
|
5649 |
||
5650 |
insertURLAsStringLiteral:asStringLiteral |
|
5651 |
"insert contents of a file; either as-is or as a string literal. |
|
5652 |
- ask user for filename using a fileSelectionBox." |
|
5653 |
||
5654 |
|sel url text response initial| |
|
5655 |
||
5656 |
(sel := self selectionAsString) notEmptyOrNil |
|
5657 |
ifTrue:[ |
|
5658 |
initial := sel. |
|
5659 |
]. |
|
5660 |
||
5661 |
url := Dialog |
|
5662 |
request:(resources string:'Insert Contents of URL:') |
|
5663 |
initialAnswer:initial |
|
5664 |
okLabel:(resources string:'Insert') |
|
5665 |
title:(resources string:'URL'). |
|
5666 |
url isNil ifTrue:[ |
|
5667 |
"cancel" |
|
5668 |
^ self. |
|
5669 |
]. |
|
5670 |
response := HTTPInterface get:url. |
|
5671 |
response isErrorResponse ifTrue:[ |
|
5672 |
Dialog warn:(resources string:'Could not fetch the document: %1' with:url). |
|
5673 |
^ self. |
|
5674 |
]. |
|
5675 |
text := response data asString. |
|
5676 |
||
5677 |
self |
|
5678 |
undoableDo:[ |
|
5679 |
self paste:(asStringLiteral ifTrue:[text storeString] ifFalse:[text]) |
|
5680 |
] |
|
5681 |
info:'Insert Contents of URL' |
|
5682 |
! |
|
5683 |
||
3495 | 5684 |
insertUUID |
5685 |
"insert a new UUID's string" |
|
5686 |
||
5687 |
typeOfSelection := nil. |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5688 |
self |
3786 | 5689 |
undoableDo:[ self pasteOrReplace:(UUID genUUID printString)] |
3799 | 5690 |
info:'Paste New UUID' |
3495 | 5691 |
|
5692 |
"Created: / 28-07-2007 / 13:01:16 / cg" |
|
2676 | 5693 |
! |
5694 |
||
2762 | 5695 |
openFileBrowserOnIt |
5696 |
"open a fileBrowser on the selected fileName" |
|
5697 |
||
5698 |
|fn dir| |
|
5699 |
||
5700 |
fn := self selectionAsString asFilename. |
|
5701 |
fn exists ifFalse:[ |
|
4042 | 5702 |
fn := self selectionAsString withoutSeparators withoutQuotes asFilename. |
5703 |
fn exists ifFalse:[ |
|
5704 |
^ self warn:'Oops - file is gone'. |
|
5705 |
]. |
|
2762 | 5706 |
]. |
5707 |
(dir := fn) isDirectory ifFalse:[ |
|
4042 | 5708 |
dir := fn directory |
2762 | 5709 |
]. |
5710 |
UserPreferences fileBrowserClass openOn:dir |
|
5711 |
! |
|
5712 |
||
3483
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5713 |
openWorkspaceWithIt |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5714 |
"open a workspace containing the selected text" |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5715 |
|
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5716 |
|text| |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5717 |
|
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5718 |
text := self selectionAsString. |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5719 |
WorkspaceApplication openWith:text selected:true |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5720 |
|
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5721 |
"Created: / 26-05-2007 / 06:05:22 / cg" |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5722 |
! |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5723 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5724 |
paste |
1289 | 5725 |
"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
|
5726 |
Then paste at cursor position." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5727 |
|
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
5728 |
self checkModificationsAllowed ifTrue:[ |
3160 | 5729 |
self withSelfAndTextForPasteDo:[:me :text | |
5730 |
me unselect. |
|
5731 |
me undoablePaste:text |
|
5732 |
] |
|
2952 | 5733 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5734 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5735 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5736 |
paste:someText |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5737 |
"paste someText at cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5738 |
|
3825 | 5739 |
self paste:someText withCR:false |
5740 |
! |
|
5741 |
||
5742 |
paste:someText withCR:withCR |
|
5743 |
"paste someText at cursor" |
|
5744 |
||
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
5745 |
|s nLines startLine startCol l1 l2 c1 c2 codingErrorReported| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5746 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
5747 |
self checkModificationsAllowed ifFalse:[^ self]. |
2853
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5748 |
someText isNil ifTrue:[^ self]. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5749 |
|
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5750 |
s := someText. |
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
5751 |
codingErrorReported := false. |
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
5752 |
CharacterEncoderError handle:[:ex | |
3825 | 5753 |
|code msg| |
5754 |
||
5755 |
code := ex parameter. |
|
5756 |
codingErrorReported ifFalse:[ |
|
5757 |
msg := 'Cannot represent pasted string in this Views encoding (',characterEncoding,').'. |
|
5758 |
code notNil ifTrue:[ |
|
5759 |
msg := msg , '\\Reason: No representation for ' , (code radixPrintStringRadix:16). |
|
5760 |
]. |
|
5761 |
Dialog warn:(resources stringWithCRs:msg). |
|
5762 |
codingErrorReported := true. |
|
5763 |
]. |
|
5764 |
ex proceedWith:ex defaultValue |
|
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
5765 |
] do:[ |
3825 | 5766 |
s isString ifTrue:[ |
5767 |
s encoding ~~ characterEncoding ifTrue:[ |
|
5768 |
s := s encodeFrom:(s encoding) into:characterEncoding. |
|
5769 |
]. |
|
5770 |
||
5771 |
s := s asStringCollection. |
|
5772 |
(someText endsWith:Character cr) ifTrue:[ |
|
5773 |
"/ s := s copyWith:nil. |
|
5774 |
s := s copyWith:'' "/ an empty line at the end |
|
5775 |
||
5776 |
] |
|
5777 |
] ifFalse:[ |
|
5778 |
s isStringCollection ifTrue:[ |
|
5779 |
s := s encodeFrom:(s encoding) into:characterEncoding. |
|
5780 |
] ifFalse:[ |
|
5781 |
(self |
|
5782 |
confirm:(resources |
|
5783 |
stringWithCRs:'Selection (%1) is not convertable to Text.\\Paste storeString ?' |
|
5784 |
with:s class name)) ifFalse:[^ self]. |
|
5785 |
s := StringCollection with:s storeString . |
|
5786 |
"/ ^ self |
|
5787 |
]. |
|
5788 |
]. |
|
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
5789 |
]. |
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
5790 |
|
2853
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5791 |
(nLines := s size) == 0 ifTrue:[^ self]. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5792 |
(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
|
5793 |
|
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5794 |
typeOfSelection := #paste. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5795 |
|
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5796 |
startLine := l1 := cursorLine. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5797 |
startCol := c1 := cursorCol. |
3180 | 5798 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5799 |
"do not expand tabs in s here - |
3180 | 5800 |
they get expanded in basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr. |
5801 |
Some Subviews want to paste with unexpanded tabs!!" |
|
5802 |
||
3825 | 5803 |
self insertLines:s withCR:withCR. |
2853
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5804 |
l2 := cursorLine. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5805 |
c2 := (cursorCol - 1). |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5806 |
self selectFromLine:l1 col:c1 toLine:l2 col:c2. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5807 |
typeOfSelection := #paste. "/ sigh - cleared by #selectFromLine: |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5808 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
5809 |
"Modified: / 14.2.1996 / 11:14:14 / stefan" |
2107
9d44232af0a0
textSelection fixes (added newLine) for MSDOS;
Claus Gittinger <cg@exept.de>
parents:
2101
diff
changeset
|
5810 |
"Modified: / 30.1.2000 / 02:32:42 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5811 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5812 |
|
3731 | 5813 |
pasteAsStringLiteral |
5814 |
"insert clipboard string as a string literal. |
|
5815 |
Almost the same as a normal paste, but single-quotes are doubled, |
|
5816 |
to make it a legal string literal" |
|
5817 |
||
5818 |
typeOfSelection := nil. |
|
5819 |
self |
|
3786 | 5820 |
undoableDo:[ self pasteOrReplace:(self getClipboardText storeString) ] |
5821 |
info:'Paste as String Literal' |
|
3731 | 5822 |
! |
5823 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5824 |
pasteOrReplace |
1289 | 5825 |
"paste the copybuffer; if there is a selection, replace it. |
3160 | 5826 |
otherwise paste at cursor position. |
5827 |
Replace is not done for selections which were created by a paste, |
|
2010 | 5828 |
to allow multiple paste operations in a row." |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5829 |
|
2724 | 5830 |
self withSelfAndTextForPasteDo:[:me :text | me pasteOrReplace:text] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5831 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5832 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5833 |
pasteOrReplace:someText |
1289 | 5834 |
"paste someText; if there is a selection, replace it. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5835 |
otherwise paste at cursor position. Replace is not done |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5836 |
for originating by a paste, to allow multiple |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5837 |
paste." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5838 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
5839 |
self checkModificationsAllowed ifFalse:[^ self]. |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
5840 |
|
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
5841 |
self undoableDo:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5842 |
((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
|
5843 |
self replace:someText |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5844 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5845 |
self paste:someText. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5846 |
] |
3542 | 5847 |
] info:'Paste/Replace'. |
1289 | 5848 |
|
2107
9d44232af0a0
textSelection fixes (added newLine) for MSDOS;
Claus Gittinger <cg@exept.de>
parents:
2101
diff
changeset
|
5849 |
"Modified: / 30.1.2000 / 02:33:00 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5850 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5851 |
|
3474
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5852 |
pasteOrReplaceFromHistory |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5853 |
"paste a previous item from the copybuffer history. |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5854 |
(i.e. repaste some previously deleted or copied text)" |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5855 |
|
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5856 |
|text| |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5857 |
|
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5858 |
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
|
5859 |
self flash. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5860 |
^ self |
3474
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5861 |
]. |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5862 |
text := self getTextSelectionFromHistory. |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5863 |
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
|
5864 |
self pasteOrReplace:text |
3474
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5865 |
] |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5866 |
! |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5867 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5868 |
replace |
1289 | 5869 |
"replace the selection by the contents of the copybuffer" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5870 |
|
3269
03d04670a5d2
replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5871 |
self hasSelection ifFalse:[^ self]. |
03d04670a5d2
replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5872 |
self checkModificationsAllowed ifFalse:[^ self]. |
03d04670a5d2
replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5873 |
|
03d04670a5d2
replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5874 |
self withSelfAndTextForPasteDo:[:me :text | |
3786 | 5875 |
me undoableDo:[ me replace:text ] |
5876 |
info:'Replace' |
|
2952 | 5877 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5878 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5879 |
|
121 | 5880 |
replace:someText |
1289 | 5881 |
"replace the selection by someText" |
121 | 5882 |
|
3160 | 5883 |
|selected selectedString |
5884 |
selStartLine selStartCol selEndLine selEndCol| |
|
121 | 5885 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
5886 |
self checkModificationsAllowed ifFalse:[^ self]. |
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
5887 |
|
3130 | 5888 |
self undoableDo:[ |
4010 | 5889 |
selected := self selection. |
5890 |
selected isNil ifTrue:[ |
|
5891 |
^ self paste:someText |
|
5892 |
]. |
|
5893 |
||
5894 |
self deleteSelection. |
|
5895 |
||
5896 |
"take care, if we replace a selection without space by a word selected |
|
5897 |
with one - in this case we usually do not want the space. |
|
5898 |
But, if we replace a word-selected selection by something without a |
|
5899 |
space, we DO want the space added." |
|
5900 |
||
5901 |
selected size == 1 ifTrue:[ |
|
5902 |
selectedString := selected at:1. |
|
5903 |
]. |
|
5904 |
||
5905 |
someText size == 1 ifTrue:[ |
|
5906 |
|cutOffSpace addSpace replacement replacementString| |
|
5907 |
||
5908 |
cutOffSpace := false. |
|
5909 |
addSpace := false. |
|
5910 |
replacement := someText copyFrom:1. |
|
5911 |
||
5912 |
selectedString notNil ifTrue:[ |
|
5913 |
((selectedString startsWith:' ') or:[selectedString endsWith:' ']) ifFalse:[ |
|
5914 |
"selection has no space" |
|
5915 |
||
5916 |
((selectStyle == #wordleft) or:[selectStyle == #wordRight]) ifTrue:[ |
|
5917 |
cutOffSpace := true |
|
5918 |
] |
|
5919 |
] ifTrue:[ |
|
5920 |
addSpace := true |
|
5921 |
] |
|
5922 |
]. |
|
5923 |
replacementString := replacement at:1. |
|
5924 |
cutOffSpace ifTrue:[ |
|
5925 |
(replacementString startsWith:' ') ifTrue:[ |
|
5926 |
replacementString := replacementString withoutSpaces |
|
5927 |
]. |
|
5928 |
] ifFalse:[ |
|
5929 |
selectStyle == #wordLeft ifTrue:[ |
|
5930 |
"want a space at left" |
|
5931 |
(replacementString startsWith:' ') ifFalse:[ |
|
5932 |
replacementString := replacementString withoutSpaces. |
|
5933 |
replacementString := ' ' , replacementString |
|
5934 |
] |
|
5935 |
]. |
|
5936 |
selectStyle == #wordRight ifTrue:[ |
|
5937 |
"want a space at right" |
|
5938 |
||
5939 |
(replacementString endsWith:' ') ifFalse:[ |
|
5940 |
replacementString := replacementString withoutSpaces. |
|
5941 |
replacementString := replacementString , ' ' |
|
5942 |
] |
|
5943 |
]. |
|
5944 |
]. |
|
5945 |
replacement at:1 put: replacementString. |
|
5946 |
self paste:replacement. |
|
5947 |
] ifFalse:[ |
|
5948 |
self paste:someText |
|
5949 |
]. |
|
5950 |
lastStringToReplace := selectedString. |
|
5951 |
lastStringFromReplace := lastStringToReplace. |
|
5952 |
lastReplacement := someText. |
|
5953 |
||
5954 |
selStartLine := selectionStartLine. |
|
5955 |
selStartCol := self selectionStartCol. |
|
5956 |
selEndLine := selectionEndLine. |
|
5957 |
selEndCol := self selectionEndCol. |
|
3130 | 5958 |
] |
3542 | 5959 |
info:'Replace' |
362
3993ba6c31a0
Expand tabs before pasting a string.
Stefan Vogel <sv@exept.de>
parents:
331
diff
changeset
|
5960 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
5961 |
"Modified: / 14.2.1996 / 10:37:02 / stefan" |
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
5962 |
"Modified: / 5.4.1998 / 16:55:28 / cg" |
121 | 5963 |
! |
5964 |
||
3430 | 5965 |
searchReplace |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5966 |
"search for a string - show a box to enter searchpattern |
3430 | 5967 |
replace for the found searchpattern or replace all searchpattern found to a new pattern - show a box to enter replacepattern |
5968 |
- 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
|
5969 |
|
3430 | 5970 |
|searchBox patternHolder replacePatternHolder caseHolder flag ign initialString bindings bldr search modal replace action| |
5971 |
||
5972 |
modal := false "(UserPreferences current searchDialogIsModal)". |
|
5973 |
lastSearchDirection := #forward. |
|
5974 |
ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. |
|
5975 |
caseHolder := ign asValue. |
|
5976 |
patternHolder := '' asValue. |
|
5977 |
replacePatternHolder := '' asValue. |
|
5978 |
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
|
5979 |
initialString := lastSearchPattern |
3430 | 5980 |
]. |
5981 |
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
|
5982 |
initialString := self selectionAsString |
3430 | 5983 |
]. |
5984 |
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
|
5985 |
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
|
5986 |
initialString := LastSearchPatterns first |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5987 |
] |
3430 | 5988 |
]. |
5989 |
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
|
5990 |
patternHolder value:initialString. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5991 |
replacePatternHolder value:initialString. |
3430 | 5992 |
]. |
5993 |
flag := true. |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5994 |
search := [:fwd | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5995 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5996 |
search:patternHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5997 |
ignoreCase:caseHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5998 |
forward:fwd. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5999 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6000 |
replace := [:all | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6001 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6002 |
replace:patternHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6003 |
by:replacePatternHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6004 |
all:all |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6005 |
ignoreCase:caseHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6006 |
]. |
3430 | 6007 |
bindings := IdentityDictionary new. |
6008 |
bindings at:#searchPattern put:patternHolder. |
|
6009 |
bindings at:#replacePattern put:replacePatternHolder. |
|
6010 |
modal ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6011 |
bindings at:#nextAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6012 |
put:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6013 |
flag := true. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6014 |
action := search. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6015 |
searchBox doAccept. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6016 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6017 |
bindings at:#prevAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6018 |
put:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6019 |
flag := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6020 |
action := search. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6021 |
searchBox doAccept. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6022 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6023 |
bindings at:#replaceAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6024 |
put:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6025 |
flag := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6026 |
action := replace. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6027 |
searchBox doAccept. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6028 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6029 |
bindings at:#replaceAllAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6030 |
put:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6031 |
flag := true. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6032 |
action := replace. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6033 |
searchBox doAccept. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6034 |
]. |
3430 | 6035 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6036 |
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
|
6037 |
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
|
6038 |
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
|
6039 |
bindings at:#replaceAllAction put:[ replace value:true. ]. |
3430 | 6040 |
]. |
6041 |
bindings at:#ignoreCase put:caseHolder. |
|
6042 |
bindings at:#patternList put:LastSearchPatterns. |
|
6043 |
modal ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6044 |
searchBox := SimpleDialog new. |
3430 | 6045 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6046 |
searchBox := ApplicationModel new. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6047 |
searchBox createBuilder. |
3430 | 6048 |
]. |
6049 |
searchBox resources:(self resources). |
|
6050 |
bldr := searchBox builder. |
|
6051 |
bldr addBindings:bindings. |
|
6052 |
searchBox allButOpenFrom:(self class searchReplaceDialogSpec). |
|
6053 |
(bldr componentAt:#nextButton) cursor:(Cursor thumbsUp). |
|
6054 |
(bldr componentAt:#prevButton) cursor:(Cursor thumbsUp). |
|
6055 |
(bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown). |
|
6056 |
modal ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6057 |
searchBox openDialog. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6058 |
searchBox accepted ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6059 |
action value:flag |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6060 |
]. |
3430 | 6061 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6062 |
(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
|
6063 |
(bldr componentAt:#cancelButton) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6064 |
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
|
6065 |
action:[ searchBox closeRequest ]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6066 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6067 |
"/ 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
|
6068 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6069 |
self topView beMaster. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6070 |
(searchBox window) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6071 |
beSlave; |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6072 |
openInGroup:(self windowGroup). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6073 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6074 |
"/ searchBox window open. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6075 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6076 |
searchBox window assignKeyboardFocusToFirstInputField. |
3430 | 6077 |
] |
6078 |
||
6079 |
"Modified: / 11-07-2006 / 11:20:06 / fm" |
|
6080 |
! |
|
6081 |
||
121 | 6082 |
showDeleted |
6083 |
"open a readonly editor on all deleted text" |
|
6084 |
||
6085 |
|v| |
|
6086 |
||
6087 |
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
|
6088 |
v readOnly:true. |
121 | 6089 |
v topView label:'deleted text'. |
2624
22d352e56c27
preps for special characters
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6090 |
! |
22d352e56c27
preps for special characters
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6091 |
|
3221 | 6092 |
sort:how ignoreCase:ignoreCase fromLine:start toLine:end |
6093 |
"sort the selected lines" |
|
6094 |
||
6095 |
|lines extractor fetcher lineWise nStr n s words| |
|
6096 |
||
6097 |
lineWise := true. |
|
6098 |
||
6099 |
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
|
6100 |
extractor := [:l | l withoutLeadingSeparators]. |
3221 | 6101 |
] 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
|
6102 |
extractor := [:l | ((l asCollectionOfWords select:[:w | w isEmpty or:[w first isLetterOrDigit]]) at:1 ifAbsent:'')]. |
3221 | 6103 |
] 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
|
6104 |
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
|
6105 |
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
|
6106 |
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
|
6107 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6108 |
extractor := [:l | ((l asCollectionOfWords) at:n ifAbsent:'')]. |
3221 | 6109 |
] 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
|
6110 |
lineWise := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6111 |
extractor := [:w | w]. |
3221 | 6112 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6113 |
self error:'unknown sort criteria: ', how printString. |
3221 | 6114 |
]]]]. |
6115 |
||
6116 |
ignoreCase ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6117 |
fetcher := [:l | (extractor value:l) asLowercase]. |
3221 | 6118 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6119 |
fetcher := extractor. |
3221 | 6120 |
]. |
6121 |
||
6122 |
lineWise ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6123 |
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
|
6124 |
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
|
6125 |
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
|
6126 |
(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
|
6127 |
self textChanged. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6128 |
^ self. |
3221 | 6129 |
]. |
6130 |
||
6131 |
s := self selectionAsString. |
|
6132 |
words := s asCollectionOfWords. |
|
6133 |
words := words sort:[:w1 :w2 | (fetcher value:w1) < (fetcher value:w2)]. |
|
6134 |
s := words asStringCollection asStringWith:Character space. |
|
6135 |
self replace:s. |
|
6136 |
self textChanged. |
|
6137 |
! |
|
6138 |
||
6139 |
sortSelection:how ignoreCase:ignoreCase |
|
6140 |
"sort the selected lines" |
|
6141 |
||
6142 |
|start end| |
|
6143 |
||
6144 |
selectionStartLine isNil ifTrue:[^ self]. |
|
6145 |
||
6146 |
start := selectionStartLine. |
|
6147 |
end := selectionEndLine. |
|
6148 |
(selectionEndCol == 0) ifTrue:[ |
|
3786 | 6149 |
end := end - 1 |
3221 | 6150 |
]. |
6151 |
||
6152 |
self |
|
3786 | 6153 |
undoableDo:[ self sort:how ignoreCase:ignoreCase fromLine:start toLine:end ] |
6154 |
info:'Sort' |
|
3221 | 6155 |
! |
6156 |
||
2624
22d352e56c27
preps for special characters
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6157 |
specialCharacters |
2915 | 6158 |
CharacterSetView |
3160 | 6159 |
openAsInputFor:self |
6160 |
label:'Special Character Input' |
|
6161 |
clickLabel:'Click to Insert Character'. |
|
2866 | 6162 |
! |
6163 |
||
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
6164 |
undoablePaste:someText |
3495 | 6165 |
self undoablePaste:someText info:nil. |
6166 |
||
6167 |
"Modified: / 28-07-2007 / 13:25:46 / cg" |
|
6168 |
! |
|
6169 |
||
6170 |
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
|
6171 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6172 |
undoableDo:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6173 |
self paste:someText. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6174 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6175 |
info:infoOrNil |
3495 | 6176 |
|
6177 |
"Created: / 28-07-2007 / 13:25:30 / cg" |
|
6178 |
! |
|
6179 |
||
6180 |
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
|
6181 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6182 |
undoableDo:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6183 |
self pasteOrReplace:someText. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6184 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6185 |
info:infoOrNil |
3495 | 6186 |
|
6187 |
"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
|
6188 |
! |
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
6189 |
|
2724 | 6190 |
withSelfAndTextForPasteDo:aBlock |
6191 |
"common code for paste/replace of the copybuffer" |
|
6192 |
||
6193 |
|sel| |
|
6194 |
||
6195 |
self checkModificationsAllowed ifFalse:[ |
|
3160 | 6196 |
self flash. |
6197 |
^ self |
|
2724 | 6198 |
]. |
6199 |
||
6200 |
sel := self getTextSelectionOrTextSelectionFromHistory. |
|
6201 |
sel notNil ifTrue:[ |
|
3160 | 6202 |
aBlock value:self value:sel. |
2724 | 6203 |
] |
105 | 6204 |
! ! |
6205 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6206 |
!EditTextView methodsFor:'private'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6207 |
|
3880 | 6208 |
beep |
6209 |
UserPreferences current beepInEditor ifTrue:[ |
|
6210 |
super beep |
|
6211 |
] |
|
6212 |
! |
|
6213 |
||
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
6214 |
checkModificationsAllowed |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
6215 |
"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
|
6216 |
evaluate the exceptionBlock if not. |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
6217 |
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
|
6218 |
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
|
6219 |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
6220 |
self isReadOnly ifTrue: [ |
3160 | 6221 |
exceptionBlock isNil ifTrue:[ |
6222 |
^ false |
|
6223 |
]. |
|
6224 |
||
6225 |
(exceptionBlock value:'Text may not be modified') ~~ true ifTrue:[ |
|
6226 |
^ false |
|
6227 |
] |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
6228 |
]. |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
6229 |
^ true |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
6230 |
|
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
6231 |
"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
|
6232 |
! |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
6233 |
|
2596 | 6234 |
currentSelectionBgColor |
6235 |
typeOfSelection == #paste ifTrue:[ |
|
3160 | 6236 |
^ DefaultAlternativeSelectionBackgroundColor ? selectionBgColor |
2596 | 6237 |
]. |
6238 |
^ super currentSelectionBgColor |
|
6239 |
||
6240 |
" |
|
6241 |
DefaultAlternativeSelectionBackgroundColor := Color yellow blendWith:Color green |
|
6242 |
" |
|
6243 |
! |
|
6244 |
||
6245 |
currentSelectionFgColor |
|
6246 |
typeOfSelection == #paste ifTrue:[ |
|
3160 | 6247 |
^ DefaultAlternativeSelectionForegroundColor ? selectionFgColor |
2596 | 6248 |
]. |
6249 |
^ super currentSelectionFgColor |
|
6250 |
! |
|
6251 |
||
3996 | 6252 |
resetVariablesBeforeNewSearch |
6253 |
||
6254 |
super resetVariablesBeforeNewSearch. |
|
6255 |
||
6256 |
"/ new search invalidates remembered string |
|
4010 | 6257 |
lastStringFromReplace := nil. |
3996 | 6258 |
! |
6259 |
||
2647
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
6260 |
st80EditMode |
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
6261 |
^ st80Mode ? (UserPreferences current st80EditMode) |
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
6262 |
! |
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
6263 |
|
2225
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6264 |
suppressEmphasisInSelection |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6265 |
"selection is shown without emphasis" |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6266 |
|
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6267 |
^ true |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6268 |
! |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6269 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6270 |
textChanged |
522 | 6271 |
"my text was modified (internally). |
6272 |
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
|
6273 |
contentsChanged, which is triggered when the size has changed, and |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6274 |
is used to notify scrollers, other views etc.)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6275 |
|
641 | 6276 |
self contentsChanged. |
1015 | 6277 |
self modified:true. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6278 |
contentsWasSaved := false |
641 | 6279 |
|
1015 | 6280 |
"Modified: 14.2.1997 / 16:58:38 / cg" |
2207 | 6281 |
! |
6282 |
||
2617 | 6283 |
textChangedButNoSizeChange |
2207 | 6284 |
"my text was modified (internally). |
6285 |
Sent whenever text has been edited (not to confuse with |
|
6286 |
contentsChanged, which is triggered when the size has changed, and |
|
6287 |
is used to notify scrollers, other views etc.)" |
|
6288 |
||
6289 |
self modified:true. |
|
6290 |
contentsWasSaved := false |
|
6291 |
||
6292 |
"Modified: 14.2.1997 / 16:58:38 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6293 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6294 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6295 |
!EditTextView methodsFor:'queries'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6296 |
|
1526
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6297 |
currentLine |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6298 |
"the current line (for relative gotos)" |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6299 |
|
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6300 |
^ cursorLine |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6301 |
|
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6302 |
"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
|
6303 |
! |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6304 |
|
1878 | 6305 |
isKeyboardConsumer |
6306 |
"return true, if the receiver is a keyboard consumer; |
|
6307 |
Return true here, redefined from SimpleView." |
|
6308 |
||
3476 | 6309 |
^ self isReadOnly not |
1878 | 6310 |
! |
6311 |
||
997 | 6312 |
specClass |
1390 | 6313 |
"redefined, since the name of my specClass is nonStandard (i.e. not EditTextSpec)" |
6314 |
||
997 | 6315 |
self class == EditTextView ifTrue:[^ TextEditorSpec]. |
1049 | 6316 |
^ super specClass |
6317 |
||
1390 | 6318 |
"Modified: / 31.10.1997 / 19:48:19 / cg" |
997 | 6319 |
! |
6320 |
||
324 | 6321 |
tabMeansNextField |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
6322 |
"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
|
6323 |
|
313
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
6324 |
"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
|
6325 |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
6326 |
^ self isReadOnly or:[tabMeansNextField] |
324 | 6327 |
|
6328 |
"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
|
6329 |
! |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
6330 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6331 |
widthOfContents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6332 |
"return the width of the contents in pixels |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6333 |
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
|
6334 |
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
|
6335 |
line (and possibly see the cursor behind the line)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6336 |
|
697 | 6337 |
|w dev| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6338 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6339 |
w := super widthOfContents. |
697 | 6340 |
(dev := device) isNil ifTrue:[ |
3160 | 6341 |
"/ really dont know ... |
6342 |
dev := Screen current |
|
606
682579fa3b62
fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
6343 |
]. |
697 | 6344 |
^ w + (font widthOn:dev) |
6345 |
||
6346 |
"Modified: 28.5.1996 / 19:32:25 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6347 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6348 |
|
1588 | 6349 |
!EditTextView methodsFor:'realization'! |
6350 |
||
6351 |
realize |
|
6352 |
"make the view visible - scroll to make the cursor visible." |
|
6353 |
||
6354 |
super realize. |
|
6355 |
||
6356 |
self makeCursorVisible. |
|
1993 | 6357 |
cursorFgColor := cursorFgColor onDevice:device. |
6358 |
cursorBgColor := cursorBgColor onDevice:device. |
|
1588 | 6359 |
|
6360 |
"Modified: 20.12.1996 / 14:16:05 / cg" |
|
6361 |
"Created: 24.7.1997 / 18:24:12 / cg" |
|
6362 |
! ! |
|
6363 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6364 |
!EditTextView methodsFor:'redrawing'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6365 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6366 |
redrawCursorIfBetweenVisibleLine:startVisLine and:endVisLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6367 |
"redraw the cursor, if it sits in a line range" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6368 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6369 |
cursorShown ifTrue:[ |
3160 | 6370 |
cursorVisibleLine notNil ifTrue:[ |
6371 |
(cursorVisibleLine between:startVisLine and:endVisLine) ifTrue:[ |
|
6372 |
self drawCursorCharacter |
|
6373 |
] |
|
6374 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6375 |
] |
105 | 6376 |
! |
6377 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6378 |
redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6379 |
"redraw the cursor, if it sits in visible line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6380 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6381 |
cursorShown ifTrue:[ |
3160 | 6382 |
(visLine == cursorVisibleLine) ifTrue:[ |
6383 |
self drawCursorCharacter |
|
6384 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6385 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6386 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6387 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6388 |
redrawFromVisibleLine:startVisLine to:endVisLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6389 |
"redraw a visible line range" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6390 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6391 |
super redrawFromVisibleLine:startVisLine to:endVisLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6392 |
self redrawCursorIfBetweenVisibleLine:startVisLine and:endVisLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6393 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6394 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6395 |
redrawVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6396 |
"redraw a visible line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6397 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6398 |
super redrawVisibleLine:visLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6399 |
self redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6400 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6401 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6402 |
redrawVisibleLine:visLine col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6403 |
"redraw the single character in visibleline at colNr" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6404 |
|
3510
4bd0b20bd05d
cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents:
3495
diff
changeset
|
6405 |
super redrawVisibleLine:visLine col:colNr. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6406 |
cursorShown ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6407 |
(visLine == cursorVisibleLine) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6408 |
(colNr == cursorCol) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6409 |
self drawCursorCharacter. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6410 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6411 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6412 |
] |
3510
4bd0b20bd05d
cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents:
3495
diff
changeset
|
6413 |
]. |
4bd0b20bd05d
cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents:
3495
diff
changeset
|
6414 |
|
4bd0b20bd05d
cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents:
3495
diff
changeset
|
6415 |
"Modified: / 05-11-2007 / 17:35:53 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6416 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6417 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6418 |
redrawVisibleLine:visLine from:startCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6419 |
"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
|
6420 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6421 |
super redrawVisibleLine:visLine from:startCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6422 |
self redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6423 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6424 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6425 |
redrawVisibleLine:visLine from:startCol to:endCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6426 |
"redraw a visible line from startCol to endCol" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6427 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6428 |
super redrawVisibleLine:visLine from:startCol to:endCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6429 |
self redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6430 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6431 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6432 |
!EditTextView methodsFor:'scrolling'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6433 |
|
2331
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6434 |
additionalMarginForHorizontalScroll |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6435 |
"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
|
6436 |
width of the document would allow. |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6437 |
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
|
6438 |
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
|
6439 |
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
|
6440 |
|
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6441 |
^ 10 max:font width |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6442 |
! |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6443 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6444 |
halfPageDown |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6445 |
"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
|
6446 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6447 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6448 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6449 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6450 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6451 |
super halfPageDown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6452 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6453 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6454 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6455 |
halfPageUp |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6456 |
"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
|
6457 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6458 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6459 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6460 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6461 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6462 |
super halfPageUp. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6463 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6464 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6465 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6466 |
originChanged:delta |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6467 |
"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
|
6468 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6469 |
super originChanged:delta. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6470 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6471 |
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
|
6472 |
" |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
6473 |
self updateCursorVisibleLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6474 |
prevCursorState ifTrue:[ |
3160 | 6475 |
self showCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6476 |
] |
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
6477 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
6478 |
"Modified: / 17.6.1998 / 16:13:24 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6479 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6480 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6481 |
originWillChange |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6482 |
"sent before scrolling - have to hide the cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6483 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6484 |
prevCursorState := cursorShown. |
1601 | 6485 |
"/ cursorShown := false. |
1591 | 6486 |
cursorShown ifTrue:[ |
3160 | 6487 |
self hideCursor |
1591 | 6488 |
] |
6489 |
||
1601 | 6490 |
"Modified: / 6.7.1998 / 13:07:23 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6491 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6492 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6493 |
pageDown |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6494 |
"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
|
6495 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6496 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6497 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6498 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6499 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6500 |
super pageDown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6501 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6502 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6503 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6504 |
pageUp |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6505 |
"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
|
6506 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6507 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6508 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6509 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6510 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6511 |
super pageUp. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6512 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6513 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6514 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6515 |
!EditTextView methodsFor:'searching'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6516 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6517 |
searchBwd:pattern ifAbsent:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6518 |
"do a backward search" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6519 |
|
2822 | 6520 |
self searchBwd:pattern ignoreCase:false ifAbsent:aBlock |
1339 | 6521 |
! |
6522 |
||
6523 |
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
6524 |
"do a backward search" |
|
6525 |
||
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6526 |
|pos startLine startCol| |
1339 | 6527 |
|
6528 |
cursorLine isNil ifTrue:[^ self]. |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6529 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6530 |
pos := self startPositionForSearchBackward. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6531 |
startLine := pos y. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6532 |
startCol := pos x. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6533 |
|
3580 | 6534 |
self searchBwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock |
6535 |
||
6536 |
"Modified: 9.10.1997 / 13:02:13 / cg" |
|
6537 |
! |
|
6538 |
||
6539 |
searchBwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock |
|
6540 |
"do a backward search" |
|
6541 |
||
6542 |
cursorLine isNil ifTrue:[^ self]. |
|
6543 |
||
3160 | 6544 |
self |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6545 |
searchBackwardFor:pattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6546 |
ignoreCase:ign |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6547 |
startingAtLine:startLine col:startCol |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6548 |
ifFound:[:line :col | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6549 |
self cursorMovementAllowed ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6550 |
self cursorLine:line col:col. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6551 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6552 |
self showMatch:pattern atLine:line col:col. |
1339 | 6553 |
"/ self makeLineVisible:cursorLine |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6554 |
typeOfSelection := #search] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6555 |
ifAbsent:aBlock |
1339 | 6556 |
|
6557 |
"Modified: 9.10.1997 / 13:02:13 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6558 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6559 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6560 |
searchForAndSelectMatchingParenthesis |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6561 |
"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
|
6562 |
|
2554 | 6563 |
self searchForAndSelectMatchingParenthesisFromLine:cursorLine col:cursorCol |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6564 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6565 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6566 |
searchForMatchingParenthesis |
3160 | 6567 |
"search for a matching parenthesis starting at cursor position. |
6568 |
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
|
6569 |
backwards if its a closing parenthesis. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6570 |
Positions the cursor if found, peeps if not" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6571 |
|
2822 | 6572 |
self cursorMovementAllowed ifFalse:[^ self]. |
6573 |
||
3160 | 6574 |
self |
6575 |
searchForMatchingParenthesisFromLine:cursorLine col:cursorCol |
|
6576 |
ifFound:[:line :col | self cursorLine:line col:col] |
|
6577 |
ifNotFound:[self showNotFound] |
|
6578 |
onError:[self beep] |
|
1339 | 6579 |
|
6580 |
"Modified: 9.10.1997 / 12:56:30 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6581 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6582 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6583 |
searchFwd:pattern ifAbsent:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6584 |
"do a forward search" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6585 |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6586 |
|pos startLine startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6587 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6588 |
pos := self startPositionForSearchForward. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6589 |
startLine := pos y. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6590 |
startCol := pos x. |
1339 | 6591 |
|
3160 | 6592 |
self |
6593 |
searchFwd:pattern |
|
6594 |
startingAtLine:startLine col:startCol |
|
6595 |
ifAbsent:aBlock |
|
1339 | 6596 |
|
6597 |
"Modified: 9.10.1997 / 12:58:59 / cg" |
|
6598 |
! |
|
6599 |
||
6600 |
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
6601 |
"do a forward search" |
|
6602 |
||
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6603 |
|pos startLine startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6604 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6605 |
pos := self startPositionForSearchForward. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6606 |
startLine := pos y. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6607 |
startCol := pos x. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6608 |
|
3160 | 6609 |
self |
6610 |
searchFwd:pattern |
|
6611 |
ignoreCase:ign |
|
6612 |
startingAtLine:startLine col:startCol |
|
6613 |
ifAbsent:aBlock |
|
1339 | 6614 |
|
6615 |
"Modified: 9.10.1997 / 12:58:59 / cg" |
|
6616 |
"Created: 9.10.1997 / 13:04:10 / cg" |
|
6617 |
! |
|
6618 |
||
3967 | 6619 |
searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock |
1339 | 6620 |
"do a forward search" |
6621 |
||
6622 |
cursorLine isNil ifTrue:[^ self]. |
|
3967 | 6623 |
self |
6624 |
searchForwardFor:pattern |
|
6625 |
ignoreCase:ign |
|
6626 |
match: match |
|
6627 |
startingAtLine:startLine col:startCol |
|
6628 |
ifFound:[:line :col | |
|
6629 |
self cursorMovementAllowed ifTrue:[ |
|
6630 |
self cursorLine:line col:col. |
|
6631 |
]. |
|
6632 |
self showMatch:pattern atLine:line col:col. |
|
1339 | 6633 |
"/ self makeLineVisible:cursorLine |
3967 | 6634 |
typeOfSelection := #search |
6635 |
] |
|
6636 |
ifAbsent:aBlock |
|
1339 | 6637 |
|
6638 |
"Modified: 9.10.1997 / 12:57:47 / cg" |
|
6639 |
"Created: 9.10.1997 / 13:01:12 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6640 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6641 |
|
3967 | 6642 |
searchFwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock |
6643 |
"do a forward search" |
|
6644 |
||
6645 |
self searchFwd:pattern ignoreCase:ign match: false startingAtLine:startLine col:startCol ifAbsent:aBlock |
|
6646 |
! |
|
6647 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6648 |
searchFwd:pattern startingAtLine:startLine col:startCol ifAbsent:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6649 |
"do a forward search" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6650 |
|
2822 | 6651 |
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
|
6652 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6653 |
|
3982 | 6654 |
searchPatternForSearchBar |
6655 |
||
6656 |
"Returns the next searchPattern from the user selection or from the autoSearch" |
|
6657 |
||
6658 |
|searchPattern| |
|
6659 |
||
6660 |
searchPattern := self selectionForSearchBar. |
|
6661 |
searchPattern isNil |
|
6662 |
ifTrue: [searchPattern := lastSearchPattern] |
|
6663 |
ifFalse: [lastSearchPattern := searchPattern]. |
|
6664 |
^ searchPattern |
|
6665 |
! |
|
6666 |
||
3578 | 6667 |
setSearchPatternWithMatchEscapes: match |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6668 |
"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
|
6669 |
cursor to start of pattern" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6670 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6671 |
|sel| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6672 |
|
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6673 |
"/ |
3967 | 6674 |
"/ 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
|
6675 |
"/ original string (for search after again) |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6676 |
"/ |
4010 | 6677 |
(lastStringFromReplace notNil |
6678 |
"/ and:[lastReplacement notNil |
|
6679 |
and:[typeOfSelection ~~ #search]"]") ifTrue:[ |
|
6680 |
lastStringFromReplace isString ifTrue:[ |
|
6681 |
lastSearchPattern := lastStringFromReplace. |
|
3967 | 6682 |
] ifFalse:[ |
4010 | 6683 |
lastSearchPattern := lastStringFromReplace asStringWithoutFinalCR. |
3967 | 6684 |
]. |
6685 |
^ self |
|
259
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 |
|
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6688 |
"/ |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6689 |
"/ if there is a selection: |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6690 |
"/ 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
|
6691 |
"/ if there was a previous search, only take the selection if |
3967 | 6692 |
"/ 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
|
6693 |
"/ (to allow search-paste to be repeated) |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6694 |
"/ |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6695 |
sel := self selection. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6696 |
sel notNil ifTrue:[ |
3967 | 6697 |
(lastSearchPattern isNil |
6698 |
or:[typeOfSelection ~~ #paste |
|
6699 |
and:[typeOfSelection ~~ #search]]) ifTrue:[ |
|
6700 |
self cursorLine:selectionStartLine col:selectionStartCol. |
|
6701 |
lastSearchPattern := sel asStringWithoutFinalCR. |
|
6702 |
match ifTrue:[lastSearchPattern := lastSearchPattern withMatchEscapes]. |
|
6703 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6704 |
] |
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6705 |
|
565 | 6706 |
"Modified: 20.4.1996 / 12:50:13 / cg" |
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6707 |
! |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6708 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6709 |
startPositionForSearchBackward |
2822 | 6710 |
^ self startPositionForSearchBackwardBasedOnCursorOrSelection |
6711 |
! |
|
6712 |
||
6713 |
startPositionForSearchBackwardBasedOnCursorOrSelection |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6714 |
|startLine startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6715 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6716 |
selectionStartLine notNil ifTrue:[ |
3160 | 6717 |
startLine := selectionStartLine. |
6718 |
startCol := selectionStartCol |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6719 |
] ifFalse:[ |
3160 | 6720 |
cursorLine isNil ifTrue:[ |
6721 |
startLine := list size. |
|
6722 |
startCol := self listAt:startLine size. |
|
6723 |
] ifFalse:[ |
|
6724 |
startLine := cursorLine min:list size. |
|
6725 |
startCol := cursorCol |
|
6726 |
] |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6727 |
]. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6728 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6729 |
^ startCol @ cursorLine |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6730 |
! |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6731 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6732 |
startPositionForSearchForward |
2822 | 6733 |
^ self startPositionForSearchForwardBasedOnCursorOrSelection |
6734 |
! |
|
6735 |
||
6736 |
startPositionForSearchForwardBasedOnCursorOrSelection |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6737 |
|startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6738 |
|
3160 | 6739 |
"/ 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
|
6740 |
"/ 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
|
6741 |
startCol := cursorCol. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6742 |
self hasSelection ifFalse:[ |
3160 | 6743 |
(cursorLine == 1 and:[cursorCol == 1]) ifTrue:[ |
6744 |
startCol := 0 |
|
6745 |
] |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6746 |
]. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6747 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6748 |
^ startCol @ cursorLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6749 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6750 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6751 |
!EditTextView methodsFor:'selections'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6752 |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6753 |
addToSelectionAfter:aBlock |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6754 |
"Pokud existuje selekce, upravi ji |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6755 |
podle aktualni pozice kurzoru a pozice |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6756 |
po provedeni blocku. |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6757 |
Urceno k implementaci Shift-Home a Shift-End |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6758 |
Nejak nevim, jak to presneji popsat :-)" |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6759 |
|
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6760 |
|startLine startCol endLine endCol | |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6761 |
|
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6762 |
self hasSelection ifTrue: [ |
3160 | 6763 |
startLine := selectionStartLine . |
6764 |
startCol := selectionStartCol . |
|
6765 |
endLine := selectionEndLine . |
|
6766 |
endCol := selectionEndCol . |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6767 |
] ifFalse: [ |
3160 | 6768 |
startLine := endLine := cursorLine . |
6769 |
startCol := endCol := cursorCol . |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6770 |
]. |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6771 |
|
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6772 |
"deselectim a provedu presun kurzoru..." |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6773 |
self unselect . |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6774 |
aBlock value . |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6775 |
|
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6776 |
"funguje dost mizerne, jen na jednom radku..." |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6777 |
(startCol - cursorCol) abs <= (endCol - cursorCol) abs |
3160 | 6778 |
ifTrue: [ |
6779 |
startCol := cursorCol. |
|
6780 |
] ifFalse: [ |
|
6781 |
endCol := cursorCol - 1. |
|
6782 |
]. |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6783 |
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
|
6784 |
! |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6785 |
|
1850 | 6786 |
autoMoveCursorToEndOfSelection |
6787 |
"return true, if the cursor should be automatically moved to the |
|
6788 |
end of a selection. |
|
3963
c315f087d655
comment in: #autoMoveCursorToEndOfSelection
Claus Gittinger <cg@exept.de>
parents:
3945
diff
changeset
|
6789 |
Redefined to return false in terminalViews, where the cursor should |
1850 | 6790 |
not be affected by selecting" |
6791 |
||
6792 |
^ true |
|
6793 |
! |
|
6794 |
||
2606
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
6795 |
changeTypeOfSelectionTo:newType |
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
6796 |
typeOfSelection ~~ newType ifTrue:[ |
3160 | 6797 |
typeOfSelection := newType. |
6798 |
selectionStartLine notNil ifTrue:[ |
|
6799 |
self |
|
6800 |
redrawFromLine:selectionStartLine col:selectionStartCol |
|
6801 |
toLine:selectionEndLine col:selectionEndCol |
|
6802 |
]. |
|
2606
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
6803 |
]. |
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
6804 |
! |
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
6805 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6806 |
selectAll |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6807 |
"select the whole text. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6808 |
redefined to send super selectFrom... since we dont want the |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6809 |
cursor to be moved in this case." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6810 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6811 |
list isNil ifTrue:[ |
3160 | 6812 |
self unselect |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6813 |
] ifFalse:[ |
3160 | 6814 |
super selectFromLine:1 col:1 toLine:(list size + 1) col:0. |
6815 |
typeOfSelection := nil |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6816 |
] |
1082 | 6817 |
|
6818 |
"Modified: 28.2.1997 / 19:14:54 / cg" |
|
259
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 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6821 |
selectCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6822 |
"select cursorline" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6823 |
|
3160 | 6824 |
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
|
6825 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6826 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6827 |
selectCursorLineFromBeginning |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6828 |
"select cursorline up to cursor position" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6829 |
|
823
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
6830 |
cursorCol > 1 ifTrue:[ |
3160 | 6831 |
self selectFromLine:cursorLine col:1 |
6832 |
toLine:cursorLine col:(cursorCol-1) |
|
823
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
6833 |
] |
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
6834 |
|
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
6835 |
"Modified: 16.8.1996 / 19:14:14 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6836 |
! |
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 |
selectExpandCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6839 |
"expand selection by one line or select cursorline" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6840 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6841 |
selectionStartLine isNil ifTrue:[ |
3160 | 6842 |
self selectCursorLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6843 |
] ifFalse:[ |
3160 | 6844 |
self selectFromLine:selectionStartLine col:selectionStartCol |
6845 |
toLine:cursorLine+1 col:0. |
|
6846 |
self makeLineVisible:selectionEndLine |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6847 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6848 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6849 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6850 |
selectFromBeginning |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6851 |
"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
|
6852 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6853 |
|col| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6854 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6855 |
list isNil ifTrue:[ |
3160 | 6856 |
self unselect |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6857 |
] ifFalse:[ |
3160 | 6858 |
cursorCol == 0 ifTrue:[ |
6859 |
col := 0 |
|
6860 |
] ifFalse:[ |
|
6861 |
col := cursorCol - 1 |
|
6862 |
]. |
|
6863 |
super selectFromLine:1 col:1 toLine:cursorLine col:col. |
|
6864 |
typeOfSelection := nil |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6865 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6866 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6867 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6868 |
selectFromLine:startLine col:startCol toLine:endLine col:endCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6869 |
"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
|
6870 |
for easier editing. Also typeOfSelection is nilled here." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6871 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6872 |
super selectFromLine:startLine col:startCol toLine:endLine col:endCol. |
1850 | 6873 |
(selectionEndLine notNil and:[self autoMoveCursorToEndOfSelection]) ifTrue:[ |
3160 | 6874 |
self cursorLine:selectionEndLine col:(selectionEndCol + 1). |
1198 | 6875 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6876 |
typeOfSelection := nil |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6877 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6878 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6879 |
selectUpToEnd |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6880 |
"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
|
6881 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6882 |
list isNil ifTrue:[ |
3160 | 6883 |
self unselect |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6884 |
] ifFalse:[ |
3160 | 6885 |
super selectFromLine:cursorLine col:cursorCol toLine:(list size + 1) col:0. |
6886 |
typeOfSelection := nil |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6887 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6888 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6889 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6890 |
selectWordUnderCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6891 |
"select the word under the cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6892 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6893 |
self selectWordAtLine:cursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6894 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6895 |
|
3982 | 6896 |
selectionForSearchBar |
3580 | 6897 |
|
6898 |
|sel searchPattern| |
|
6899 |
||
6900 |
"/ |
|
4010 | 6901 |
"/ if the last operation was a replace, set pattern to last |
3650
f3132c5a61a3
if the last operation was a replcae, set pattern to last
fm
parents:
3631
diff
changeset
|
6902 |
"/ original string (for search after again) |
f3132c5a61a3
if the last operation was a replcae, set pattern to last
fm
parents:
3631
diff
changeset
|
6903 |
"/ |
4010 | 6904 |
(lastStringFromReplace notNil |
6905 |
"/ and:[lastReplacement notNil |
|
6906 |
and:[typeOfSelection ~~ #search]"]") ifTrue:[ |
|
6907 |
lastStringFromReplace isString ifTrue:[ |
|
6908 |
searchPattern := lastStringFromReplace. |
|
3982 | 6909 |
] ifFalse:[ |
4010 | 6910 |
searchPattern := lastStringFromReplace asStringWithoutFinalCR. |
3982 | 6911 |
]. |
6912 |
^ searchPattern |
|
3650
f3132c5a61a3
if the last operation was a replcae, set pattern to last
fm
parents:
3631
diff
changeset
|
6913 |
]. |
f3132c5a61a3
if the last operation was a replcae, set pattern to last
fm
parents:
3631
diff
changeset
|
6914 |
|
f3132c5a61a3
if the last operation was a replcae, set pattern to last
fm
parents:
3631
diff
changeset
|
6915 |
"/ |
3580 | 6916 |
"/ if there is a selection: |
6917 |
"/ if there was no previous search, take it as search pattern. |
|
6918 |
"/ if there was a previous search, only take the selection if |
|
6919 |
"/ it did not result from a paste. |
|
6920 |
"/ (to allow search-paste to be repeated) |
|
6921 |
"/ |
|
6922 |
sel := self selection. |
|
6923 |
sel notNil ifTrue:[ |
|
3982 | 6924 |
typeOfSelection ~~ #search ifTrue:[ |
6925 |
typeOfSelection ~~ #paste ifTrue:[ |
|
6926 |
self cursorLine:selectionStartLine col:selectionStartCol. |
|
6927 |
searchPattern := sel asStringWithoutFinalCR. |
|
6928 |
] |
|
6929 |
]. |
|
6930 |
]. |
|
6931 |
||
3580 | 6932 |
^ searchPattern |
6933 |
! |
|
6934 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6935 |
unselect |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6936 |
"forget and unhilight selection - must take care of cursor here" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6937 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6938 |
|wasOn| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6939 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6940 |
wasOn := self hideCursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6941 |
super unselect. |
2606
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
6942 |
typeOfSelection := nil. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6943 |
wasOn ifTrue:[self showCursor] |
105 | 6944 |
! ! |
6945 |
||
6946 |
!EditTextView methodsFor:'undo & again'! |
|
6947 |
||
2952 | 6948 |
addUndo:action |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
6949 |
^ undoSupport addUndo:action. |
2952 | 6950 |
! |
6951 |
||
105 | 6952 |
again |
6953 |
"repeat the last action (which was a cut or replace). |
|
6954 |
If current selection is not last string, search forward to |
|
3160 | 6955 |
next occurrence of it before repeating the last operation." |
105 | 6956 |
|
2323
ef201d5d0689
fixed search-again if cursor is at start of text, and
Claus Gittinger <cg@exept.de>
parents:
2310
diff
changeset
|
6957 |
|s l c sel savedSelectStyle startColForSearch| |
105 | 6958 |
|
4010 | 6959 |
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
|
6960 |
^ false |
2579
74d3798f4200
do not remove separators from replacement string
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6961 |
]. |
74d3798f4200
do not remove separators from replacement string
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6962 |
|
3127
29767bf8a215
better info of replace action (compound-undo-action has info, too)
Claus Gittinger <cg@exept.de>
parents:
3115
diff
changeset
|
6963 |
self undoableDo:[ |
4010 | 6964 |
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
|
6965 |
"remove final cr" |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6966 |
(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
|
6967 |
"/ s := s withoutSpaces. "XXX - replacing text with spaces ..." |
4010 | 6968 |
|
4011 | 6969 |
"set the lastStringToReplace as the next search string" |
4010 | 6970 |
lastStringFromReplace := s. |
6971 |
||
3816
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6972 |
savedSelectStyle := selectStyle. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6973 |
selectStyle := nil. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6974 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6975 |
sel := self selection. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6976 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6977 |
"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
|
6978 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6979 |
(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
|
6980 |
l := selectionStartLine "cursorLine". |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6981 |
c := selectionStartCol "cursorCol". |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6982 |
self deleteSelection. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6983 |
lastReplacement notNil ifTrue:[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6984 |
self insertLines:lastReplacement asStringCollection withCR:false. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6985 |
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
|
6986 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6987 |
selectStyle := savedSelectStyle. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6988 |
^ true |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6989 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6990 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6991 |
sel isEmptyOrNil ifTrue:[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6992 |
startColForSearch := cursorCol - 1 |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6993 |
] ifFalse:[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6994 |
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
|
6995 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6996 |
self searchForwardFor:s startingAtLine:cursorLine col:startColForSearch |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6997 |
ifFound: |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6998 |
[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
6999 |
:line :col | |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7000 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7001 |
|repl| |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7002 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7003 |
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
|
7004 |
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
|
7005 |
self makeLineVisible:line. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7006 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7007 |
self deleteSelection. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7008 |
lastReplacement notNil ifTrue:[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7009 |
lastReplacement isString ifFalse:[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7010 |
repl := lastReplacement asString "withoutSpaces" |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7011 |
] ifTrue:[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7012 |
repl := lastReplacement "withoutSpaces". |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7013 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7014 |
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
|
7015 |
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
|
7016 |
undoSupport actionInfo:'replace'. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7017 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7018 |
selectStyle := savedSelectStyle. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7019 |
^ true |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7020 |
] |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7021 |
ifAbsent: |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7022 |
[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7023 |
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
|
7024 |
self showNotFound. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7025 |
selectStyle := savedSelectStyle. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7026 |
^ false |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7027 |
]. |
3127
29767bf8a215
better info of replace action (compound-undo-action has info, too)
Claus Gittinger <cg@exept.de>
parents:
3115
diff
changeset
|
7028 |
]. |
2730
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
7029 |
|
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
7030 |
^ true. |
501 | 7031 |
|
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
7032 |
"Modified: 9.10.1996 / 16:14:11 / cg" |
105 | 7033 |
! |
7034 |
||
2952 | 7035 |
hasRedoAction |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7036 |
^ undoSupport hasRedoAction. |
2952 | 7037 |
! |
7038 |
||
7039 |
hasUndoAction |
|
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7040 |
^ undoSupport hasUndoAction. |
2952 | 7041 |
! |
7042 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7043 |
multipleAgain |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7044 |
"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
|
7045 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7046 |
[self again] whileTrue:[] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7047 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7048 |
|
2952 | 7049 |
nonUndoableDo:aBlock |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7050 |
undoSupport nonUndoableDo:aBlock. |
2952 | 7051 |
! |
7052 |
||
7053 |
redo |
|
3780 | 7054 |
"undo the last undo" |
7055 |
||
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7056 |
undoSupport hasRedoAction ifFalse:[ |
3780 | 7057 |
self beep |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7058 |
] ifTrue:[ |
3780 | 7059 |
undoSupport redo. |
2952 | 7060 |
] |
7061 |
! |
|
7062 |
||
121 | 7063 |
undo |
3780 | 7064 |
"undo the last edit operation" |
7065 |
||
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7066 |
undoSupport hasUndoAction ifFalse:[ |
3780 | 7067 |
self beep |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7068 |
] ifTrue:[ |
3780 | 7069 |
undoSupport undo. |
121 | 7070 |
] |
2952 | 7071 |
! |
7072 |
||
7073 |
undoableDo:aBlock |
|
3495 | 7074 |
self undoableDo:aBlock info:nil. |
7075 |
||
7076 |
"Modified: / 28-07-2007 / 13:20:14 / cg" |
|
3130 | 7077 |
! |
7078 |
||
7079 |
undoableDo:aBlock info:aString |
|
3154
42bf7ebd54c8
refadctored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
7080 |
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
|
7081 |
"/ 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
|
7082 |
aBlock value. |
3154
42bf7ebd54c8
refadctored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
7083 |
] ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7084 |
undoSupport undoableDo:aBlock info:aString. |
3495 | 7085 |
]. |
7086 |
||
7087 |
"Modified: / 28-07-2007 / 13:21:00 / cg" |
|
2952 | 7088 |
! ! |
7089 |
||
7090 |
!EditTextView::EditAction class methodsFor:'instance creation'! |
|
7091 |
||
7092 |
line1:arg1 col1:arg2 line2:arg3 col2:arg4 |
|
7093 |
^ self new line1:arg1 col1:arg2 line2:arg3 col2:arg4 |
|
7094 |
! |
|
7095 |
||
3115 | 7096 |
line1:arg1 col1:arg2 line2:arg3 col2:arg4 info:info |
3160 | 7097 |
^ (self new line1:arg1 col1:arg2 line2:arg3 col2:arg4) info:info |
3115 | 7098 |
! |
7099 |
||
2952 | 7100 |
line:arg1 col:arg2 character:arg3 |
7101 |
^ self new line:arg1 col:arg2 character:arg3 |
|
7102 |
! |
|
7103 |
||
3115 | 7104 |
line:arg1 col:arg2 character:arg3 info:info |
3160 | 7105 |
^ (self new line:arg1 col:arg2 character:arg3) info:info |
3115 | 7106 |
! |
7107 |
||
3235 | 7108 |
line:arg1 col:arg2 characters:arg3 info:info |
7109 |
^ (self new line:arg1 col:arg2 characters:arg3) info:info |
|
7110 |
! |
|
7111 |
||
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7112 |
line:arg1 col:arg2 info:arg3 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7113 |
^ self new line:arg1 col:arg2 info:arg3 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7114 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7115 |
|
2952 | 7116 |
line:arg1 col:arg2 string:arg3 |
7117 |
^ self new line:arg1 col:arg2 string:arg3 |
|
3115 | 7118 |
! |
7119 |
||
7120 |
line:arg1 col:arg2 string:arg3 info:info |
|
7121 |
^ (self new line:arg1 col:arg2 string:arg3) info:info |
|
3130 | 7122 |
! |
7123 |
||
7124 |
line:arg1 string:arg3 info:info |
|
7125 |
^ (self new line:arg1 string:arg3) info:info |
|
3131 | 7126 |
! |
7127 |
||
7128 |
text:arg info:info |
|
7129 |
^ (self new text:arg) info:info |
|
3115 | 7130 |
! ! |
7131 |
||
7132 |
!EditTextView::EditAction methodsFor:'accessing'! |
|
7133 |
||
7134 |
info |
|
7135 |
^ userFriendlyInfo |
|
7136 |
! |
|
7137 |
||
7138 |
info:aString |
|
7139 |
userFriendlyInfo := aString |
|
2952 | 7140 |
! ! |
7141 |
||
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7142 |
!EditTextView::EditAction methodsFor:'combining'! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7143 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7144 |
canCombineWithPreviousPasteStringAction: aPasteStringAction |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7145 |
^ false. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7146 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7147 |
"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
|
7148 |
! ! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7149 |
|
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7150 |
!EditTextView::EditAction methodsFor:'queries'! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7151 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7152 |
canCombineWithNext:nextAction |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7153 |
^ false |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7154 |
! ! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7155 |
|
2952 | 7156 |
!EditTextView::DeleteRange methodsFor:'accessing'! |
7157 |
||
3160 | 7158 |
line1:line1Arg col1:col1Arg line2:line2Arg col2:col2Arg |
2952 | 7159 |
"set instance variables (automatically generated)" |
7160 |
||
7161 |
self assert:(line1Arg notNil). |
|
7162 |
self assert:(col1Arg notNil). |
|
7163 |
self assert:(line2Arg notNil). |
|
7164 |
self assert:(col2Arg notNil). |
|
7165 |
||
7166 |
line1 := line1Arg. |
|
7167 |
col1 := col1Arg. |
|
7168 |
line2 := line2Arg. |
|
7169 |
col2 := col2Arg. |
|
7170 |
! ! |
|
7171 |
||
7172 |
!EditTextView::DeleteRange methodsFor:'execution'! |
|
7173 |
||
3160 | 7174 |
executeIn:editor |
2952 | 7175 |
editor unselect. |
3160 | 7176 |
editor |
7177 |
deleteFromLine:line1 |
|
7178 |
col:col1 |
|
7179 |
toLine:line2 |
|
7180 |
col:col2. |
|
2952 | 7181 |
editor cursorLine:line1 col:col1. |
7182 |
! ! |
|
7183 |
||
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7184 |
!EditTextView::DeleteCharacters methodsFor:'accessing'! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7185 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7186 |
col1 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7187 |
^ col1 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7188 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7189 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7190 |
col2 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7191 |
^ col2 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7192 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7193 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7194 |
line |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7195 |
^ line |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7196 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7197 |
|
3160 | 7198 |
line:lineArg col1:col1Arg col2:col2Arg |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7199 |
"set instance variables (automatically generated)" |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7200 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7201 |
self assert:(lineArg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7202 |
self assert:(col1Arg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7203 |
self assert:(col2Arg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7204 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7205 |
line := lineArg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7206 |
col1 := col1Arg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7207 |
col2 := col2Arg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7208 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7209 |
|
3160 | 7210 |
line:lineArg col:colArg info:infoArg |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7211 |
self assert:(lineArg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7212 |
self assert:(colArg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7213 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7214 |
line := lineArg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7215 |
col1 := col2 := colArg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7216 |
self info:infoArg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7217 |
! ! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7218 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7219 |
!EditTextView::DeleteCharacters methodsFor:'combining'! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7220 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7221 |
canCombineWithNext:anotherAction |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7222 |
^ anotherAction perform:#canCombineWithPreviousDeleteCharactersAction: with:self ifNotUnderstood:false |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7223 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7224 |
|
3160 | 7225 |
canCombineWithPreviousDeleteCharactersAction:previousDeleteAction |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7226 |
"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
|
7227 |
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
|
7228 |
(i.e. single-character typing)" |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7229 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7230 |
previousDeleteAction line == line ifTrue:[ |
3160 | 7231 |
previousDeleteAction col2 == (col1-1) ifTrue:[ |
7232 |
^ true |
|
7233 |
]. |
|
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7234 |
]. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7235 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7236 |
^ false |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7237 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7238 |
|
3160 | 7239 |
combineWithNext:nextDeleteAction |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7240 |
self assert:(line == nextDeleteAction line). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7241 |
self assert:(col2 == (nextDeleteAction col1 - 1)). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7242 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7243 |
col2 := nextDeleteAction col2. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7244 |
userFriendlyInfo := 'insert ' , (col2 - col1 + 1) printString |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7245 |
! ! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7246 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7247 |
!EditTextView::DeleteCharacters methodsFor:'execution'! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7248 |
|
3160 | 7249 |
executeIn:editor |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7250 |
editor unselect. |
3160 | 7251 |
editor |
7252 |
deleteFromLine:line |
|
7253 |
col:col1 |
|
7254 |
toLine:line |
|
7255 |
col:col2. |
|
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7256 |
editor cursorLine:line col:col1. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7257 |
! ! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7258 |
|
3235 | 7259 |
!EditTextView::EditMode class methodsFor:'constants'! |
7260 |
||
7261 |
insertAndSelectMode |
|
7262 |
^ InsertAndSelectMode |
|
7263 |
! |
|
7264 |
||
7265 |
insertMode |
|
7266 |
^ InsertMode |
|
7267 |
! |
|
7268 |
||
7269 |
overwriteMode |
|
7270 |
^ OverwriteMode |
|
7271 |
! ! |
|
7272 |
||
7273 |
!EditTextView::EditMode class methodsFor:'queries'! |
|
7274 |
||
7275 |
isInsertAndSelectMode |
|
7276 |
^ false |
|
7277 |
! |
|
7278 |
||
7279 |
isInsertMode |
|
7280 |
^ false |
|
7281 |
! |
|
7282 |
||
7283 |
symbolicName |
|
7284 |
self subclassResponsibility |
|
7285 |
! ! |
|
7286 |
||
7287 |
!EditTextView::EditMode::InsertAndSelectMode class methodsFor:'info'! |
|
7288 |
||
7289 |
infoPrintString |
|
7290 |
^ 'IS' |
|
7291 |
! ! |
|
7292 |
||
7293 |
!EditTextView::EditMode::InsertAndSelectMode class methodsFor:'queries'! |
|
7294 |
||
7295 |
isInsertAndSelectMode |
|
7296 |
^ true |
|
7297 |
! |
|
7298 |
||
7299 |
isInsertMode |
|
7300 |
^ true |
|
7301 |
! ! |
|
7302 |
||
7303 |
!EditTextView::EditMode::InsertMode class methodsFor:'info'! |
|
7304 |
||
7305 |
infoPrintString |
|
7306 |
^ 'I' |
|
7307 |
! ! |
|
7308 |
||
7309 |
!EditTextView::EditMode::InsertMode class methodsFor:'queries'! |
|
7310 |
||
7311 |
isInsertMode |
|
7312 |
^ true |
|
7313 |
! ! |
|
7314 |
||
7315 |
!EditTextView::EditMode::OverwriteMode class methodsFor:'info'! |
|
7316 |
||
7317 |
infoPrintString |
|
7318 |
^ 'O' |
|
7319 |
! ! |
|
7320 |
||
2952 | 7321 |
!EditTextView::PasteString methodsFor:'accessing'! |
7322 |
||
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7323 |
col |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7324 |
^ col |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7325 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7326 |
"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
|
7327 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7328 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7329 |
col2 |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7330 |
^ col + string size - 1 |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7331 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7332 |
"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
|
7333 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7334 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7335 |
line |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7336 |
^ line |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7337 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7338 |
"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
|
7339 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7340 |
|
3160 | 7341 |
line:lineArg col:colArg string:stringArg |
2952 | 7342 |
self assert:(lineArg notNil). |
7343 |
self assert:(colArg notNil). |
|
7344 |
self assert:(stringArg notNil). |
|
7345 |
||
7346 |
line := lineArg. |
|
7347 |
col := colArg. |
|
7348 |
string := stringArg. |
|
7349 |
! |
|
7350 |
||
7351 |
line:lineArg col:colArg string:stringArg selected:selectedArg |
|
7352 |
self assert:(lineArg notNil). |
|
7353 |
self assert:(colArg notNil). |
|
7354 |
self assert:(stringArg notNil). |
|
7355 |
||
7356 |
line := lineArg. |
|
7357 |
col := colArg. |
|
7358 |
string := stringArg. |
|
7359 |
selected := selectedArg. |
|
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7360 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7361 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7362 |
string |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7363 |
^ string |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7364 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7365 |
"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
|
7366 |
! ! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7367 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7368 |
!EditTextView::PasteString methodsFor:'combining'! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7369 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7370 |
canCombineWithNext:anotherAction |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7371 |
^ anotherAction canCombineWithPreviousPasteStringAction:self |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7372 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7373 |
"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
|
7374 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7375 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7376 |
canCombineWithPreviousPasteStringAction: previousPasteAction |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7377 |
"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
|
7378 |
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
|
7379 |
(i.e. single-character deletes)" |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7380 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7381 |
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
|
7382 |
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
|
7383 |
^ true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7384 |
]. |
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7385 |
]. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7386 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7387 |
^ false |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7388 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7389 |
"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
|
7390 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7391 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7392 |
combineWithNext:nextPasteAction |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7393 |
|s1 s2| |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7394 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7395 |
self assert:(line == nextPasteAction line). |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7396 |
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
|
7397 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7398 |
s1 := nextPasteAction string. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7399 |
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
|
7400 |
s2 := string. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7401 |
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
|
7402 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7403 |
string := s1, s2. |
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7404 |
col := nextPasteAction col. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7405 |
userFriendlyInfo := 'delete ' , string size printString |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7406 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7407 |
"Created: / 25-09-2006 / 12:24:10 / cg" |
2952 | 7408 |
! ! |
7409 |
||
7410 |
!EditTextView::PasteString methodsFor:'execution'! |
|
7411 |
||
3160 | 7412 |
executeIn:editor |
2952 | 7413 |
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
|
7414 |
editor paste:string. |
2952 | 7415 |
selected ~~ true ifTrue:[ |
3160 | 7416 |
editor unselect |
2952 | 7417 |
]. |
7418 |
! ! |
|
7419 |
||
7420 |
!EditTextView::ReplaceCharacter methodsFor:'accessing'! |
|
7421 |
||
3235 | 7422 |
col |
7423 |
^ col |
|
7424 |
! |
|
7425 |
||
7426 |
col1 |
|
7427 |
^ col |
|
7428 |
! |
|
7429 |
||
7430 |
col2 |
|
7431 |
^ col |
|
7432 |
! |
|
7433 |
||
7434 |
line |
|
7435 |
^ line |
|
7436 |
! |
|
7437 |
||
3160 | 7438 |
line:lineArg col:colArg character:characterArg |
2952 | 7439 |
line := lineArg. |
7440 |
col := colArg. |
|
7441 |
character := characterArg. |
|
7442 |
! ! |
|
7443 |
||
7444 |
!EditTextView::ReplaceCharacter methodsFor:'execution'! |
|
7445 |
||
3160 | 7446 |
executeIn:editor |
7447 |
editor |
|
7448 |
replace:character |
|
7449 |
atLine:line |
|
7450 |
col:col. |
|
2952 | 7451 |
editor cursorLine:line col:col. |
105 | 7452 |
! ! |
7453 |
||
3235 | 7454 |
!EditTextView::ReplaceCharacters methodsFor:'accessing'! |
7455 |
||
7456 |
characters |
|
7457 |
^ characters |
|
7458 |
! |
|
7459 |
||
7460 |
col1 |
|
7461 |
^ col1 |
|
7462 |
! |
|
7463 |
||
7464 |
col2 |
|
7465 |
^ col2 |
|
7466 |
! |
|
7467 |
||
7468 |
line |
|
7469 |
^ line |
|
7470 |
! |
|
7471 |
||
7472 |
line:lineArg col:colArg character:characterArg |
|
7473 |
line := lineArg. |
|
7474 |
col1 := col2 := colArg. |
|
7475 |
characters := characterArg asString. |
|
7476 |
! |
|
7477 |
||
7478 |
line:lineArg col:colArg characters:charactersArg |
|
7479 |
line := lineArg. |
|
7480 |
col1 := colArg. |
|
7481 |
characters := charactersArg asString. |
|
7482 |
col2 := col1 + charactersArg size - 1 |
|
7483 |
! ! |
|
7484 |
||
7485 |
!EditTextView::ReplaceCharacters methodsFor:'combining'! |
|
7486 |
||
7487 |
canCombineWithNext:anotherAction |
|
7488 |
^ anotherAction perform:#canCombineWithPreviousReplaceCharactersAction: with:self ifNotUnderstood:false |
|
7489 |
! |
|
7490 |
||
7491 |
canCombineWithPreviousReplaceCharactersAction:previousReplaceAction |
|
7492 |
"I will combine only if we both are single character deletes, |
|
7493 |
and my col-to-delete is the next after anotherDeleteActions col-to-delete. |
|
7494 |
(i.e. single-character typing)" |
|
7495 |
||
7496 |
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
|
7497 |
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
|
7498 |
^ true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7499 |
]. |
3235 | 7500 |
]. |
7501 |
||
7502 |
^ false |
|
7503 |
! |
|
7504 |
||
7505 |
combineWithNext:nextReplaceAction |
|
7506 |
self assert:(line == nextReplaceAction line). |
|
7507 |
self assert:(self col2 == (nextReplaceAction col1 - 1)). |
|
7508 |
||
7509 |
col2 := nextReplaceAction col2. |
|
7510 |
userFriendlyInfo := 'replace ' , (col2 - col1 + 1) printString. |
|
7511 |
characters := characters , nextReplaceAction characters. |
|
7512 |
! ! |
|
7513 |
||
7514 |
!EditTextView::ReplaceCharacters methodsFor:'execution'! |
|
7515 |
||
7516 |
executeIn:editor |
|
7517 |
editor |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7518 |
replaceString:characters |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7519 |
atLine:line |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7520 |
col:col1. |
3235 | 7521 |
editor cursorLine:line col:col1. |
7522 |
! ! |
|
7523 |
||
3131 | 7524 |
!EditTextView::ReplaceContents methodsFor:'accessing'! |
7525 |
||
7526 |
text:something |
|
7527 |
text := something. |
|
7528 |
! ! |
|
7529 |
||
7530 |
!EditTextView::ReplaceContents methodsFor:'execution'! |
|
7531 |
||
3160 | 7532 |
executeIn:editor |
3131 | 7533 |
editor contents:text |
7534 |
! ! |
|
7535 |
||
3130 | 7536 |
!EditTextView::ReplaceLine methodsFor:'accessing'! |
7537 |
||
3160 | 7538 |
line:lineArg string:stringArg |
3130 | 7539 |
line := lineArg. |
7540 |
text := stringArg. |
|
7541 |
! ! |
|
7542 |
||
7543 |
!EditTextView::ReplaceLine methodsFor:'execution'! |
|
7544 |
||
3160 | 7545 |
executeIn:editor |
3130 | 7546 |
editor list at:line put:text. |
7547 |
editor invalidateLine:line |
|
7548 |
! ! |
|
7549 |
||
3402 | 7550 |
!EditTextView::ReplaceLines methodsFor:'accessing'! |
7551 |
||
7552 |
line:lineArg lines:lineCollectionArg |
|
7553 |
line := lineArg. |
|
7554 |
text := lineCollectionArg. |
|
7555 |
||
7556 |
"Created: / 09-10-2006 / 10:35:22 / cg" |
|
7557 |
! ! |
|
7558 |
||
7559 |
!EditTextView::ReplaceLines methodsFor:'execution'! |
|
7560 |
||
7561 |
executeIn:editor |
|
7562 |
|lnr| |
|
7563 |
||
7564 |
lnr := line. |
|
7565 |
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
|
7566 |
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
|
7567 |
editor invalidateLine:lnr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7568 |
lnr := lnr + 1. |
3402 | 7569 |
]. |
7570 |
||
7571 |
"Modified: / 09-10-2006 / 10:39:16 / cg" |
|
7572 |
! ! |
|
7573 |
||
865 | 7574 |
!EditTextView class methodsFor:'documentation'! |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7575 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7576 |
version |
4042 | 7577 |
^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.471 2009-10-28 13:32:52 cg Exp $' |
3945 | 7578 |
! |
7579 |
||
7580 |
version_CVS |
|
4042 | 7581 |
^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.471 2009-10-28 13:32:52 cg Exp $' |
0 | 7582 |
! ! |