author | Claus Gittinger <cg@exept.de> |
Mon, 18 Apr 2011 21:35:58 +0200 | |
changeset 4242 | 93363c9c43cd |
parent 4238 | 5f7125996b44 |
child 4246 | 1d667f61e7b5 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
3160 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
2184
fb634dc3e606
learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
12 |
"{ Package: 'stx:libwidg' }" |
fb634dc3e606
learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
13 |
|
0 | 14 |
TextView subclass:#EditTextView |
2724 | 15 |
instanceVariableNames:'cursorLine cursorVisibleLine cursorCol cursorShown |
16 |
prevCursorState readOnly modifiedChannel fixedSize exceptionBlock |
|
17 |
cursorFgColor cursorBgColor cursorNoFocusFgColor cursorType |
|
4048 | 18 |
cursorTypeNoFocus typeOfSelection lastAction replacing |
4010 | 19 |
showMatchingParenthesis hasKeyboardFocus acceptAction lockUpdates |
20 |
tabMeansNextField autoIndent insertMode editMode trimBlankLines |
|
21 |
wordWrap replacementWordSelectStyle acceptChannel acceptEnabled |
|
22 |
st80Mode disableIfInvisible cursorMovementWhenUpdating learnMode |
|
23 |
learnedMacro cursorLineHolder cursorColHolder tabRequiresControl |
|
4048 | 24 |
undoSupport lastStringFromReplaceForNextSearch |
25 |
lastReplacementInfo' |
|
2724 | 26 |
classVariableNames:'DefaultCursorForegroundColor DefaultCursorBackgroundColor |
27 |
DefaultCursorType DefaultCursorNoFocusForegroundColor |
|
28 |
DefaultCursorTypeNoFocus' |
|
29 |
poolDictionaries:'' |
|
30 |
category:'Views-Text' |
|
0 | 31 |
! |
32 |
||
2952 | 33 |
Object subclass:#EditAction |
3115 | 34 |
instanceVariableNames:'userFriendlyInfo' |
2952 | 35 |
classVariableNames:'' |
36 |
poolDictionaries:'' |
|
37 |
privateIn:EditTextView |
|
38 |
! |
|
39 |
||
40 |
EditTextView::EditAction subclass:#DeleteRange |
|
41 |
instanceVariableNames:'line1 col1 line2 col2' |
|
42 |
classVariableNames:'' |
|
43 |
poolDictionaries:'' |
|
44 |
privateIn:EditTextView |
|
45 |
! |
|
46 |
||
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
47 |
EditTextView::EditAction subclass:#DeleteCharacters |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
48 |
instanceVariableNames:'line col1 col2' |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
49 |
classVariableNames:'' |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
50 |
poolDictionaries:'' |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
51 |
privateIn:EditTextView |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
52 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
53 |
|
3235 | 54 |
Object subclass:#EditMode |
55 |
instanceVariableNames:'' |
|
56 |
classVariableNames:'' |
|
57 |
poolDictionaries:'' |
|
58 |
privateIn:EditTextView |
|
59 |
! |
|
60 |
||
61 |
EditTextView::EditMode subclass:#InsertAndSelectMode |
|
62 |
instanceVariableNames:'' |
|
63 |
classVariableNames:'' |
|
64 |
poolDictionaries:'' |
|
65 |
privateIn:EditTextView::EditMode |
|
66 |
! |
|
67 |
||
68 |
EditTextView::EditMode subclass:#InsertMode |
|
69 |
instanceVariableNames:'' |
|
70 |
classVariableNames:'' |
|
71 |
poolDictionaries:'' |
|
72 |
privateIn:EditTextView::EditMode |
|
73 |
! |
|
74 |
||
75 |
EditTextView::EditMode subclass:#OverwriteMode |
|
76 |
instanceVariableNames:'' |
|
77 |
classVariableNames:'InsertMode OverwriteMode InsertAndSelectMode' |
|
78 |
poolDictionaries:'' |
|
79 |
privateIn:EditTextView::EditMode |
|
80 |
! |
|
81 |
||
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
82 |
Query subclass:#ExecutingMacroQuery |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
83 |
instanceVariableNames:'' |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
84 |
classVariableNames:'' |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
85 |
poolDictionaries:'' |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
86 |
privateIn:EditTextView |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
87 |
! |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
88 |
|
4048 | 89 |
Object subclass:#LastReplacementInfo |
90 |
instanceVariableNames:'lastReplacement lastStringToReplace lastReplaceWasMatch |
|
91 |
lastReplaceIgnoredCase' |
|
92 |
classVariableNames:'' |
|
93 |
poolDictionaries:'' |
|
94 |
privateIn:EditTextView |
|
95 |
! |
|
96 |
||
2952 | 97 |
EditTextView::EditAction subclass:#PasteString |
98 |
instanceVariableNames:'line col string selected' |
|
99 |
classVariableNames:'' |
|
100 |
poolDictionaries:'' |
|
101 |
privateIn:EditTextView |
|
102 |
! |
|
103 |
||
104 |
EditTextView::EditAction subclass:#ReplaceCharacter |
|
105 |
instanceVariableNames:'line col character' |
|
106 |
classVariableNames:'' |
|
107 |
poolDictionaries:'' |
|
108 |
privateIn:EditTextView |
|
109 |
! |
|
110 |
||
3235 | 111 |
EditTextView::EditAction subclass:#ReplaceCharacters |
112 |
instanceVariableNames:'line col1 col2 characters' |
|
113 |
classVariableNames:'' |
|
114 |
poolDictionaries:'' |
|
115 |
privateIn:EditTextView |
|
116 |
! |
|
117 |
||
3131 | 118 |
EditTextView::EditAction subclass:#ReplaceContents |
119 |
instanceVariableNames:'text' |
|
120 |
classVariableNames:'' |
|
121 |
poolDictionaries:'' |
|
122 |
privateIn:EditTextView |
|
123 |
! |
|
124 |
||
3130 | 125 |
EditTextView::EditAction subclass:#ReplaceLine |
126 |
instanceVariableNames:'line text' |
|
127 |
classVariableNames:'' |
|
128 |
poolDictionaries:'' |
|
129 |
privateIn:EditTextView |
|
130 |
! |
|
131 |
||
3402 | 132 |
EditTextView::EditAction subclass:#ReplaceLines |
133 |
instanceVariableNames:'line text' |
|
134 |
classVariableNames:'' |
|
135 |
poolDictionaries:'' |
|
136 |
privateIn:EditTextView |
|
137 |
! |
|
138 |
||
865 | 139 |
!EditTextView class methodsFor:'documentation'! |
0 | 140 |
|
33 | 141 |
copyright |
142 |
" |
|
143 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
3160 | 144 |
All Rights Reserved |
33 | 145 |
|
146 |
This software is furnished under a license and may be used |
|
147 |
only in accordance with the terms of that license and with the |
|
148 |
inclusion of the above copyright notice. This software may not |
|
149 |
be provided or otherwise made available to, or used by, any |
|
150 |
other person. No title to or ownership of the software is |
|
151 |
hereby transferred. |
|
152 |
" |
|
153 |
! |
|
154 |
||
0 | 155 |
documentation |
156 |
" |
|
157 |
a view for editable text - adds editing functionality to TextView |
|
3160 | 158 |
Also, it adds accept functionality, and defines a new actionBlock: |
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
159 |
acceptAction to be performed for accept |
125 | 160 |
|
161 |
If used with a model, this is informed by sending it a changeMsg with |
|
162 |
the current contents as argument. |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
163 |
(however, it is possible to define both changeMsg and acceptAction) |
125 | 164 |
|
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
165 |
Please read the historic notice in the ListView class. |
0 | 166 |
|
586 | 167 |
[Instance variables:] |
0 | 168 |
|
4010 | 169 |
cursorLine <Number> line where cursor sits (1..) |
170 |
||
171 |
cursorVisibleLine <Number> visible line where cursor sits (1..nLinesShown) |
|
172 |
||
173 |
cursorCol <Number> col where cursor sits (1..) |
|
174 |
||
175 |
cursorShown <Boolean> true, if cursor is currently shown |
|
176 |
||
177 |
readOnly <Boolean> true, if text may not be edited |
|
178 |
||
179 |
modifiedChannel <ValueHolder> holding true, if text has been modified. |
|
180 |
cleared on accept. |
|
181 |
||
182 |
acceptChannel <ValueHolder> holding true, if text has been accepted. |
|
183 |
||
184 |
fixedSize <Boolean> true, if no lines may be added/removed |
|
185 |
||
186 |
exceptionBlock <Block> block to be evaluated when readonly text is about to be modified |
|
187 |
if it returns true, the modification will be done anyway. |
|
188 |
if it returns anything else, the modification is not done. |
|
189 |
||
190 |
cursorFgColor <Color> color used for cursor drawing |
|
191 |
cursorBgColor <Color> color used for cursor drawing |
|
192 |
||
193 |
cursorType <Symbol> how the cursor is drawn; currently implemented |
|
194 |
are #block (solid-block cursor), #ibeam |
|
195 |
(vertical bar at insertion point) |
|
196 |
and #caret (caret below insertion-point) |
|
197 |
||
198 |
cursorTypeNoFocus <Symbol> like above, if view has no focus |
|
199 |
nil means: hide the cursor. |
|
200 |
||
201 |
undoAction <Block> block which undoes last cut, paste or replace |
|
202 |
(not yet fully implemented) |
|
203 |
||
204 |
typeOfSelection <Symbol> #paste, if selection created by paste, nil otherwise |
|
205 |
this affects the next keyPress: if #paste it does not |
|
206 |
replace; otherwise it replaces the selection. |
|
207 |
||
208 |
lastCut <String> last cut or replaced string |
|
209 |
||
4053 | 210 |
lastReplacementInfo <LastReplacementInfo> holds the information about the last replace action |
211 |
lastStringToReplace is the string to be replaced by lastReplacement |
|
212 |
lastReplacement is the string to replace lastStringToReplace |
|
213 |
||
214 |
lastStringFromReplaceForNextSearch <String> string to be taken be the next search action |
|
215 |
(cleared after a new selection) |
|
4010 | 216 |
|
217 |
replacing <Boolean> true if entered characters replace last selection |
|
218 |
||
219 |
showMatchingParenthesis <Boolean> if true, shows matching parenthesis |
|
220 |
when entering one; this is the default. |
|
221 |
||
222 |
hasKeyboardFocus <Boolean> true if this view has the focus |
|
223 |
||
224 |
acceptAction <Block> accept action - evaluated passing the contents as |
|
225 |
argument |
|
226 |
||
227 |
tabMeansNextField <Boolean> if true, Tab is ignored as input and shifts keyboard |
|
228 |
focus to the next field. For editTextViews, this is false |
|
229 |
by default (i.e. tabs can be entered into the text). |
|
230 |
For some subclasses (inputFields), this may be true. |
|
231 |
||
232 |
trimBlankLines <Boolean> if true, trailing blanks are |
|
233 |
removed when editing. |
|
234 |
Default is true. |
|
235 |
||
236 |
wordWrap <Boolean> Currently not used. |
|
237 |
||
238 |
lockUpdates <Boolean> internal, private |
|
239 |
||
240 |
prevCursorState <Boolean> temporary, private |
|
241 |
||
242 |
cursorMovementWhenUpdating |
|
243 |
<Symbol> defines where the cursor is to be positioned if the |
|
244 |
model changes its value by some outside activity |
|
245 |
(i.e. not by user input into the field). |
|
246 |
Can be one of: |
|
247 |
#keep / nil -> stay where it was |
|
248 |
#endOfText -> cursor to the end |
|
249 |
#endOfLine -> stay in the line, but move to end |
|
250 |
#beginOfText -> cursor to the beginning |
|
251 |
#beginOfLine -> stay in the line, but move to begin |
|
252 |
The default is #beginOfText |
|
253 |
||
254 |
||
255 |
||
256 |
dropTarget <DropTarget|nil> drop operation descriptor or nil (drop disabled) |
|
2589 | 257 |
|
258 |
||
2712
e83d71c9bdec
ST80Mode classVariables is now UserPreferences.st80EditMode
Claus Gittinger <cg@exept.de>
parents:
2707
diff
changeset
|
259 |
userPreference values: |
4010 | 260 |
userPreferences.st80EditMode |
261 |
<Boolean> if true, cursor positioning is |
|
262 |
done as in vi or ST80; i.e. |
|
263 |
wysiwyg mode is somewhat relaxed, |
|
264 |
in that the cursor cannot be |
|
265 |
positioned behind a lines end. |
|
266 |
This is not yet completely implemented. |
|
33 | 267 |
used globals: |
268 |
||
4010 | 269 |
DeleteHistory <Text> last 1000 lines of deleted text |
270 |
(but only if this variable exists already) |
|
586 | 271 |
|
272 |
[styleSheet parameters:] |
|
121 | 273 |
|
4010 | 274 |
textCursorForegroundColor <Color> cursor fg color; default: text background |
275 |
textCursorBackgroundColor <Color> cursor bg color; default: text foreground |
|
276 |
textCursorNoFocusForegroundColor |
|
277 |
<Color> cursor fg color if no focus; default: cursor fg color |
|
278 |
textCursorType <Symbol> cursor type; default: #block |
|
586 | 279 |
|
280 |
[author:] |
|
4010 | 281 |
Claus Gittinger |
586 | 282 |
|
283 |
[see also:] |
|
4010 | 284 |
CodeView Workspace TextView ListView |
285 |
EditField |
|
0 | 286 |
" |
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
287 |
! |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
288 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
289 |
examples |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
290 |
" |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
291 |
non MVC operation: |
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
292 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
293 |
basic setup: |
3160 | 294 |
[exBegin] |
295 |
|top textView| |
|
296 |
||
297 |
top := StandardSystemView new. |
|
298 |
top extent:300@200. |
|
299 |
||
300 |
textView := EditTextView new. |
|
301 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
302 |
top addSubView:textView. |
|
303 |
||
304 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
305 |
||
306 |
top open. |
|
307 |
[exEnd] |
|
594 | 308 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
309 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
310 |
with vertical scrollbar: |
3160 | 311 |
[exBegin] |
312 |
|top scrollView textView| |
|
313 |
||
314 |
top := StandardSystemView new. |
|
315 |
top extent:300@200. |
|
316 |
||
317 |
scrollView := ScrollableView for:EditTextView. |
|
318 |
textView := scrollView scrolledView. |
|
319 |
scrollView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
320 |
top addSubView:scrollView. |
|
321 |
||
322 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
323 |
||
324 |
top open. |
|
325 |
[exEnd] |
|
594 | 326 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
327 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
328 |
with horizontal & vertical scrollbars: |
3160 | 329 |
[exBegin] |
330 |
|top scrollView textView| |
|
331 |
||
332 |
top := StandardSystemView new. |
|
333 |
top extent:300@200. |
|
334 |
||
335 |
scrollView := HVScrollableView for:EditTextView. |
|
336 |
textView := scrollView scrolledView. |
|
337 |
scrollView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
338 |
top addSubView:scrollView. |
|
339 |
||
340 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
341 |
||
342 |
top open. |
|
343 |
[exEnd] |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
344 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
345 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
346 |
set the action for accept: |
3160 | 347 |
[exBegin] |
348 |
|top textView| |
|
349 |
||
350 |
top := StandardSystemView new. |
|
351 |
top extent:300@200. |
|
352 |
||
353 |
textView := EditTextView new. |
|
354 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
355 |
top addSubView:textView. |
|
356 |
||
357 |
textView contents:('/etc/hosts' asFilename contentsOfEntireFile). |
|
358 |
textView acceptAction:[:contents | |
|
359 |
Transcript showCR:'will not overwrite the file with:'. |
|
360 |
Transcript showCR:contents asString |
|
361 |
]. |
|
362 |
top open. |
|
363 |
[exEnd] |
|
594 | 364 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
365 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
366 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
367 |
non-string (text) items: |
3160 | 368 |
[exBegin] |
369 |
|top textView list| |
|
370 |
||
371 |
list := '/etc/hosts' asFilename contentsOfEntireFile asStringCollection. |
|
372 |
1 to:list size by:2 do:[:nr | |
|
373 |
list at:nr put:(Text string:(list at:nr) |
|
374 |
emphasis:(Array with:#bold with:(#color->Color red))) |
|
375 |
]. |
|
376 |
||
377 |
top := StandardSystemView new. |
|
378 |
top extent:300@200. |
|
379 |
||
380 |
textView := EditTextView new. |
|
381 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
382 |
top addSubView:textView. |
|
383 |
||
384 |
textView contents:list. |
|
385 |
top open. |
|
386 |
[exEnd] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
387 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
388 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
389 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
390 |
MVC operation: |
594 | 391 |
(the examples model here is a plug simulating a real model; |
392 |
real world applications would not use a plug ..) |
|
3160 | 393 |
[exBegin] |
394 |
|top textView model| |
|
395 |
||
396 |
model := Plug new. |
|
397 |
model respondTo:#accepted: |
|
398 |
with:[:newContents | |
|
399 |
Transcript showCR:'will not overwrite the file with:'. |
|
400 |
Transcript showCR:newContents asString |
|
401 |
]. |
|
402 |
model respondTo:#getList |
|
403 |
with:['/etc/hosts' asFilename contentsOfEntireFile]. |
|
404 |
||
405 |
||
406 |
top := StandardSystemView new. |
|
407 |
top extent:300@200. |
|
408 |
||
409 |
textView := EditTextView new. |
|
410 |
textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
411 |
top addSubView:textView. |
|
412 |
||
413 |
textView listMessage:#getList; |
|
414 |
model:model; |
|
415 |
changeMessage:#accepted:; |
|
416 |
aspect:#list. |
|
417 |
top open. |
|
418 |
[exEnd] |
|
594 | 419 |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
420 |
|
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
421 |
two textViews on the same model: |
3160 | 422 |
[exBegin] |
423 |
|top1 textView1 top2 textView2 model currentContents| |
|
424 |
||
425 |
model := Plug new. |
|
426 |
model respondTo:#accepted: |
|
427 |
with:[:newContents | |
|
428 |
Transcript showCR:'accepted:'. |
|
429 |
Transcript showCR:newContents asString. |
|
430 |
currentContents := newContents. |
|
431 |
model changed:#contents |
|
432 |
]. |
|
433 |
model respondTo:#getList |
|
434 |
with:[Transcript showCR:'query'. |
|
435 |
currentContents]. |
|
436 |
||
437 |
||
438 |
top1 := StandardSystemView new. |
|
439 |
top1 extent:300@200. |
|
440 |
||
441 |
textView1 := EditTextView new. |
|
442 |
textView1 origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
443 |
top1 addSubView:textView1. |
|
444 |
||
445 |
textView1 listMessage:#getList; |
|
446 |
model:model; |
|
447 |
aspect:#contents; |
|
448 |
changeMessage:#accepted:. |
|
449 |
top1 open. |
|
450 |
||
451 |
top2 := StandardSystemView new. |
|
452 |
top2 extent:300@200. |
|
453 |
||
454 |
textView2 := EditTextView new. |
|
455 |
textView2 origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
456 |
top2 addSubView:textView2. |
|
457 |
||
458 |
textView2 listMessage:#getList; |
|
459 |
model:model; |
|
460 |
aspect:#contents; |
|
461 |
changeMessage:#accepted:. |
|
462 |
top2 open. |
|
463 |
[exEnd] |
|
297
08eec8838a4c
beep if cursor leaves the visible area
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
464 |
" |
0 | 465 |
! ! |
466 |
||
865 | 467 |
!EditTextView class methodsFor:'defaults'! |
59 | 468 |
|
1419 | 469 |
st80Mode |
470 |
"return true, if the st80 editing mode is turned on. |
|
471 |
This setting affects the behavior of the cursor, when positioned |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
472 |
beyond the end of a line or the end of the text." |
1419 | 473 |
|
2647
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
474 |
^ UserPreferences current st80EditMode |
1419 | 475 |
|
476 |
" |
|
477 |
EditTextView st80Mode:true |
|
478 |
EditTextView st80Mode:false |
|
479 |
" |
|
480 |
||
481 |
"Modified: / 16.1.1998 / 22:54:57 / cg" |
|
482 |
! |
|
483 |
||
484 |
st80Mode:aBoolean |
|
485 |
"turns on/off st80 behavior, where the cursor cannot be positioned |
|
2707 | 486 |
beyond the end of a line or the last line" |
1419 | 487 |
|
2647
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
488 |
UserPreferences current st80EditMode:aBoolean. |
1419 | 489 |
|
490 |
" |
|
491 |
EditTextView st80Mode:true |
|
492 |
EditTextView st80Mode:false |
|
493 |
" |
|
494 |
||
495 |
"Modified: / 16.1.1998 / 22:55:19 / cg" |
|
496 |
! |
|
497 |
||
59 | 498 |
updateStyleCache |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
499 |
"extract values from the styleSheet and cache them in class variables" |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
500 |
|
1390 | 501 |
<resource: #style (#'textCursor.foregroundColor' #'textCursor.backgroundColor' |
3160 | 502 |
#'textCursor.noFocusForegroundColor' |
503 |
#'textCursor.type' |
|
504 |
#'textCursor.typeNoFocus' |
|
505 |
#'editText.st80Mode')> |
|
1355 | 506 |
|
507 |
DefaultCursorForegroundColor := StyleSheet colorAt:'textCursor.foregroundColor'. |
|
508 |
DefaultCursorBackgroundColor := StyleSheet colorAt:'textCursor.backgroundColor'. |
|
509 |
DefaultCursorNoFocusForegroundColor := StyleSheet colorAt:'textCursor.noFocusForegroundColor'. |
|
510 |
DefaultCursorType := StyleSheet at:'textCursor.type' default:#block. |
|
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
511 |
DefaultCursorTypeNoFocus := StyleSheet at:'textCursor.typeNoFocus'. |
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
512 |
|
1419 | 513 |
" |
514 |
self updateStyleCache |
|
515 |
" |
|
516 |
||
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
517 |
"Modified: / 20.5.1998 / 04:27:41 / cg" |
59 | 518 |
! ! |
519 |
||
3431 | 520 |
!EditTextView class methodsFor:'specs'! |
521 |
||
522 |
searchReplaceDialogSpec |
|
523 |
"This resource specification was automatically generated |
|
524 |
by the UIPainter of ST/X." |
|
525 |
||
526 |
"Do not manually edit this!! If it is corrupted, |
|
527 |
the UIPainter may not be able to read the specification." |
|
528 |
||
529 |
" |
|
530 |
UIPainter new openOnClass:DAPASX::ProjectEditorTextView andSelector:#searchReplaceDialogSpec |
|
531 |
" |
|
532 |
||
533 |
<resource: #canvas> |
|
534 |
||
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
535 |
^ |
3431 | 536 |
#(FullSpec |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
537 |
name: searchReplaceDialogSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
538 |
window: |
3431 | 539 |
(WindowSpec |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
540 |
label: 'String Search and Replace' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
541 |
name: 'String Search and Replace' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
542 |
min: (Point 283 196) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
543 |
max: (Point 283 196) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
544 |
bounds: (Rectangle 0 0 279 192) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
545 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
546 |
component: |
3431 | 547 |
(SpecCollection |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
548 |
collection: ( |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
549 |
(LabelSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
550 |
label: 'Search Pattern:' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
551 |
name: 'label' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
552 |
layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
553 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
554 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
555 |
adjust: left |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
556 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
557 |
(ComboBoxSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
558 |
name: 'patternComboBox' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
559 |
layout: (LayoutFrame 3 0.0 26 0 -3 1.0 48 0) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
560 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
561 |
model: searchPattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
562 |
immediateAccept: false |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
563 |
acceptOnLeave: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
564 |
acceptOnReturn: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
565 |
acceptOnTab: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
566 |
acceptOnLostFocus: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
567 |
acceptOnPointerLeave: false |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
568 |
autoSelectInitialText: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
569 |
comboList: patternList |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
570 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
571 |
(ComboBoxSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
572 |
name: 'replaceComboBox' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
573 |
layout: (LayoutFrame 3 0.0 76 0 -3 1.0 98 0) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
574 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
575 |
model: replacePattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
576 |
immediateAccept: false |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
577 |
acceptOnLeave: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
578 |
acceptOnReturn: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
579 |
acceptOnTab: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
580 |
acceptOnLostFocus: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
581 |
acceptOnPointerLeave: false |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
582 |
autoSelectInitialText: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
583 |
comboList: patternList |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
584 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
585 |
(CheckBoxSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
586 |
label: 'Ignore Case' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
587 |
name: 'ignoreCaseCheckBox' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
588 |
layout: (LayoutFrame 3 0.0 107 0 -3 1.0 130 0) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
589 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
590 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
591 |
model: ignoreCase |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
592 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
593 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
594 |
(VariableVerticalPanelSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
595 |
name: 'VariableVerticalPanel1' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
596 |
layout: (LayoutFrame 0 0 -64 1 0 1 -4 1) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
597 |
component: |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
598 |
(SpecCollection |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
599 |
collection: ( |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
600 |
(HorizontalPanelViewSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
601 |
name: 'HorizontalPanel1' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
602 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
603 |
horizontalLayout: fitSpace |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
604 |
verticalLayout: center |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
605 |
horizontalSpace: 3 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
606 |
verticalSpace: 3 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
607 |
ignoreInvisibleComponents: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
608 |
reverseOrderIfOKAtLeft: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
609 |
component: |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
610 |
(SpecCollection |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
611 |
collection: ( |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
612 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
613 |
label: 'Replace' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
614 |
name: 'replaceButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
615 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
616 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
617 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
618 |
model: replaceAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
619 |
extent: (Point 134 21) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
620 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
621 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
622 |
label: 'Replace All' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
623 |
name: 'replaceAllButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
624 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
625 |
borderWidth: 1 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
626 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
627 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
628 |
model: replaceAllAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
629 |
extent: (Point 134 21) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
630 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
631 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
632 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
633 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
634 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
635 |
(HorizontalPanelViewSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
636 |
name: 'horizontalPanelView' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
637 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
638 |
horizontalLayout: fitSpace |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
639 |
verticalLayout: center |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
640 |
horizontalSpace: 3 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
641 |
verticalSpace: 3 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
642 |
ignoreInvisibleComponents: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
643 |
reverseOrderIfOKAtLeft: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
644 |
component: |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
645 |
(SpecCollection |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
646 |
collection: ( |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
647 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
648 |
label: 'Cancel' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
649 |
name: 'cancelButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
650 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
651 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
652 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
653 |
model: cancel |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
654 |
extent: (Point 88 21) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
655 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
656 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
657 |
label: 'Prev' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
658 |
name: 'prevButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
659 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
660 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
661 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
662 |
model: prevAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
663 |
extent: (Point 89 21) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
664 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
665 |
(ActionButtonSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
666 |
label: 'Next' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
667 |
name: 'nextButton' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
668 |
level: 2 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
669 |
borderWidth: 1 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
670 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
671 |
tabable: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
672 |
model: nextAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
673 |
isDefault: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
674 |
extent: (Point 88 21) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
675 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
676 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
677 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
678 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
679 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
680 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
681 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
682 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
683 |
handles: (Any 0.5 1.0) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
684 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
685 |
(LabelSpec |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
686 |
label: 'Replace By:' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
687 |
name: 'ReplaceLabel' |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
688 |
layout: (LayoutFrame 1 0.0 53 0 -1 1.0 70 0) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
689 |
level: 0 |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
690 |
translateLabel: true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
691 |
adjust: left |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
692 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
693 |
) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
694 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
695 |
) |
3431 | 696 |
) |
697 |
||
698 |
"Modified: / 11-10-2006 / 21:05:09 / cg" |
|
699 |
! ! |
|
700 |
||
2744 | 701 |
!EditTextView methodsFor:'Compatibility-ST80'! |
1552
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
702 |
|
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
703 |
autoAccept:aBoolean |
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
704 |
"ignored for now" |
d3d4afaf4c68
dummy ST80 compatibility: #autoAccept:
Claus Gittinger <cg@exept.de>
parents:
1548
diff
changeset
|
705 |
|
2019 | 706 |
"Created: / 5.6.1998 / 15:30:32 / cg " |
1585
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
707 |
! |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
708 |
|
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
709 |
continuousAccept:aBoolean |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
710 |
"ignored for now" |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
711 |
|
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
712 |
"Created: / 19.6.1998 / 00:03:49 / cg" |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
713 |
! |
9bf6cf249376
two more ST-80 compatibility methods.
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
714 |
|
1390 | 715 |
cutSelection |
716 |
self cut |
|
717 |
||
718 |
"Created: / 31.10.1997 / 03:29:50 / cg" |
|
719 |
! |
|
720 |
||
1590 | 721 |
deselect |
722 |
"remove the selection" |
|
723 |
||
724 |
^ self unselect |
|
725 |
||
726 |
"Created: / 19.6.1998 / 02:41:54 / cg" |
|
727 |
! |
|
728 |
||
2101 | 729 |
enabled:aBoolean |
730 |
||
731 |
self readOnly:aBoolean not |
|
732 |
||
733 |
"Created: / 30.3.1999 / 15:10:23 / stefan" |
|
734 |
"Modified: / 30.3.1999 / 15:10:53 / stefan" |
|
735 |
! |
|
736 |
||
1732
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
737 |
find:pattern |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
738 |
self searchFwd:pattern ifAbsent:nil |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
739 |
|
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
740 |
"Created: / 29.1.1999 / 19:09:42 / cg" |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
741 |
"Modified: / 29.1.1999 / 19:10:12 / cg" |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
742 |
! |
2d433e114bbc
added #find: (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
743 |
|
1294
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
744 |
insert:aString at:aCharacterPosition |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
745 |
"insert a string at aCharacterPosition." |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
746 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
747 |
|line col| |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
748 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
749 |
line := self lineOfCharacterPosition:aCharacterPosition. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
750 |
col := aCharacterPosition - (self characterPositionOfLine:line col:1) + 1. |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
751 |
col < 1 ifTrue:[ |
3160 | 752 |
col := 1 |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
753 |
]. |
1294
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
754 |
self insertString:aString atLine:line col:col. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
755 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
756 |
" |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
757 |
|top v| |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
758 |
|
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
759 |
top := StandardSystemView new. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
760 |
top extent:300@300. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
761 |
v := EditTextView origin:0.0@0.0 corner:1.0@1.0 in:top. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
762 |
top openAndWait. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
763 |
v contents:'1234567890\1234567890\1234567890\' withCRs. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
764 |
v insert:'<- hello there' at:5. |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
765 |
" |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
766 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
767 |
"Modified: / 5.4.1998 / 17:20:08 / cg" |
1294
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
768 |
! |
dac755d4acd3
added #insert:at: - for inserting at a particular character position.
Claus Gittinger <cg@exept.de>
parents:
1292
diff
changeset
|
769 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
770 |
insertAndSelect:aString at:aCharacterPosition |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
771 |
"insert a selected string at aCharacterPosition." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
772 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
773 |
|line col| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
774 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
775 |
line := self lineOfCharacterPosition:aCharacterPosition. |
2310 | 776 |
col := (aCharacterPosition - (self characterPositionOfLine:line col:1) + 1) max:1. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
777 |
self insertString:aString atLine:line col:col. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
778 |
self selectFromLine:line col:col toLine:line col:col + aString size - 1 |
125 | 779 |
" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
780 |
|v| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
781 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
782 |
v := EditTextView new openAndWait. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
783 |
v contents:'1234567890\1234567890\1234567890\' withCRs. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
784 |
v insertAndSelect:'<- hello there' at:5. |
125 | 785 |
" |
1390 | 786 |
! |
787 |
||
788 |
pasteSelection |
|
789 |
self paste |
|
790 |
||
791 |
"Created: / 31.10.1997 / 03:28:53 / cg" |
|
1590 | 792 |
! |
793 |
||
794 |
replaceSelectionWith:aString |
|
795 |
^ self replaceSelectionBy:aString |
|
796 |
||
797 |
"Created: / 19.6.1998 / 02:42:32 / cg" |
|
798 |
! |
|
799 |
||
800 |
selectAt:pos |
|
801 |
"move the cursor before cursorPosition." |
|
802 |
||
803 |
self cursorToCharacterPosition:pos |
|
804 |
||
805 |
"Modified: / 19.6.1998 / 02:41:28 / cg" |
|
806 |
"Created: / 19.6.1998 / 02:43:39 / cg" |
|
807 |
! |
|
808 |
||
809 |
selectFrom:startPos to:endPos |
|
810 |
"change the selection given two aCharacterPositions." |
|
811 |
||
812 |
|line1 col1 line2 col2| |
|
813 |
||
814 |
startPos > endPos ifTrue:[ |
|
3160 | 815 |
^ self unselect |
1590 | 816 |
]. |
817 |
||
818 |
line1 := self lineOfCharacterPosition:startPos. |
|
819 |
col1 := startPos - (self characterPositionOfLine:line1 col:1) + 1. |
|
820 |
col1 < 1 ifTrue:[ |
|
3160 | 821 |
col1 := 1 |
1590 | 822 |
]. |
823 |
line2 := self lineOfCharacterPosition:endPos. |
|
824 |
col2 := startPos - (self characterPositionOfLine:line2 col:1) + 1. |
|
825 |
col2 < 1 ifTrue:[ |
|
3160 | 826 |
col2 := 1 |
1590 | 827 |
]. |
828 |
self selectFromLine:line1 col:col1 toLine:line2 col:col2 |
|
829 |
||
830 |
"Modified: / 19.6.1998 / 02:41:28 / cg" |
|
2101 | 831 |
! |
832 |
||
833 |
textHasChanged |
|
834 |
^ self modified |
|
835 |
||
836 |
"Created: / 19.6.1998 / 00:09:43 / cg" |
|
2117
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
837 |
! |
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
838 |
|
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
839 |
textHasChanged:aBoolean |
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
840 |
"ST-80 compatibility: set/clear the modified flag." |
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
841 |
|
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
842 |
self modified:aBoolean |
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
843 |
|
b50c6d182e28
added #textHasChanged: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
844 |
"Created: / 5.2.2000 / 17:07:59 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
845 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
846 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
847 |
!EditTextView methodsFor:'accessing-behavior'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
848 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
849 |
acceptAction |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
850 |
"return the action to be performed on accept (or nil)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
851 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
852 |
^ acceptAction |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
853 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
854 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
855 |
acceptAction:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
856 |
"set the action to be performed on accept" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
857 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
858 |
acceptAction := aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
859 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
860 |
|
2792 | 861 |
acceptChannel |
862 |
"return the valueHolder holding true if text was accepted. |
|
863 |
By placing a true into this channel, an accept can also be forced." |
|
864 |
||
865 |
^ acceptChannel |
|
866 |
||
867 |
"Modified: / 30.1.1998 / 14:17:11 / cg" |
|
868 |
! |
|
869 |
||
870 |
acceptChannel:aValueHolder |
|
871 |
"set the valueHolder holding true if text was accepted. |
|
872 |
By placing a true into this channel, an accept can also be forced." |
|
873 |
||
874 |
|prev| |
|
875 |
||
876 |
prev := acceptChannel. |
|
877 |
acceptChannel := aValueHolder. |
|
878 |
self setupChannel:aValueHolder for:nil withOld:prev |
|
879 |
||
880 |
"Created: / 30.1.1998 / 14:51:09 / cg" |
|
881 |
! |
|
882 |
||
1108 | 883 |
acceptEnabled:aBoolean |
884 |
"enable/disable accept. This greys the corresponding item in the menu" |
|
885 |
||
886 |
acceptEnabled := aBoolean |
|
887 |
||
888 |
"Created: 7.3.1997 / 11:04:34 / cg" |
|
889 |
! |
|
890 |
||
2792 | 891 |
accepted |
892 |
"return true if text was accepted" |
|
893 |
||
894 |
^ acceptChannel value |
|
895 |
||
896 |
"Created: 14.2.1997 / 16:43:46 / cg" |
|
897 |
! |
|
898 |
||
899 |
accepted:aBoolean |
|
900 |
"set/clear the accepted flag. |
|
901 |
This may force my current contents to be placed into my model." |
|
902 |
||
903 |
acceptChannel value:aBoolean. |
|
904 |
||
905 |
"Created: / 14.2.1997 / 16:44:01 / cg" |
|
906 |
"Modified: / 30.1.1998 / 14:20:15 / cg" |
|
907 |
! |
|
908 |
||
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
909 |
autoIndent:aBoolean |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
910 |
autoIndent := aBoolean |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
911 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
912 |
"Created: 5.3.1996 / 14:37:50 / cg" |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
913 |
! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
914 |
|
2774 | 915 |
cursorMovementWhenUpdating |
3160 | 916 |
"return what is be done with the cursor, |
2774 | 917 |
when I get a new text (via the model or the #contents/#list) |
918 |
Allowed arguments are: |
|
3160 | 919 |
#keep / nil -> stay where it was |
920 |
#endOfText -> position cursor to the end |
|
921 |
#beginOfText -> position cursor to the beginning |
|
922 |
#endOfLine -> position cursor to the current lines end |
|
923 |
#beginOfLine -> position cursor to the current lines start |
|
2774 | 924 |
The default is #beginOfText. |
925 |
This may be useful for fields which get new values assigned from |
|
926 |
the program (i.e. not from the user)" |
|
927 |
||
928 |
^ cursorMovementWhenUpdating |
|
929 |
||
930 |
"Modified: 16.12.1995 / 16:27:55 / cg" |
|
931 |
! |
|
932 |
||
2133 | 933 |
cursorMovementWhenUpdating:aSymbolOrNil |
3160 | 934 |
"define what should be done with the cursor, |
2133 | 935 |
when I get a new text (via the model or the #contents/#list) |
936 |
Allowed arguments are: |
|
3160 | 937 |
#keep / nil -> stay where it was |
938 |
#endOfText -> position cursor to the end |
|
939 |
#beginOfText -> position cursor to the beginning |
|
940 |
#endOfLine -> position cursor to the current lines end |
|
941 |
#beginOfLine -> position cursor to the current lines start |
|
2133 | 942 |
The default is #beginOfText. |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
943 |
This may be useful for fields which get new values assigned from |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
944 |
the program (i.e. not from the user)" |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
945 |
|
2133 | 946 |
cursorMovementWhenUpdating := aSymbolOrNil |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
947 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
948 |
"Modified: 16.12.1995 / 16:27:55 / cg" |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
949 |
! |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
950 |
|
2035
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
951 |
disableIfInvisible:aBoolean |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
952 |
disableIfInvisible := aBoolean |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
953 |
! |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
954 |
|
2438 | 955 |
dontReplaceSelectionOnInput |
956 |
typeOfSelection := #paste |
|
957 |
! |
|
958 |
||
3235 | 959 |
editModeHolder |
960 |
^ editMode. |
|
961 |
! |
|
962 |
||
963 |
editModeInsert |
|
964 |
editMode value:EditMode insertMode |
|
965 |
! |
|
966 |
||
967 |
editModeInsertAndSelect |
|
968 |
editMode value:EditMode insertAndSelectMode |
|
969 |
! |
|
970 |
||
971 |
editModeOverwrite |
|
972 |
editMode value:EditMode overwriteMode |
|
973 |
! |
|
974 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
975 |
exceptionBlock:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
976 |
"define the action to be triggered when user tries to modify |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
977 |
readonly text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
978 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
979 |
exceptionBlock := aBlock |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
980 |
! |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
981 |
|
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
982 |
fixedSize |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
983 |
"make the texts size fixed (no lines may be added). |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
984 |
OBSOLETE: use readOnly" |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
985 |
|
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
986 |
<resource:#obsolete> |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
987 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
988 |
|menu| |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
989 |
|
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
990 |
self obsoleteMethodWarning:'use #readOnly:'. |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
991 |
readOnly == true ifFalse:[ |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
992 |
readOnly := true. |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
993 |
(menu := self middleButtonMenu) notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
994 |
menu disableAll:#(cut paste replace indent) |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
995 |
] |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
996 |
] |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
997 |
|
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
998 |
"Modified: 14.2.1997 / 17:35:24 / cg" |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
999 |
! |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
1000 |
|
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
1001 |
insertMode:aBoolean |
3235 | 1002 |
editMode value:(aBoolean ifTrue:[EditMode insertMode] ifFalse:[EditMode overwriteMode]) |
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
1003 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
1004 |
"Created: 6.3.1996 / 12:24:05 / cg" |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
1005 |
! |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
1006 |
|
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
1007 |
insertModeHolder |
3235 | 1008 |
^ BlockValue |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1009 |
with:[:m | m isInsertMode] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1010 |
argument:(editMode). |
3465 | 1011 |
|
1012 |
"Modified: / 08-03-2007 / 22:58:37 / cg" |
|
3235 | 1013 |
! |
1014 |
||
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1015 |
isInInsertMode |
3235 | 1016 |
^ editMode value isInsertMode |
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
1017 |
! |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
1018 |
|
2792 | 1019 |
isReadOnly |
1020 |
"return true, if the text is readonly." |
|
1021 |
||
1022 |
^ readOnly value |
|
1023 |
||
1024 |
"Modified: 14.2.1997 / 17:35:56 / cg" |
|
1025 |
! |
|
1026 |
||
2796 | 1027 |
modeLabelHolder |
1028 |
"a valueHolder, which contains 'L' (learnMode), I (insertMode) or empty" |
|
1029 |
||
3160 | 1030 |
^ BlockValue |
4041 | 1031 |
with:[:e :l | |
1032 |
self isReadOnly ifTrue:[ |
|
1033 |
'' |
|
1034 |
] ifFalse:[ |
|
1035 |
l ifTrue:[ 'L' allBold colorizeAllWith:Color red] |
|
1036 |
ifFalse:[ e infoPrintString]]] |
|
1037 |
argument:(self editModeHolder) |
|
1038 |
argument:(self learnModeHolder). |
|
3465 | 1039 |
|
1040 |
"Modified: / 08-03-2007 / 22:58:59 / cg" |
|
2796 | 1041 |
! |
1042 |
||
2792 | 1043 |
modified |
1044 |
"return true if text was modified" |
|
1045 |
||
1046 |
^ modifiedChannel value |
|
1047 |
! |
|
1048 |
||
1049 |
modified:aBoolean |
|
1050 |
"set/clear the modified flag" |
|
1051 |
||
1052 |
modifiedChannel value:aBoolean |
|
1053 |
||
1054 |
"Modified: 14.2.1997 / 16:44:05 / cg" |
|
1055 |
! |
|
1056 |
||
1057 |
modifiedChannel |
|
1058 |
"return the valueHolder holding true if text was modified" |
|
1059 |
||
1060 |
^ modifiedChannel |
|
1061 |
! |
|
1062 |
||
1063 |
modifiedChannel:aValueHolder |
|
1064 |
"set the valueHolder holding true if text was modified" |
|
1065 |
||
1066 |
|prev| |
|
1067 |
||
1068 |
prev := modifiedChannel. |
|
1069 |
modifiedChannel := aValueHolder. |
|
1070 |
self setupChannel:aValueHolder for:nil withOld:prev |
|
1071 |
||
1072 |
"Created: / 30.1.1998 / 14:51:32 / cg" |
|
1073 |
! |
|
1074 |
||
1075 |
readOnly |
|
1076 |
"make the text readonly. |
|
1077 |
Somewhat obsolete - use #readOnly:" |
|
1078 |
||
1079 |
<resource:#obsolete> |
|
1080 |
||
1081 |
self obsoleteMethodWarning:'use #readOnly:'. |
|
3705 | 1082 |
self readOnly:true. |
2792 | 1083 |
|
1084 |
"Modified: 14.2.1997 / 17:35:56 / cg" |
|
1085 |
! |
|
1086 |
||
1087 |
readOnly:aBoolean |
|
1088 |
"make the text readonly (aBoolean == true) or writable (aBoolean == false). |
|
1089 |
The argument may also be a valueHolder." |
|
1090 |
||
1091 |
readOnly := aBoolean |
|
1092 |
||
1093 |
"Created: 14.2.1997 / 17:35:39 / cg" |
|
1094 |
! |
|
1095 |
||
4192 | 1096 |
st80Mode:aBoolean |
1097 |
"set/clear the st80Mode flag. |
|
1098 |
If on, the cursor wraps at the line end (like in vi or st80); |
|
1099 |
if off, we have the Rand-editor behavior (random access)" |
|
1100 |
||
1101 |
st80Mode := aBoolean |
|
1102 |
||
1103 |
"Created: / 09-11-2010 / 13:55:50 / cg" |
|
1104 |
! |
|
1105 |
||
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1106 |
tabMeansNextField:aBoolean |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1107 |
"set/clear tabbing to the next field. |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1108 |
If true, Tab is ignored and shifts the keyboard focus. |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1109 |
If false, tabs can be entered into the text. |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1110 |
The default is true for editTextView, false for single-line |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1111 |
input fields." |
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1112 |
|
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1113 |
tabMeansNextField := aBoolean |
2779
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1114 |
! |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1115 |
|
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1116 |
tabRequiresControl |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1117 |
"returns true, if a focus tabbing requires a control-key to be pressed. |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1118 |
The default is true for editTextView, false for other widgets, |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1119 |
to allow for easier text entry" |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1120 |
|
3160 | 1121 |
^ tabRequiresControl |
2779
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1122 |
! |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1123 |
|
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1124 |
tabRequiresControl:aBoolean |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1125 |
"controls if a focus tabbing requires a control-key to be pressed. |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1126 |
The default is true for editTextView, false for other widgets, |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1127 |
to allow for easier text entry" |
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1128 |
|
5ca530482fdd
unchecked: tabRequiresControl for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
1129 |
tabRequiresControl := aBoolean |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1130 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1131 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1132 |
!EditTextView methodsFor:'accessing-contents'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1133 |
|
1902
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1134 |
at:lineNr basicPut:aLine |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1135 |
"change a line without change notification" |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1136 |
|
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1137 |
(self at:lineNr) = aLine ifFalse:[ |
3160 | 1138 |
super at:lineNr put:aLine. |
1902
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1139 |
]. |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1140 |
! |
302a68c2255e
added #at:basicPut: to access a line without change notification.
Claus Gittinger <cg@exept.de>
parents:
1899
diff
changeset
|
1141 |
|
522 | 1142 |
at:lineNr put:aLine |
1143 |
(self at:lineNr) = aLine ifFalse:[ |
|
3160 | 1144 |
super at:lineNr put:aLine. |
1145 |
self textChanged |
|
522 | 1146 |
]. |
1147 |
! |
|
1148 |
||
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1149 |
characterBeforeCursor |
2707 | 1150 |
"return the character under the cursor - space if beyond line. |
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1151 |
For non-block cursors, this is the character immediately to the right |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1152 |
of the insertion-bar or caret." |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1153 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1154 |
cursorCol == 1 ifTrue:[^ nil]. |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1155 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1156 |
^ self characterAtLine:cursorLine col:cursorCol-1 |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1157 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1158 |
"Created: / 17.6.1998 / 15:16:41 / cg" |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1159 |
! |
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
1160 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1161 |
characterUnderCursor |
2707 | 1162 |
"return the character under the cursor - space if beyond line. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1163 |
For non-block cursors, this is the character immediately to the right |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1164 |
of the insertion-bar or caret." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1165 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1166 |
^ self characterAtLine:cursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1167 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1168 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1169 |
contents |
2213 | 1170 |
"return the contents as a String or Text (i.e. with emphasis)" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1171 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1172 |
list isNil ifTrue:[^ '']. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1173 |
self removeTrailingBlankLines. |
3707
8f6bc68b9319
changed #contents - formatting and comments
Stefan Vogel <sv@exept.de>
parents:
3705
diff
changeset
|
1174 |
^ super contents. |
3313 | 1175 |
|
1176 |
"Modified: / 04-07-2006 / 19:22:32 / fm" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1177 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1178 |
|
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1179 |
contents:something |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1180 |
self contents:something keepUndoHistory:false. |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1181 |
! |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1182 |
|
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1183 |
contents:something keepUndoHistory:keepUndoHistory |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1184 |
super contents:something. |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1185 |
keepUndoHistory ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1186 |
undoSupport resetHistories. |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1187 |
]. |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1188 |
! |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1189 |
|
2213 | 1190 |
contentsAsString |
1191 |
"return the contents as a String (i.e. without emphasis)" |
|
1192 |
||
1193 |
list isNil ifTrue:[^ '']. |
|
1194 |
self removeTrailingBlankLines. |
|
1195 |
^ (list collect:[:each | each isNil ifTrue:[''] |
|
3160 | 1196 |
ifFalse:[each string] |
1197 |
]) asStringWithCRs |
|
2213 | 1198 |
! |
1199 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1200 |
cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1201 |
"return the cursors col (1..). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1202 |
This is the absolute col; NOT the visible col" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1203 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1204 |
^ cursorCol |
125 | 1205 |
! |
1206 |
||
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1207 |
cursorColHolder |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1208 |
"return a valueHolder for the cursors column (1..)." |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1209 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1210 |
^ cursorColHolder |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1211 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1212 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1213 |
cursorLine |
3160 | 1214 |
"return the cursors line (1..). |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1215 |
This is the absolute line; NOT the visible line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1216 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1217 |
^ cursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1218 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1219 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1220 |
cursorLineHolder |
3160 | 1221 |
"return a valueHolder for the cursors line (1..). |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1222 |
This is the absolute line; NOT the visible line" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1223 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1224 |
^ cursorLineHolder |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1225 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1226 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1227 |
list:something |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1228 |
"position cursor home when setting contents" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1229 |
|
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1230 |
|prevCursorLine prevCursorCol| |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1231 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1232 |
prevCursorLine := cursorLine. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1233 |
prevCursorCol := cursorCol. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1234 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1235 |
super list:something. |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1236 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1237 |
(cursorMovementWhenUpdating == #endOfText |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1238 |
or:[cursorMovementWhenUpdating == #end]) ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1239 |
^ self cursorToEndOfText |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1240 |
]. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1241 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1242 |
(cursorMovementWhenUpdating == #endOfLine) ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1243 |
^ self cursorLine:prevCursorLine col:(self listAt:cursorLine) size + 1. |
3160 | 1244 |
]. |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1245 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1246 |
(cursorMovementWhenUpdating == #beginOfText |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1247 |
or:[cursorMovementWhenUpdating == #begin]) ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1248 |
^ self cursorHome |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1249 |
]. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1250 |
(cursorMovementWhenUpdating == #beginOfLine) ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1251 |
^ self cursorLine:prevCursorLine col:1. |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1252 |
]. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1253 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1254 |
"/ default: stay where it was |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1255 |
"/ self cursorLine:prevCursorLine col:prevCursorCol. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1256 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1257 |
|
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1258 |
setContents:something |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1259 |
|selType| |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1260 |
|
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
1261 |
undoSupport resetHistories. |
2955 | 1262 |
|
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1263 |
selType := typeOfSelection. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1264 |
super setContents:something. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1265 |
typeOfSelection := selType. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1266 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
1267 |
"Created: / 31.3.1998 / 23:35:06 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1268 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1269 |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1270 |
!EditTextView methodsFor:'accessing-look'! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1271 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1272 |
cursorForegroundColor:color1 backgroundColor:color2 |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1273 |
"set both cursor foreground and cursor background colors" |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1274 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1275 |
|wasOn| |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1276 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1277 |
wasOn := self hideCursor. |
1993 | 1278 |
cursorFgColor := color1 onDevice:device. |
1279 |
cursorBgColor := color2 onDevice:device. |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1280 |
wasOn ifTrue:[self showCursor] |
1333 | 1281 |
! |
1282 |
||
1899 | 1283 |
cursorType |
1284 |
"return the style of the text cursor. |
|
1285 |
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret |
|
3160 | 1286 |
#bigCaret and #bigSolidCaret" |
1899 | 1287 |
|
1288 |
^ cursorType |
|
1289 |
||
1290 |
"Modified: / 5.5.1999 / 14:52:33 / cg" |
|
1291 |
! |
|
1292 |
||
1333 | 1293 |
cursorType:aCursorTypeSymbol |
1294 |
"set the style of the text cursor. |
|
1295 |
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret |
|
3160 | 1296 |
#bigCaret and #bigSolidCaret" |
1333 | 1297 |
|
1334 | 1298 |
cursorType := aCursorTypeSymbol. |
1333 | 1299 |
|
1300 |
"Created: 21.9.1997 / 13:42:23 / cg" |
|
1301 |
"Modified: 21.9.1997 / 13:43:35 / cg" |
|
1334 | 1302 |
! |
1303 |
||
1899 | 1304 |
cursorTypeNoFocus |
1305 |
"return the style of the text cursor when the view has no focus. |
|
1306 |
If left unspecified, this is the same as the regular cursorType." |
|
1307 |
||
1308 |
^ cursorTypeNoFocus |
|
1309 |
||
1310 |
"Created: / 5.5.1999 / 14:52:46 / cg" |
|
1311 |
! |
|
1312 |
||
1334 | 1313 |
cursorTypeNoFocus:aCursorTypeSymbol |
1314 |
"set the style of the text cursor when the view has no focus. |
|
1315 |
If left unspecified, this is the same as the regular cursorType." |
|
1316 |
||
1317 |
cursorTypeNoFocus := aCursorTypeSymbol |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1318 |
! ! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
1319 |
|
4048 | 1320 |
!EditTextView methodsFor:'accessing-replace'! |
1321 |
||
1322 |
lastStringToReplace: aString |
|
1323 |
! ! |
|
1324 |
||
2119 | 1325 |
!EditTextView methodsFor:'change & update'! |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1326 |
|
125 | 1327 |
accept |
1328 |
"accept the current contents by executing the accept-action and/or |
|
1329 |
changeMessage." |
|
1330 |
||
1108 | 1331 |
acceptEnabled == false ifTrue:[ |
3945 | 1332 |
self beep. |
1333 |
^ self |
|
2035
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
1334 |
]. |
6924861adf08
added disableIfInvisible flag
Claus Gittinger <cg@exept.de>
parents:
2029
diff
changeset
|
1335 |
(disableIfInvisible == true and:[self reallyRealized not]) ifTrue:[ |
3945 | 1336 |
^ self |
1108 | 1337 |
]. |
1338 |
||
125 | 1339 |
lockUpdates := true. |
1013 | 1340 |
|
1341 |
"/ |
|
1342 |
"/ ST-80 way of doing it |
|
1343 |
"/ |
|
1344 |
model notNil ifTrue:[ |
|
4142 | 1345 |
self sendChangeMessage:changeMsg with:self argForChangeMessage. |
3945 | 1346 |
acceptChannel value:true withoutNotifying:self. |
2999 | 1347 |
]. |
1348 |
||
757
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1349 |
"/ |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1350 |
"/ ST/X way of doing things |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1351 |
"/ as a historic (and temporary) leftover, |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1352 |
"/ 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
|
1353 |
"/ - not with the actual string |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1354 |
"/ |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1355 |
acceptAction notNil ifTrue:[ |
3945 | 1356 |
acceptAction value:self list |
757
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1357 |
]. |
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1358 |
|
125 | 1359 |
lockUpdates := false. |
757
2cc7e423f0ef
only try changeMessage, if there is a model
Claus Gittinger <cg@exept.de>
parents:
730
diff
changeset
|
1360 |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1361 |
"Modified: / 30.1.1998 / 14:19:00 / cg" |
131 | 1362 |
! |
1363 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1364 |
argForChangeMessage |
597 | 1365 |
"return the argument to be passed with the change notification. |
1366 |
Defined as separate method for easier subclassability." |
|
1367 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1368 |
^ self contents |
597 | 1369 |
|
1370 |
"Modified: 29.4.1996 / 12:42:14 / cg" |
|
121 | 1371 |
! |
1372 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1373 |
getListFromModel |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1374 |
"get my contents from the model. |
597 | 1375 |
Redefined to ignore updates resulting from my own changes |
1376 |
(i.e. if lockUpdates is true)." |
|
121 | 1377 |
|
1378 |
" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1379 |
ignore updates from my own change |
121 | 1380 |
" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1381 |
lockUpdates ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1382 |
lockUpdates := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1383 |
^ self |
121 | 1384 |
]. |
2196
f8c955dd6eb9
validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents:
2186
diff
changeset
|
1385 |
super getListFromModel. |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
1386 |
undoSupport resetHistories. |
2196
f8c955dd6eb9
validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents:
2186
diff
changeset
|
1387 |
|
f8c955dd6eb9
validate the cursorLine, when updating from a changed model
Claus Gittinger <cg@exept.de>
parents:
2186
diff
changeset
|
1388 |
"/ validate the cursorLine |
3160 | 1389 |
(cursorLine notNil |
2310 | 1390 |
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
|
1391 |
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
|
1392 |
]. |
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1393 |
! |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1394 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1395 |
update:something with:aParameter from:changedObject |
1438
bed1564b0640
fixed update for acceptChannel
Claus Gittinger <cg@exept.de>
parents:
1437
diff
changeset
|
1396 |
changedObject == acceptChannel ifTrue:[ |
3160 | 1397 |
acceptChannel value == true ifTrue:[ |
1398 |
self accept. |
|
1399 |
]. |
|
1400 |
^ self. |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1401 |
]. |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1402 |
super update:something with:aParameter from:changedObject |
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1403 |
|
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
1404 |
"Created: / 30.1.1998 / 14:15:56 / cg" |
1439
d1b3ca91ed8a
fixed update for acceptChannel
Claus Gittinger <cg@exept.de>
parents:
1438
diff
changeset
|
1405 |
"Modified: / 1.2.1998 / 13:15:55 / cg" |
121 | 1406 |
! ! |
1407 |
||
1408 |
!EditTextView methodsFor:'cursor handling'! |
|
1409 |
||
2406 | 1410 |
characterPositionOfCursor |
1411 |
^ self characterPositionOfLine:cursorLine col:cursorCol |
|
1412 |
! |
|
1413 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1414 |
cursorBacktab |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1415 |
"move cursor to prev tabstop" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1416 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1417 |
self cursorCol:(self prevTabBefore:cursorCol). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1418 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1419 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1420 |
cursorCol:newCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1421 |
"move cursor to some column in the current line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1422 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1423 |
|wasOn| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1424 |
|
2822 | 1425 |
(cursorCol == newCol) ifTrue:[^ self]. |
1426 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1427 |
wasOn := self hideCursor. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1428 |
self setValidatedCursorCol:newCol. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1429 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1430 |
|
1431 |
"Modified: 22.5.1996 / 14:25:53 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1432 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1433 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1434 |
cursorDown |
632
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1435 |
"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
|
1436 |
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
|
1437 |
|
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1438 |
|wasOn| |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1439 |
|
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1440 |
self cursorDown:1. |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1441 |
|
2707 | 1442 |
"/ cursor beyond text ? |
632
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1443 |
cursorLine > list size ifTrue:[ |
3160 | 1444 |
wasOn := self hideCursor. |
1445 |
self setValidatedCursorLine:(list size + 1) col:cursorCol. |
|
1446 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
1447 |
self beep. |
|
632
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1448 |
]. |
5af2c22002e4
dont beep if cursor is moved down programmatically
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
1449 |
|
1561
db5f27354172
make cursor correctly visible if in partial last line.
Claus Gittinger <cg@exept.de>
parents:
1560
diff
changeset
|
1450 |
"Modified: / 10.6.1998 / 17:00:23 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1451 |
! |
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 |
cursorDown:n |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1454 |
"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
|
1455 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1456 |
|wasOn nv nL| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1457 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1458 |
cursorVisibleLine notNil ifTrue:[ |
3160 | 1459 |
wasOn := self hideCursor. |
1460 |
nv := cursorVisibleLine + n - 1. |
|
1461 |
(nv >= nFullLinesShown) ifTrue:[ |
|
1462 |
self scrollDown:(nv - nFullLinesShown + 1) |
|
1463 |
]. |
|
1464 |
self setValidatedCursorLine:(cursorLine + n) col:cursorCol. |
|
1465 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1466 |
] ifFalse:[ |
3160 | 1467 |
(nL := cursorLine) isNil ifTrue:[ |
1468 |
nL := firstLineShown |
|
1469 |
]. |
|
1470 |
self setValidatedCursorLine:(nL + n) col:cursorCol. |
|
1471 |
self makeCursorVisible. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1472 |
]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
1473 |
|
1561
db5f27354172
make cursor correctly visible if in partial last line.
Claus Gittinger <cg@exept.de>
parents:
1560
diff
changeset
|
1474 |
"Modified: / 10.6.1998 / 16:59:17 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1475 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1476 |
|
121 | 1477 |
cursorHome |
597 | 1478 |
"scroll to top AND move cursor to first line of text." |
121 | 1479 |
|
674 | 1480 |
self cursorLine:1 col:1 |
1481 |
||
1482 |
"/ |wasOn| |
|
1483 |
"/ |
|
1484 |
"/ wasOn := self hideCursor. |
|
1485 |
"/ self scrollToTop. |
|
1486 |
"/ cursorLine := cursorVisibleLine := 1. |
|
1487 |
"/ cursorCol := self validateCursorCol:1 inLine:cursorLine. |
|
1488 |
"/ self makeCursorVisibleAndShowCursor:wasOn. |
|
1489 |
||
1490 |
"Modified: 22.5.1996 / 18:26:42 / cg" |
|
121 | 1491 |
! |
1492 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1493 |
cursorLeft |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1494 |
"move cursor to left" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1495 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1496 |
(cursorCol ~~ 1) ifTrue:[ |
3160 | 1497 |
self cursorCol:(cursorCol - 1) |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1498 |
] ifFalse:[ |
3160 | 1499 |
cursorLine ~~ 1 ifTrue:[ |
1500 |
self st80EditMode ifTrue:[ |
|
1501 |
self cursorUp. |
|
1502 |
self cursorToEndOfLine. |
|
1503 |
] |
|
1504 |
] |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1505 |
] |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1506 |
|
1426
de76570ba19e
crsrLeft/crsrRight does not wrap to prev/next line in st80 mode
Claus Gittinger <cg@exept.de>
parents:
1419
diff
changeset
|
1507 |
"Modified: / 23.1.1998 / 12:37:13 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1508 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1509 |
|
4126 | 1510 |
cursorLeft:n |
1511 |
"move cursor to left" |
|
1512 |
||
1513 |
n timesRepeat:[ |
|
1514 |
self cursorLeft |
|
1515 |
]. |
|
1516 |
! |
|
1517 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1518 |
cursorLine:line col:col |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1519 |
"this positions onto physical - not visible - line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1520 |
|
676 | 1521 |
|wasOn newCol| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1522 |
|
2822 | 1523 |
((line == cursorLine) and:[col == cursorCol]) ifTrue:[^ self]. |
1524 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1525 |
wasOn := self hideCursor. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1526 |
self setValidatedCursorLine:line. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1527 |
|
672 | 1528 |
(col < 1) ifTrue:[ |
3160 | 1529 |
newCol := 1 |
672 | 1530 |
] ifFalse:[ |
3160 | 1531 |
newCol := col. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1532 |
]. |
2647
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
1533 |
self st80EditMode ifTrue:[ |
3160 | 1534 |
(cursorLine == list size |
1535 |
and:[cursorLine ~~ line]) ifTrue:[ |
|
1536 |
newCol := (self listAt:(list size)) size + 1. |
|
1537 |
] |
|
1419 | 1538 |
]. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1539 |
self setValidatedCursorCol:newCol. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1540 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1541 |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1542 |
"Modified: / 20.6.1998 / 18:19:06 / 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 |
|
1580
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1545 |
cursorMovementAllowed |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1546 |
"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
|
1547 |
(via button-click, or cursor-key with selection). |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1548 |
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
|
1549 |
in special subclasses (such as a terminal view), where |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1550 |
this is not wanted" |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1551 |
|
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1552 |
^ true |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1553 |
|
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1554 |
"Created: / 18.6.1998 / 14:11:16 / cg" |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1555 |
! |
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
1556 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1557 |
cursorReturn |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1558 |
"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
|
1559 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1560 |
|wasOn| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1561 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1562 |
self checkForExistingLine:(cursorLine + 1). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1563 |
cursorVisibleLine notNil ifTrue:[ |
3160 | 1564 |
nFullLinesShown notNil ifTrue:[ |
1565 |
(cursorVisibleLine >= nFullLinesShown) ifTrue:[self scrollDown] |
|
1566 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1567 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1568 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1569 |
wasOn := self hideCursor. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1570 |
self setValidatedCursorLine:(cursorLine + 1) col:1. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1571 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1572 |
|
674 | 1573 |
"Modified: 22.5.1996 / 18:27:34 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1574 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1575 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1576 |
cursorRight |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1577 |
"move cursor to right" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1578 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1579 |
|l| |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1580 |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
1581 |
self st80EditMode ifTrue:[ |
3160 | 1582 |
l := (self listAt:cursorLine). |
1583 |
cursorCol >= (l size + 1) ifTrue:[ |
|
1584 |
cursorLine < list size ifTrue:[ |
|
1585 |
self cursorReturn. |
|
1586 |
]. |
|
1587 |
^ self |
|
1588 |
] |
|
1589 |
]. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1590 |
self cursorCol:(cursorCol + 1) |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1591 |
|
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
1592 |
"Modified: / 20.6.1998 / 18:19:07 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1593 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1594 |
|
4126 | 1595 |
cursorRight:n |
1596 |
"move cursor to right" |
|
1597 |
||
1598 |
n timesRepeat:[ |
|
1599 |
self cursorRight |
|
1600 |
]. |
|
1601 |
! |
|
1602 |
||
1833 | 1603 |
cursorShown:aBoolean |
1604 |
"change cursor visibility |
|
1605 |
return true if cursor was visible before." |
|
1606 |
||
1607 |
|oldState| |
|
1608 |
||
1609 |
oldState := cursorShown. |
|
1610 |
||
1611 |
aBoolean ifTrue:[ |
|
3160 | 1612 |
self drawCursor. |
1833 | 1613 |
] ifFalse:[ |
3160 | 1614 |
(cursorShown and:[shown]) ifTrue: [ |
1615 |
self undrawCursor. |
|
1616 |
]. |
|
1833 | 1617 |
]. |
1618 |
cursorShown := aBoolean. |
|
1619 |
||
1620 |
^ oldState |
|
1621 |
||
1622 |
"Modified: / 30.3.1999 / 15:32:43 / stefan" |
|
1623 |
"Created: / 30.3.1999 / 15:59:30 / stefan" |
|
1624 |
! |
|
1625 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1626 |
cursorTab |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1627 |
"move cursor to next tabstop" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1628 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1629 |
self cursorCol:(self nextTabAfter:cursorCol). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1630 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1631 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1632 |
cursorToBeginOfLine |
3020
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1633 |
"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
|
1634 |
|
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1635 |
|textStart l| |
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1636 |
|
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1637 |
l := self listAt:cursorLine. |
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1638 |
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
|
1639 |
cursorCol > textStart ifTrue:[ |
3160 | 1640 |
self cursorCol:textStart |
3020
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1641 |
] ifFalse:[ |
3160 | 1642 |
self cursorCol:1 |
3020
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1643 |
] |
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1644 |
|
68a2dfad4e5e
CTRL-a (move to begin of line)
Claus Gittinger <cg@exept.de>
parents:
2999
diff
changeset
|
1645 |
"Created: / 8.8.2004 / 18:51:21 / janfrog" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1646 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1647 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1648 |
cursorToBottom |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1649 |
"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
|
1650 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1651 |
|wasOn newTop| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1652 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1653 |
wasOn := self hideCursor. |
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 |
newTop := list size - nFullLinesShown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1656 |
(newTop < 1) ifTrue:[ |
3160 | 1657 |
newTop := 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1658 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1659 |
self scrollToLine:newTop. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1660 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1661 |
self setValidatedCursorLine:(list size) col: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 makeCursorVisibleAndShowCursor:wasOn. |
672 | 1664 |
|
674 | 1665 |
"Modified: 22.5.1996 / 18:27:45 / cg" |
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 |
|
1415
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1668 |
cursorToCharacterPosition:pos |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1669 |
"compute line/col from character position (1..) |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1670 |
and move the cursor onto that char" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1671 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1672 |
|line col| |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1673 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1674 |
line := self lineOfCharacterPosition:pos. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1675 |
col := pos - (self characterPositionOfLine:line col:1) + 1. |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1676 |
self cursorLine:line col:col |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1677 |
|
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1678 |
"Created: / 15.1.1998 / 21:55:33 / cg" |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1679 |
! |
f75eeebc0d1d
added #cursorToCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
1680 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1681 |
cursorToEnd |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1682 |
"move cursor down below last line of text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1683 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1684 |
|wasOn newTop lineNr line| |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1685 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1686 |
lineNr := list size. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1687 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1688 |
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
|
1689 |
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
|
1690 |
(line isEmptyOrNil) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1691 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1692 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1693 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1694 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1695 |
wasOn := self hideCursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1696 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1697 |
lineNr := lineNr + 1. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1698 |
newTop := lineNr - nFullLinesShown. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1699 |
(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
|
1700 |
newTop := 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1701 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1702 |
self scrollToLine:newTop. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1703 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1704 |
self setValidatedCursorLine:lineNr col:1. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1705 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1706 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1707 |
|
674 | 1708 |
"Modified: 22.5.1996 / 18:27:53 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1709 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1710 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1711 |
cursorToEndOfLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1712 |
"move cursor to end of current line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1713 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1714 |
|line| |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1715 |
|
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1716 |
line := (self listAt:cursorLine). |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1717 |
self cursorCol:(line size + 1) |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1718 |
|
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
1719 |
"Modified: 13.8.1997 / 15:34:02 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1720 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1721 |
|
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1722 |
cursorToEndOfText |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1723 |
"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
|
1724 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1725 |
|wasOn newTop| |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1726 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1727 |
wasOn := self hideCursor. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1728 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1729 |
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
|
1730 |
(newTop < 1) ifTrue:[ |
3160 | 1731 |
newTop := 1 |
2129
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1732 |
]. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1733 |
self scrollToLine:newTop. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1734 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1735 |
self setValidatedCursorLine:list size. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1736 |
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
|
1737 |
|
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1738 |
self makeCursorVisibleAndShowCursor:wasOn. |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1739 |
! |
989228af033d
added control over how-to-move-the-cursor when updating text.
Claus Gittinger <cg@exept.de>
parents:
2121
diff
changeset
|
1740 |
|
3310 | 1741 |
cursorToEndOfWord |
1742 |
"move the cursor to the end of the word" |
|
1743 |
||
1744 |
(cursorLine > list size) ifTrue:[^ self]. |
|
1745 |
||
1746 |
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
|
1747 |
: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
|
1748 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
1749 |
self cursorLine:endLine col:endCol+1 |
3310 | 1750 |
] |
1751 |
||
1752 |
"Created: / 28-06-2006 / 19:16:30 / cg" |
|
1753 |
! |
|
1754 |
||
131 | 1755 |
cursorToFirstVisibleLine |
1756 |
"place cursor into the first visible line; do not scroll." |
|
1757 |
||
1758 |
self cursorLine:(self visibleLineToAbsoluteLine:1) col:1 |
|
1759 |
! |
|
1760 |
||
1761 |
cursorToLastVisibleLine |
|
1762 |
"place cursor into the first visible line; do not scroll." |
|
1763 |
||
1764 |
self cursorLine:(self visibleLineToAbsoluteLine:nFullLinesShown) col:1 |
|
1765 |
! |
|
1766 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1767 |
cursorToNextWord |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1768 |
"move the cursor to the beginning of the next word" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1769 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1770 |
|col line searching| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1771 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1772 |
(cursorLine > list size) ifTrue:[^ self]. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1773 |
|
3890 | 1774 |
self |
1775 |
wordAtLine:cursorLine col:cursorCol do:[ |
|
1776 |
:beginLine :beginCol :endLine :endCol :style | |
|
1777 |
||
1778 |
line := endLine. |
|
1779 |
col := endCol + 1. |
|
1780 |
searching := true. |
|
1781 |
[searching |
|
1782 |
and:[(self characterAtLine:line col:col) isSeparator]] whileTrue:[ |
|
1783 |
self wordAtLine:line col:col do:[ |
|
1784 |
:beginLine :beginCol :endLine :endCol :style | |
|
1785 |
||
1786 |
(line > list size) ifTrue:[ |
|
1787 |
"break out" |
|
1788 |
searching := false |
|
1789 |
] ifFalse:[ |
|
1790 |
line := endLine. |
|
1791 |
col := endCol + 1. |
|
1792 |
] |
|
1793 |
] |
|
1794 |
]. |
|
1795 |
self cursorLine:line col:col |
|
1796 |
] |
|
121 | 1797 |
! |
1798 |
||
499 | 1799 |
cursorToPreviousWord |
1800 |
"move the cursor to the beginning of this or the previous word" |
|
1801 |
||
1802 |
|col line searching l| |
|
1803 |
||
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1804 |
(cursorLine > list size) ifTrue:[^ self]. "/ this is rubbish |
499 | 1805 |
|
1806 |
self wordAtLine:cursorLine col:cursorCol do:[ |
|
3160 | 1807 |
:beginLine :beginCol :endLine :endCol :style | |
1808 |
||
1809 |
line := beginLine. |
|
1810 |
col := beginCol. |
|
1811 |
style == #wordLeft ifTrue:[ |
|
1812 |
col := col + 1 |
|
1813 |
]. |
|
1814 |
||
1815 |
(cursorLine == line |
|
1816 |
and:[cursorCol == col]) ifTrue:[ |
|
1817 |
searching := true. |
|
1818 |
||
1819 |
col > 1 ifTrue:[ |
|
1820 |
col := col - 1. |
|
1821 |
]. |
|
1822 |
||
1823 |
[searching] whileTrue:[ |
|
1824 |
(col == 1) ifTrue:[ |
|
1825 |
line == 1 ifTrue:[ |
|
1826 |
searching := false |
|
1827 |
] ifFalse:[ |
|
1828 |
line := line - 1. |
|
1829 |
l := list at:line. |
|
1830 |
col := l size + 1. |
|
1831 |
] |
|
1832 |
] ifFalse:[ |
|
1833 |
(self characterAtLine:line col:col) isSeparator ifFalse:[ |
|
1834 |
self wordAtLine:line col:col do:[ |
|
1835 |
:beginLine :beginCol :endLine :endCol :style | |
|
1836 |
||
1837 |
line := beginLine. |
|
1838 |
col := beginCol. |
|
1839 |
style == #wordLeft ifTrue:[ |
|
1840 |
col := col + 1 |
|
1841 |
]. |
|
1842 |
searching := false. |
|
1843 |
] |
|
1844 |
] ifTrue:[ |
|
1845 |
col := col - 1 |
|
1846 |
] |
|
1847 |
] |
|
1848 |
] |
|
1849 |
]. |
|
1850 |
self cursorLine:line col:col |
|
499 | 1851 |
] |
1852 |
||
1853 |
"Created: 8.3.1996 / 21:52:48 / cg" |
|
1854 |
"Modified: 8.3.1996 / 22:12:45 / cg" |
|
1855 |
! |
|
1856 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1857 |
cursorToTop |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1858 |
"move cursor to absolute home" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1859 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1860 |
self cursorLine:1 col:1 |
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 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1863 |
cursorUp |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1864 |
"move cursor up; scroll if at start of visible text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1865 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1866 |
self cursorUp:1 |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1867 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1868 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1869 |
cursorUp:n |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1870 |
"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
|
1871 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1872 |
|wasOn nv nl| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1873 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1874 |
cursorLine isNil ifTrue:[ |
3725
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1875 |
self setCursorLine:(firstLineShown + nFullLinesShown - 1). |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1876 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1877 |
nl := cursorLine - n. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1878 |
nl < 1 ifTrue:[nl := 1]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1879 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1880 |
(nl ~~ cursorLine) ifTrue: [ |
3725
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1881 |
wasOn := self hideCursor. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1882 |
cursorVisibleLine notNil ifTrue:[ |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1883 |
nv := cursorVisibleLine - n. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1884 |
nv < 1 ifTrue:[ |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1885 |
self scrollUp:(nv negated + 1) |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1886 |
]. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1887 |
]. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1888 |
self setValidatedCursorLine:nl col:cursorCol. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1889 |
"/ wasOn ifTrue:[self showCursor]. |
410e861ca010
also makeCursorVisible after cursorUp:
Claus Gittinger <cg@exept.de>
parents:
3707
diff
changeset
|
1890 |
self makeCursorVisibleAndShowCursor:wasOn. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1891 |
] |
672 | 1892 |
|
674 | 1893 |
"Modified: 22.5.1996 / 18:28:11 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1894 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1895 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1896 |
cursorVisibleLine:visibleLineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1897 |
"put cursor to visibleline/col" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1898 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1899 |
|wasOn newCol listLine| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1900 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1901 |
wasOn := self hideCursor. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1902 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1903 |
listLine := self visibleLineToAbsoluteLine:visibleLineNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1904 |
self setValidatedCursorLine:listLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1905 |
cursorVisibleLine := visibleLineNr. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1906 |
|
676 | 1907 |
newCol := colNr. |
1908 |
(newCol < 1) ifTrue:[ |
|
3160 | 1909 |
newCol := 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1910 |
]. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1911 |
self setValidatedCursorCol:newCol. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
1912 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1913 |
self makeCursorVisibleAndShowCursor:wasOn. |
672 | 1914 |
|
1597
5fdcfcedb91c
fixed cursor positioning after replaceStringAtCursor.
Claus Gittinger <cg@exept.de>
parents:
1596
diff
changeset
|
1915 |
"Modified: / 20.6.1998 / 18:40:28 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1916 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1917 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1918 |
cursorX:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1919 |
"put cursor to position next to x/y coordinate in view" |
121 | 1920 |
|
1921 |
|line col| |
|
1922 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1923 |
line := self visibleLineOfY:y. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1924 |
col := self colOfX:x inVisibleLine:line. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
1925 |
self cursorVisibleLine:line col:col. |
121 | 1926 |
! |
1927 |
||
1928 |
drawCursor |
|
1929 |
"draw the cursor if shown and cursor is visible. |
|
1930 |
(but not, if there is a selection - to avoid confusion)" |
|
1931 |
||
1932 |
shown ifTrue:[ |
|
3160 | 1933 |
cursorVisibleLine notNil ifTrue:[ |
1934 |
self hasSelection ifFalse:[ |
|
1935 |
self drawCursorCharacter |
|
1936 |
] |
|
1937 |
] |
|
121 | 1938 |
] |
1939 |
! |
|
1940 |
||
1941 |
drawCursor:cursorType with:fgColor and:bgColor |
|
1942 |
"draw a cursor; the argument cursorType specifies what type |
|
125 | 1943 |
of cursor should be drawn. |
728
3ef81000ee8c
new cursorTypes: #bigCaret and #bigSolidCaret
Claus Gittinger <cg@exept.de>
parents:
698
diff
changeset
|
1944 |
Currently, supported are: #block, #frame, #ibeam, #caret, #solidCaret |
3160 | 1945 |
#bigCaret and #bigSolidCaret" |
2085
4498b1a50d72
fixed undrawCursor, when there is italic text
Claus Gittinger <cg@exept.de>
parents:
2072
diff
changeset
|
1946 |
|
2570 | 1947 |
|x y w char y2 x1 x2 oldPaint oldClip| |
121 | 1948 |
|
1949 |
self hasSelection ifTrue:[ |
|
3160 | 1950 |
" |
1951 |
hide cursor, if there is a selection |
|
1952 |
" |
|
1953 |
^ super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
|
121 | 1954 |
]. |
1955 |
||
1334 | 1956 |
cursorType == #none ifTrue:[ |
3160 | 1957 |
^ self |
1334 | 1958 |
]. |
1959 |
||
121 | 1960 |
cursorType == #block ifTrue:[ |
3160 | 1961 |
super drawVisibleLine:cursorVisibleLine |
1962 |
col:cursorCol |
|
1963 |
with:fgColor |
|
1964 |
and:bgColor. |
|
1965 |
^ self |
|
121 | 1966 |
]. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
1967 |
x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x. |
121 | 1968 |
y := self yOfVisibleLine:cursorVisibleLine. |
1969 |
||
1449
2a54bdfff203
eliminated direct refs to paint instvar
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
1970 |
oldPaint := self paint. "/ do not clobber GC |
121 | 1971 |
cursorType == #frame ifTrue:[ |
3160 | 1972 |
super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
1973 |
||
1974 |
char := self characterUnderCursor asString. |
|
1975 |
self paint:bgColor. |
|
1976 |
self displayRectangleX:x y:y |
|
1977 |
width:(font widthOf:char) height:fontHeight. |
|
133 | 1978 |
] ifFalse:[ |
3160 | 1979 |
self paint:bgColor. |
1980 |
cursorType == #ibeam ifTrue:[ |
|
1981 |
x1 := x - 1. |
|
1982 |
y2 := y + fontHeight - 1. |
|
1983 |
self displayLineFromX:x1 y:y toX:x1 y:y2. |
|
1984 |
self displayLineFromX:x y:y toX:x y:y2. |
|
1985 |
^ self |
|
1986 |
]. |
|
1987 |
||
1988 |
cursorType == #Ibeam ifTrue:[ |
|
1989 |
x1 := x - 1. |
|
1990 |
y := y + 1. |
|
1991 |
y2 := y + fontHeight - 1. |
|
1992 |
self displayLineFromX:x1 y:y toX:x1 y:y2. |
|
1993 |
self displayLineFromX:x y:y toX:x y:y2. |
|
1994 |
self displayLineFromX:x1-2 y:y toX:x+2 y:y. |
|
1995 |
self displayLineFromX:x1-2 y:y2 toX:x+2 y:y2. |
|
1996 |
^ self |
|
1997 |
]. |
|
1998 |
||
1999 |
y := y + fontHeight - 3. |
|
2000 |
((cursorType == #bigCaret) or:[cursorType == #bigSolidCaret]) ifTrue:[ |
|
2001 |
w := (fontWidth * 2 // 3) max:4. |
|
2002 |
y2 := y + w + (w//2). |
|
2003 |
] ifFalse:[ |
|
2004 |
w := (fontWidth // 2) max:4. |
|
2005 |
y2 := y + w. |
|
2006 |
]. |
|
2007 |
x1 := x - w. |
|
2008 |
x2 := x + w. |
|
2009 |
||
2010 |
oldClip := self clippingRectangleOrNil. |
|
2011 |
self clippingRectangle:(margin@margin extent:(width-margin) @ (height-margin)). |
|
2012 |
||
2013 |
cursorType == #caret ifTrue:[ |
|
2014 |
self lineWidth:2. |
|
2015 |
self displayLineFromX:x1 y:y2 toX:x y:y. |
|
2016 |
self displayLineFromX:x y:y toX:x2 y:y2. |
|
2017 |
] ifFalse:[ |
|
2018 |
"anything else: solidCaret" |
|
2019 |
||
2020 |
self fillPolygon:(Array with:(x1 @ y2) |
|
2021 |
with:(x @ y) |
|
2022 |
with:(x2 @ y2)) |
|
2023 |
]. |
|
2024 |
||
2025 |
self clippingRectangle:oldClip |
|
121 | 2026 |
]. |
133 | 2027 |
self paint:oldPaint. |
662
4bcdf0cce3a7
dont let caret cursor become too small (with small fonts)
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
2028 |
|
2088 | 2029 |
"Modified: / 15.12.1999 / 22:24:17 / cg" |
121 | 2030 |
! |
2031 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2032 |
drawCursorCharacter |
3160 | 2033 |
"draw the cursor. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2034 |
(i.e. the cursor if no selection) |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2035 |
- helper for many cursor methods" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2036 |
|
3160 | 2037 |
(hasKeyboardFocus |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
2038 |
and:[self enabled |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
2039 |
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
|
2040 |
self drawFocusCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2041 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
2042 |
self drawNoFocusCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2043 |
] |
1817
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
2044 |
|
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
2045 |
"Modified: / 23.3.1999 / 13:52:48 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2046 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2047 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2048 |
drawFocusCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2049 |
"draw the cursor when the focus is in the view." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2050 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2051 |
self hasSelection ifTrue:[ |
3160 | 2052 |
^ super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
1334 | 2053 |
]. |
2054 |
cursorType == #none ifTrue:[ |
|
3160 | 2055 |
^ self undrawCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2056 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2057 |
self drawCursor:cursorType with:cursorFgColor and:cursorBgColor. |
1334 | 2058 |
|
2059 |
"Modified: 22.9.1997 / 00:16:38 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2060 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2061 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2062 |
drawNoFocusCursor |
3160 | 2063 |
"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
|
2064 |
|
1334 | 2065 |
|cType| |
2066 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2067 |
self hasSelection ifTrue:[ |
3160 | 2068 |
^ super redrawVisibleLine:cursorVisibleLine col:cursorCol. |
121 | 2069 |
]. |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
2070 |
|
1334 | 2071 |
cType := cursorTypeNoFocus ? cursorType. |
2072 |
cType == #none ifTrue:[ |
|
3160 | 2073 |
^ self undrawCursor |
1334 | 2074 |
]. |
2075 |
||
2076 |
cType == #block ifTrue:[ |
|
3160 | 2077 |
^ self drawCursor:#frame with:cursorNoFocusFgColor and:cursorBgColor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2078 |
]. |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
2079 |
|
1334 | 2080 |
^ self drawCursor:cType with:cursorNoFocusFgColor and:cursorNoFocusFgColor. |
2081 |
||
2082 |
"Modified: 22.9.1997 / 00:16:13 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2083 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2084 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2085 |
gotoLine:aLineNumber |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2086 |
"position cursor onto line, aLineNumber. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2087 |
Make certain that this line is visible" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2088 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2089 |
self makeLineVisible:aLineNumber. |
2951 | 2090 |
self unselect. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2091 |
self cursorLine:aLineNumber col:1 |
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 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2094 |
hideCursor |
1833 | 2095 |
"make cursor invisible if currently invisible" |
2096 |
||
2097 |
^ self cursorShown:false |
|
2098 |
||
2099 |
"Modified: / 30.3.1999 / 16:02:28 / stefan" |
|
121 | 2100 |
! |
2101 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2102 |
makeCursorVisible |
3160 | 2103 |
"scroll text to make cursorline visible |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2104 |
(i.e. to have cursorLine in visible area)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2105 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2106 |
|line col| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2107 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2108 |
cursorLine notNil ifTrue:[ |
3160 | 2109 |
line := cursorLine. |
2110 |
col := cursorCol. |
|
2111 |
" |
|
2112 |
if there is a selection, its better to |
|
2113 |
have its start being visible, instead of the end |
|
2114 |
" |
|
2115 |
(selectionStartLine notNil |
|
2116 |
and:[selectionEndLine notNil]) ifTrue:[ |
|
2117 |
expandingTop ~~ false ifTrue:[ |
|
2118 |
line := selectionStartLine. |
|
2119 |
col := selectionStartCol. |
|
2120 |
] ifFalse:[ |
|
2121 |
line := selectionEndLine. |
|
2122 |
col := selectionEndCol |
|
2123 |
] |
|
2124 |
]. |
|
2125 |
self makeLineVisible:line. |
|
2126 |
self makeColVisible:col inLine:line |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2127 |
] |
479
fae6d1251888
fixed Shift-Cursor selection & show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
2128 |
|
fae6d1251888
fixed Shift-Cursor selection & show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
2129 |
"Modified: 6.3.1996 / 13:46:46 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2130 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2131 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2132 |
makeCursorVisibleAndShowCursor:flag |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2133 |
"scroll to make cursorLine visible; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2134 |
if flag is true, draw the cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2135 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2136 |
self makeCursorVisible. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2137 |
flag ifTrue:[self showCursor] |
121 | 2138 |
! |
2139 |
||
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2140 |
setCursorCol:colNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2141 |
"strictly private: set the cursorCol" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2142 |
|
2815 | 2143 |
cursorCol := (colNr max:1). |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2144 |
cursorColHolder value:cursorCol. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2145 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2146 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2147 |
setCursorLine:lineNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2148 |
"strictly private: set the cursorLine" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2149 |
|
3303 | 2150 |
"/ self assert:(lineNr notNil). |
2151 |
||
2152 |
cursorLine := (lineNr ? 1). |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2153 |
cursorLineHolder value:cursorLine. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2154 |
self updateCursorVisibleLine. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2155 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2156 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2157 |
setCursorLine:lineNr col:colNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2158 |
"strictly private: set the cursorLine, col and update the visibleLine" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2159 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2160 |
self setCursorLine:lineNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2161 |
self setCursorCol:colNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2162 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2163 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2164 |
setValidatedCursorCol:colNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2165 |
"strictly private: set the cursorCol" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2166 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2167 |
self setCursorCol:(self validateCursorCol:colNr inLine:cursorLine). |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2168 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2169 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2170 |
setValidatedCursorLine:lineNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2171 |
"strictly private: set the cursorLine and update the visibleLine" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2172 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2173 |
self setCursorLine:(self validateCursorLine:lineNr). |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2174 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2175 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2176 |
setValidatedCursorLine:lineNr col:colNr |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2177 |
"strictly private: set the cursorLine, col and update the visibleLine" |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2178 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2179 |
self setValidatedCursorLine:lineNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2180 |
self setValidatedCursorCol:colNr. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2181 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2182 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2183 |
showCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2184 |
"make cursor visible if currently invisible" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2185 |
|
1833 | 2186 |
^ self cursorShown:true |
2187 |
||
2188 |
"Modified: / 30.3.1999 / 16:02:34 / stefan" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2189 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2190 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2191 |
undrawCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2192 |
"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
|
2193 |
|
2085
4498b1a50d72
fixed undrawCursor, when there is italic text
Claus Gittinger <cg@exept.de>
parents:
2072
diff
changeset
|
2194 |
|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
|
2195 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2196 |
cursorVisibleLine notNil ifTrue:[ |
3160 | 2197 |
prevCol := cursorCol - 1. |
2198 |
||
2199 |
"/ if there is any italic stuff in the cursor line, |
|
2200 |
"/ redraw it completely (because characters overlap). |
|
2201 |
cursorCol > 1 ifTrue:[ |
|
2202 |
(line := self listAt:cursorLine) notNil ifTrue:[ |
|
2203 |
line hasChangeOfEmphasis ifTrue:[ |
|
2204 |
line size >= (cursorCol-1) ifTrue:[ |
|
2205 |
e1 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol-1). |
|
2206 |
line size >= (cursorCol) ifTrue:[ |
|
2207 |
e2 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol). |
|
2208 |
line size >= (cursorCol+1) ifTrue:[ |
|
2209 |
e3 := Text extractEmphasis:#italic from:(line emphasisAt:cursorCol+1) |
|
2210 |
]. |
|
2211 |
]. |
|
2212 |
]. |
|
2213 |
(e1 notNil or:[e2 notNil or:[e3 notNil]]) ifTrue:[ |
|
2214 |
^ super redrawVisibleLine:cursorVisibleLine |
|
2215 |
] |
|
2216 |
] |
|
2217 |
] |
|
2218 |
]. |
|
2219 |
||
2220 |
((cursorType == #caret) |
|
2221 |
or:[cursorType == #solidCaret |
|
2222 |
or:[cursorType == #bigSolidCaret |
|
2223 |
or:[cursorType == #bigCaret |
|
2224 |
or:[cursorType == #Ibeam]]]]) ifTrue:[ |
|
2225 |
"caret-cursor touches 4 characters" |
|
2226 |
((cursorCol > 1) and:[fontIsFixedWidth]) ifTrue:[ |
|
2227 |
super redrawVisibleLine:cursorVisibleLine-1 from:prevCol to:cursorCol. |
|
2228 |
super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol. |
|
2229 |
super redrawVisibleLine:cursorVisibleLine+1 from:prevCol to:cursorCol. |
|
2230 |
] ifFalse:[ |
|
2231 |
"care for left margin" |
|
2232 |
super redrawVisibleLine:cursorVisibleLine; redrawVisibleLine:cursorVisibleLine+1. |
|
2233 |
]. |
|
2234 |
^ self |
|
2235 |
]. |
|
2236 |
||
2237 |
cursorType == #ibeam ifTrue:[ |
|
2238 |
"ibeam-cursor touches 2 characters" |
|
2239 |
cursorCol > 1 ifTrue:[ |
|
2240 |
super redrawVisibleLine:cursorVisibleLine from:prevCol to:cursorCol. |
|
2241 |
] ifFalse:[ |
|
2242 |
"care for left margin" |
|
2243 |
super redrawVisibleLine:cursorVisibleLine. |
|
2244 |
]. |
|
2245 |
^ self |
|
2246 |
]. |
|
2247 |
||
2248 |
"block cursor is simple - just one character under cursor" |
|
2249 |
||
2250 |
"/ however, if italic characters are involved, we must care |
|
2251 |
"/ for the chars before/after the cursor. |
|
2252 |
"/ We redraw the part of the previous character which got |
|
2253 |
"/ detroyed by the block cursor. |
|
2254 |
"/ (must change the clip, to avoid destroying the prev-prev character) |
|
2255 |
||
2256 |
line := self visibleAt:cursorVisibleLine. |
|
2257 |
(line notNil and:[line isText]) ifTrue:[ |
|
2258 |
cursorCol > 1 ifTrue:[ |
|
2259 |
oldClip := self clippingRectangleOrNil. |
|
2260 |
x := (self xOfCol:cursorCol inVisibleLine:cursorVisibleLine) - viewOrigin x. |
|
2261 |
y := self yOfVisibleLine:cursorVisibleLine. |
|
2262 |
self clippingRectangle:(x@y extent:((font width * 2) @ fontHeight)). |
|
2263 |
super redrawVisibleLine:cursorVisibleLine from:cursorCol-1 to:cursorCol. |
|
2264 |
self clippingRectangle:oldClip. |
|
2265 |
^ self. |
|
2266 |
]. |
|
2267 |
]. |
|
2268 |
super redrawVisibleLine:cursorVisibleLine col:cursorCol |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2269 |
] |
728
3ef81000ee8c
new cursorTypes: #bigCaret and #bigSolidCaret
Claus Gittinger <cg@exept.de>
parents:
698
diff
changeset
|
2270 |
|
2088 | 2271 |
"Modified: / 15.12.1999 / 22:25:59 / cg" |
121 | 2272 |
! |
2273 |
||
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2274 |
updateCursorVisibleLine |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2275 |
"strictly private: set the visibleLine from the cursorLine. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2276 |
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
|
2277 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2278 |
cursorVisibleLine := self listLineToVisibleLine:cursorLine. |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2279 |
! |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2280 |
|
672 | 2281 |
validateCursorCol:col inLine:line |
674 | 2282 |
"check of col is a valid cursor position; return a new col-nr if not. |
3160 | 2283 |
Here, no limits are enforced (and col is returned), |
2284 |
but it may be redefined in EditFields or views which dont like the |
|
674 | 2285 |
cursor to be positioned behind the end of a textLine (vi/st-80 behavior)" |
672 | 2286 |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
2287 |
|l max| |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
2288 |
|
1419 | 2289 |
"/ in ST80 mode, |
2707 | 2290 |
"/ the cursor may not be positioned beyond the |
2291 |
"/ end of a line or beyond the last line of the text |
|
3160 | 2292 |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2293 |
self st80EditMode ifTrue:[ |
3160 | 2294 |
l := (self listAt:line). |
2295 |
max := l size + 1. |
|
2296 |
col > max ifTrue:[ |
|
2297 |
^ max |
|
2298 |
] |
|
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
2299 |
]. |
672 | 2300 |
^ col |
2301 |
||
1419 | 2302 |
"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
|
2303 |
"Modified: / 20.6.1998 / 18:19:24 / cg" |
674 | 2304 |
! |
2305 |
||
2306 |
validateCursorLine:line |
|
2307 |
"check of line is a valid cursor line; return a fixed line-nr if not. |
|
3160 | 2308 |
Here, no limits are enforced (and line is returned), but it may be |
674 | 2309 |
redefined in views which dont like the cursor to be positioned |
2310 |
behind the end of the text (vi/st-80 behavior), or want to |
|
2311 |
skip reserved regions" |
|
2312 |
||
1419 | 2313 |
"/ |
2314 |
"/ in st80Mode, the cursor may not be positioned |
|
2707 | 2315 |
"/ beyond the last line |
1419 | 2316 |
"/ |
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2317 |
self st80EditMode ifTrue:[ |
3160 | 2318 |
^ (line min:(list size)) max:1 |
1419 | 2319 |
]. |
674 | 2320 |
^ line |
2321 |
||
1419 | 2322 |
"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
|
2323 |
"Modified: / 20.6.1998 / 18:19:26 / cg" |
672 | 2324 |
! |
2325 |
||
121 | 2326 |
withCursorOffDo:aBlock |
2327 |
"evaluate aBlock with cursor off; turn it on afterwards." |
|
2328 |
||
2329 |
(shown not or:[cursorShown not]) ifTrue:[ |
|
3160 | 2330 |
^ aBlock value |
121 | 2331 |
]. |
2332 |
self hideCursor. |
|
2522
d80496af7eaf
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2506
diff
changeset
|
2333 |
aBlock ensure:[ |
3160 | 2334 |
self showCursor |
121 | 2335 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2336 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2337 |
|
2589 | 2338 |
!EditTextView methodsFor:'drag & drop'! |
2339 |
||
2340 |
allowDrop:aBoolean |
|
3236 | 2341 |
"enable/disable drop support" |
2342 |
||
2589 | 2343 |
aBoolean ifFalse:[ |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2344 |
dropTarget := nil. |
2589 | 2345 |
] ifTrue:[ |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2346 |
dropTarget isNil ifTrue:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2347 |
dropTarget := DropTarget |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2348 |
receiver:self |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2349 |
argument:nil |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2350 |
dropSelector:#'drop:' |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2351 |
canDropSelector:#'canDrop:' |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2352 |
] |
3236 | 2353 |
]. |
2354 |
! |
|
2355 |
||
3412 | 2356 |
canDrop:aDropContext |
2357 |
"public from d&d. |
|
2358 |
I accept textObjects and fileObjects only." |
|
2359 |
||
4089
c6567fb50316
comment/format in: #canDrop:
Claus Gittinger <cg@exept.de>
parents:
4064
diff
changeset
|
2360 |
"/ cg: disabled to avoid unintended drop (is same as copy-past, anyway) |
3412 | 2361 |
aDropContext sourceWidget == self ifTrue:[^ false]. |
2362 |
^ self canDropObjects:aDropContext dropObjects |
|
2363 |
||
2364 |
"Modified: / 13-10-2006 / 17:41:09 / cg" |
|
2365 |
! |
|
2366 |
||
2367 |
canDropObjects:aCollectionOfDropObjects |
|
2368 |
"public from d&d. |
|
2369 |
I accept textObjects and fileObjects only." |
|
2589 | 2370 |
|
2371 |
self checkModificationsAllowed ifFalse:[^ false]. |
|
2372 |
||
3412 | 2373 |
aCollectionOfDropObjects isEmpty ifTrue:[ ^ false ]. |
2374 |
^ aCollectionOfDropObjects conform:[:obj| (obj isTextObject or:[obj isFileObject])] |
|
2375 |
||
2376 |
"Created: / 13-10-2006 / 15:56:57 / cg" |
|
2377 |
"Modified: / 13-10-2006 / 17:41:14 / cg" |
|
2378 |
! |
|
2379 |
||
2380 |
drop:aDropContext |
|
2381 |
"public from d&d. |
|
2382 |
drop objects (new API)" |
|
2383 |
||
2384 |
self dropObjects:(aDropContext dropObjects) |
|
2385 |
||
2386 |
"Modified: / 13-10-2006 / 17:41:19 / cg" |
|
2387 |
! |
|
2388 |
||
2389 |
dropFileObject:aDropObject |
|
2589 | 2390 |
"drop objects |
3236 | 2391 |
For bw. compatibility, also collections of drop objects are handled (may vanish)" |
2392 |
||
4136 | 2393 |
|answer text fn pasteWhat sensor dontAskAgainHolder enforcedDropMode app| |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2394 |
|
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2395 |
pasteWhat := #name. |
3412 | 2396 |
|
2397 |
fn := aDropObject asFilename. |
|
2398 |
(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
|
2399 |
enforcedDropMode := UserPreferences current enforcedDropModeForFiles. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2400 |
(enforcedDropMode notNil |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2401 |
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
|
2402 |
pasteWhat := enforcedDropMode. |
3886 | 2403 |
] ifFalse:[ |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2404 |
sensor := self sensor. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2405 |
(sensor shiftDown or:[sensor ctrlDown]) ifTrue:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2406 |
pasteWhat := #name. |
3886 | 2407 |
] ifFalse:[ |
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2408 |
(sensor metaDown) ifTrue:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2409 |
pasteWhat := #contents. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2410 |
] ifFalse:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2411 |
dontAskAgainHolder := false asValue. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2412 |
answer := Dialog |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2413 |
confirmWithCancel:(resources |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2414 |
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
|
2415 |
with:fn name allBold) |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2416 |
labels:#( 'Cancel' 'Name' 'Contents' ) |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2417 |
values:#( nil #name #contents ) |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2418 |
default:#contents |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2419 |
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
|
2420 |
title:(resources string:'Drop What'). |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2421 |
answer isNil ifTrue:[ ^ self ]. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2422 |
|
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2423 |
dontAskAgainHolder value ifTrue:[ |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2424 |
UserPreferences current enforcedDropModeForFiles:#contents |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2425 |
]. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2426 |
pasteWhat := answer. |
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2427 |
] |
3886 | 2428 |
] |
2429 |
]. |
|
2430 |
]. |
|
2431 |
||
3907
e4be6bf71a98
Always Paste the Contents when Dropping a File
Claus Gittinger <cg@exept.de>
parents:
3890
diff
changeset
|
2432 |
pasteWhat == #name ifTrue:[ |
3886 | 2433 |
text := fn pathName |
2434 |
] ifFalse:[ |
|
2435 |
self withWaitCursorDo:[ |
|
3799 | 2436 |
text := fn contentsOfEntireFile |
4136 | 2437 |
]. |
2438 |
(app := self application) notNil ifTrue:[ |
|
2439 |
app droppedFile:fn in:self |
|
2440 |
]. |
|
3886 | 2441 |
]. |
2442 |
||
3799 | 2443 |
self |
2444 |
undoablePaste:text |
|
2445 |
info:'Drop File'. |
|
3412 | 2446 |
|
2447 |
"Created: / 13-10-2006 / 17:38:31 / cg" |
|
3495 | 2448 |
"Modified: / 28-07-2007 / 13:27:09 / cg" |
3412 | 2449 |
! |
2450 |
||
2451 |
dropObject:aDropObject |
|
2452 |
"drop objects |
|
2453 |
For bw. compatibility, also collections of drop objects are handled (may vanish)" |
|
2454 |
||
3415 | 2455 |
|text| |
2456 |
||
3412 | 2457 |
(aDropObject isFileObject) ifTrue:[ |
3799 | 2458 |
self dropFileObject:aDropObject |
3412 | 2459 |
] ifFalse:[ |
3799 | 2460 |
aDropObject isTextObject ifTrue:[ |
2461 |
text := aDropObject theObject. |
|
2462 |
text isStringCollection ifTrue:[ |
|
2463 |
text := text asStringWithoutFinalCR |
|
2464 |
]. |
|
2465 |
] ifFalse:[ |
|
2466 |
text := aDropObject theObject asString |
|
2467 |
]. |
|
2468 |
self |
|
2469 |
undoablePaste:text |
|
2470 |
info:'Drop'. |
|
3412 | 2471 |
]. |
2472 |
||
2473 |
"Created: / 13-10-2006 / 17:37:05 / cg" |
|
3495 | 2474 |
"Modified: / 28-07-2007 / 13:26:53 / cg" |
3412 | 2475 |
! |
2476 |
||
2477 |
dropObjects:aCollectionOfDropObjects |
|
2478 |
"public from d&d. |
|
2479 |
drop objects (old API)" |
|
2480 |
||
3868 | 2481 |
aCollectionOfDropObjects do:[:el | |
2482 |
self dropObject:el |
|
3412 | 2483 |
]. |
2484 |
||
2485 |
"Created: / 13-10-2006 / 15:59:40 / cg" |
|
2486 |
"Modified: / 13-10-2006 / 17:41:23 / cg" |
|
2589 | 2487 |
! ! |
2488 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2489 |
!EditTextView methodsFor:'editing'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2490 |
|
313
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2491 |
copyAndDeleteSelection |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2492 |
"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
|
2493 |
|
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2494 |
selectionStartLine notNil ifTrue:[ |
3160 | 2495 |
self setClipboardText:(self selection). |
2496 |
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
|
2497 |
]. |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2498 |
|
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2499 |
"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
|
2500 |
! |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
2501 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2502 |
deleteCharAtCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2503 |
"delete single character under cursor; does not merge lines" |
121 | 2504 |
|
2505 |
|wasOn| |
|
2506 |
||
2507 |
wasOn := self hideCursor. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2508 |
self deleteCharAtLine:cursorLine col:cursorCol. |
121 | 2509 |
wasOn ifTrue:[self showCursor] |
2510 |
! |
|
2511 |
||
827 | 2512 |
deleteCharAtLine:lineNr col:colNr |
2513 |
"delete a single character at colNr in line lineNr" |
|
2514 |
||
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2515 |
self st80EditMode ifTrue:[ |
3160 | 2516 |
(self listAt:cursorLine) size + 1 = colNr ifTrue:[ |
2517 |
| wasOn | |
|
2518 |
wasOn := self hideCursor. |
|
2519 |
self |
|
2520 |
cursorReturn; |
|
2521 |
cursorCol:1; |
|
2522 |
deleteCharBeforeCursor. |
|
2523 |
wasOn ifTrue:[ self showCursor]. |
|
2524 |
^ self. |
|
2525 |
]. |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2526 |
]. |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
2527 |
|
827 | 2528 |
self deleteCharsAtLine:lineNr fromCol:colNr toCol:colNr |
2529 |
! |
|
2530 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2531 |
deleteCharBeforeCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2532 |
"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
|
2533 |
|
2491 | 2534 |
|soCol wasOn lineNrAboveCursor ln prevTab| |
121 | 2535 |
|
2536 |
wasOn := self hideCursor. |
|
2491 | 2537 |
autoIndent ifTrue:[ |
3160 | 2538 |
prevTab := (self prevTabBefore:cursorCol) max:1. |
2539 |
ln := (list at:cursorLine) ? ''. |
|
2540 |
ln size < prevTab ifTrue:[ |
|
2541 |
ln := ln , (String new:prevTab withAll:Character space). |
|
2542 |
]. |
|
2543 |
(ln copyTo:prevTab) isBlank ifTrue:[ |
|
2544 |
(ln copyFrom:prevTab+1) isBlank ifTrue:[ |
|
2545 |
cursorCol > prevTab ifTrue:[ |
|
2546 |
self cursorLine:cursorLine col:prevTab. |
|
2547 |
wasOn ifTrue:[ self showCursor ]. |
|
2548 |
^ self |
|
2549 |
]. |
|
2550 |
] ifFalse:[ |
|
2551 |
self deleteFromLine:cursorLine col:prevTab toLine:cursorLine col:cursorCol-1. |
|
2552 |
self cursorLine:cursorLine col:prevTab. |
|
2553 |
wasOn ifTrue:[ self showCursor ]. |
|
2554 |
^ self. |
|
2555 |
] |
|
2556 |
]. |
|
827 | 2557 |
]. |
2558 |
||
2491 | 2559 |
"/ (autoIndent |
2560 |
"/ and:[cursorCol ~~ 1 |
|
3160 | 2561 |
"/ and:[cursorLine <= (list size)]]) |
2491 | 2562 |
"/ ifTrue:[ |
2563 |
"/ soCol := (self leftIndentForLine:cursorLine) + 1. |
|
2564 |
"/ |
|
2565 |
"/ (cursorCol == soCol and:[soCol > 1]) ifTrue:[ |
|
2566 |
"/ ln := list at:cursorLine. |
|
2567 |
"/ (ln notNil and:[(ln indexOfNonSeparatorStartingAt:1) < soCol]) ifTrue:[ |
|
2568 |
"/ soCol := 1 |
|
2569 |
"/ ] |
|
2570 |
"/ ] |
|
2571 |
"/ ] ifFalse:[ |
|
3160 | 2572 |
soCol := 1. |
2491 | 2573 |
"/ ]. |
2574 |
||
1419 | 2575 |
(cursorCol ~~ soCol and:[cursorCol ~~ 1]) ifTrue:[ |
3160 | 2576 |
" |
2577 |
somewhere in the middle of a line |
|
2578 |
" |
|
2579 |
self cursorLeft. |
|
2580 |
self deleteCharAtLine:cursorLine col:cursorCol. |
|
1419 | 2581 |
] ifFalse:[ |
3160 | 2582 |
" |
2583 |
at begin of line - merge with previous line; |
|
2584 |
except for the very first line. |
|
2585 |
" |
|
2586 |
(cursorLine == 1) ifFalse:[ |
|
2587 |
lineNrAboveCursor := self validateCursorLine:(cursorLine - 1). |
|
2588 |
lineNrAboveCursor < cursorLine ifTrue:[ |
|
2589 |
(lineNrAboveCursor > 0 and:[lineNrAboveCursor > list size]) ifTrue:[ |
|
2590 |
"/ we are beyond the end of the text. |
|
2591 |
"/ move the cursor to the previous line. |
|
2592 |
self cursorLine:lineNrAboveCursor col:1. |
|
2593 |
] ifFalse:[ |
|
2594 |
self mergeLine:lineNrAboveCursor removeBlanks:false. |
|
2595 |
] |
|
2596 |
] |
|
2597 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2598 |
]. |
827 | 2599 |
wasOn ifTrue:[ self showCursor ] |
2600 |
||
1419 | 2601 |
"Modified: / 16.1.1998 / 22:33:04 / cg" |
827 | 2602 |
! |
2603 |
||
2604 |
deleteCharsAtLine:lineNr fromCol:colNr |
|
2605 |
"delete characters from colNr up to the end in line lineNr" |
|
2606 |
||
2607 |
|line| |
|
2608 |
||
2609 |
(line := self listAt:lineNr) notNil ifTrue:[ |
|
3160 | 2610 |
self deleteCharsAtLine:lineNr fromCol:colNr toCol:(line size) |
827 | 2611 |
] |
2612 |
||
2613 |
! |
|
2614 |
||
2615 |
deleteCharsAtLine:lineNr toCol:colNr |
|
2616 |
"delete characters from start up to colNr in line lineNr" |
|
2617 |
||
2618 |
self deleteCharsAtLine:lineNr fromCol:1 toCol:colNr |
|
2619 |
||
2620 |
||
121 | 2621 |
! |
2622 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2623 |
deleteCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2624 |
"delete the line where the cursor sits" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2625 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2626 |
self deleteLine:cursorLine |
121 | 2627 |
! |
2628 |
||
2385
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2629 |
deleteFromCharacterPosition:charPos1 to:charPos2 |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2630 |
"delete a substring at a character position" |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2631 |
|
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2632 |
|line1 col1 line2 col2| |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2633 |
|
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2634 |
line1 := self lineOfCharacterPosition:charPos1. |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2635 |
col1 := charPos1 - (self characterPositionOfLine:line1 col:1) + 1. |
2725
eccf283b2efb
deleteFromCharacterPos - fixed
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
2636 |
col1 == 0 ifTrue:[ |
3160 | 2637 |
line1 := line1 - 1. |
2638 |
col1 := (self listAt:line1) size + 1. |
|
2725
eccf283b2efb
deleteFromCharacterPos - fixed
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
2639 |
]. |
2385
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2640 |
|
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2641 |
line2 := self lineOfCharacterPosition:charPos2. |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2642 |
col2 := charPos2 - (self characterPositionOfLine:line2 col:1) + 1. |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2643 |
|
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2644 |
self deleteFromLine:line1 col:col1 toLine:line2 col:col2. |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2645 |
! |
357e8a1cb2b2
added #deleteFromCharacterPosition:to:
Claus Gittinger <cg@exept.de>
parents:
2373
diff
changeset
|
2646 |
|
2954 | 2647 |
deleteFromLine:startLine col:startCol toLine:endLine col:endCol |
2648 |
"delete all text from startLine/startCol to endLine/endCol - |
|
2649 |
joining lines if nescessary" |
|
2650 |
||
2651 |
|line newLine lineSize nMore| |
|
2652 |
||
2653 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
2654 |
list isNil ifTrue:[^ self]. |
|
2655 |
startLine > list size ifTrue:[ ^ self]. "/ deleted space below text |
|
2656 |
||
2657 |
(startLine == endLine) ifTrue:[ |
|
4225 | 2658 |
"/ delete chars within a line |
2659 |
self deleteCharsAtLine:startLine fromCol:startCol toCol:endCol. |
|
2660 |
^ self |
|
2954 | 2661 |
]. |
2662 |
||
2663 |
((startCol == 1) and:[endCol == 0]) ifTrue:[ |
|
4225 | 2664 |
"/ delete full lines only |
2665 |
endLine > startLine ifTrue:[ |
|
2666 |
self deleteFromLine:startLine toLine:(endLine - 1) |
|
2667 |
]. |
|
2668 |
^ self |
|
2954 | 2669 |
]. |
2670 |
||
2671 |
"/ delete right rest of 1st line |
|
2672 |
self deleteCharsAtLine:startLine fromCol:startCol. |
|
2673 |
||
2674 |
"/ delete the inner lines ... |
|
2675 |
endLine > (startLine + 1) ifTrue:[ |
|
4225 | 2676 |
self deleteFromLine:(startLine + 1) toLine:(endLine - 1) |
2954 | 2677 |
]. |
2678 |
||
2679 |
(endCol ~~ 0) ifTrue:[ |
|
4225 | 2680 |
"/ delete the left rest of the last line |
2681 |
||
2682 |
self deleteCharsAtLine:(startLine + 1) toCol:endCol. |
|
2683 |
||
2684 |
"/ must add blanks, if startCol lies beyond end of startLine |
|
2685 |
startLine <= list size ifTrue:[ |
|
2686 |
line := list at:startLine. |
|
2687 |
lineSize := line size. |
|
2688 |
(startCol > lineSize) ifTrue:[ |
|
2689 |
newLine := line. |
|
2690 |
line isNil ifTrue:[ |
|
2691 |
newLine := String new:(startCol - 1) |
|
2692 |
] ifFalse:[ |
|
2693 |
nMore := startCol - 1 - lineSize. |
|
2694 |
nMore > 0 ifTrue:[ |
|
2695 |
newLine := line , (line species new:nMore) |
|
2696 |
] |
|
2697 |
]. |
|
2698 |
newLine ~~ line ifTrue:[ |
|
2699 |
list at:startLine put:newLine. |
|
2700 |
]. |
|
2701 |
"/ TODO: remember old maxwidth of linerange, |
|
2702 |
"/ only clear widthOfWidestLine, if this max |
|
2703 |
"/ length was (one of) the longest. |
|
2704 |
"/ avoids slow delete with huge texts. |
|
2705 |
widthOfWidestLine := nil. "/ i.e. unknown |
|
2706 |
self textChanged. |
|
2707 |
] |
|
2708 |
] |
|
2954 | 2709 |
]. |
2710 |
||
2711 |
"/ merge the left rest of 1st line with right rest of last line into one |
|
2712 |
self mergeLine:startLine removeBlanks:false |
|
2713 |
||
4225 | 2714 |
"Modified: / 10-11-1998 / 23:52:59 / cg" |
2715 |
"Modified: / 18-03-2011 / 18:25:01 / az" |
|
2954 | 2716 |
! |
2717 |
||
827 | 2718 |
deleteLine:lineNr |
2719 |
"delete line" |
|
2720 |
||
2721 |
self deleteFromLine:lineNr toLine:lineNr |
|
2722 |
||
2723 |
||
2724 |
! |
|
2725 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2726 |
deleteLinesWithoutRedrawFrom:startLine to:endLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2727 |
"delete lines - no redraw; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2728 |
return true, if something was really deleted" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2729 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2730 |
|lastLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2731 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
2732 |
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
|
2733 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2734 |
(list isNil or:[startLine > list size]) ifTrue:[^ false]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2735 |
(endLine > list size) ifTrue:[ |
3160 | 2736 |
lastLine := list size |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2737 |
] ifFalse:[ |
3160 | 2738 |
lastLine := endLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2739 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2740 |
list removeFromIndex:startLine toIndex:lastLine. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2741 |
"/ TODO: remember old maxwidth of linerange, |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2742 |
"/ only clear widthOfWidestLine, if this max |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2743 |
"/ length was (one of) the longest. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2744 |
"/ avoids slow delete with huge texts. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2745 |
widthOfWidestLine := nil. "/ i.e. unknown |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2746 |
self textChanged. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2747 |
^ true |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2748 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
2749 |
"Modified: / 10.11.1998 / 23:55:29 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2750 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2751 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2752 |
deleteSelection |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2753 |
"delete the selection" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2754 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2755 |
|wasOn startLine startCol endLine endCol| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2756 |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
2757 |
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
|
2758 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2759 |
selectionStartLine notNil ifTrue:[ |
3160 | 2760 |
wasOn := self hideCursor. |
2761 |
||
2762 |
startLine := selectionStartLine. |
|
2763 |
startCol := selectionStartCol. |
|
2764 |
endLine := selectionEndLine. |
|
2765 |
endCol := selectionEndCol. |
|
2766 |
self unselectWithoutRedraw. |
|
2767 |
self deleteFromLine:startLine col:startCol toLine:endLine col:endCol. |
|
2768 |
self setCursorLine:startLine col:startCol. |
|
2769 |
||
2770 |
self makeCursorVisibleAndShowCursor:wasOn |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2771 |
] |
121 | 2772 |
! |
2773 |
||
2157
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2774 |
deleteWordBeforeCursor |
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2775 |
"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
|
2776 |
|
2952 | 2777 |
|wasOn beginCol beginLine endCol endLine| |
2157
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2778 |
|
3799 | 2779 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
2780 |
||
2157
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2781 |
wasOn := self hideCursor. |
3799 | 2782 |
self |
2783 |
undoableDo:[ |
|
2784 |
endCol := cursorCol-1. |
|
2785 |
endLine := cursorLine. |
|
2786 |
self cursorToPreviousWord. |
|
2787 |
beginCol := cursorCol. |
|
2788 |
beginLine := cursorLine. |
|
2789 |
self deleteFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
|
2790 |
] |
|
2791 |
info:'Delete Word'. |
|
2157
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2792 |
wasOn ifTrue:[ self showCursor ]. |
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2793 |
|
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2794 |
"Modified: / 22.2.2000 / 23:59:04 / cg" |
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2795 |
! |
ba22c3cc278b
added Shift-BackSpace function: DeleteWordBeforeCursor
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2796 |
|
121 | 2797 |
insertCharAtCursor:aCharacter |
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2798 |
"insert a single character at cursor-position - advance cursor." |
121 | 2799 |
|
2800 |
|wasOn| |
|
2801 |
||
2802 |
wasOn := self hideCursor. |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2803 |
aCharacter == Character tab ifTrue:[ |
3160 | 2804 |
"/ needs special care to advance cursor correctly |
2805 |
self insertTabAtCursor |
|
121 | 2806 |
] ifFalse:[ |
3160 | 2807 |
self insert:aCharacter atLine:cursorLine col:cursorCol. |
2808 |
aCharacter == (Character cr) ifTrue:[ |
|
2809 |
self cursorReturn |
|
2810 |
] ifFalse:[ |
|
2811 |
self cursorRight. |
|
2812 |
]. |
|
121 | 2813 |
]. |
2814 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2815 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2816 |
"Modified: / 12.6.1998 / 21:50:20 / cg" |
121 | 2817 |
! |
2818 |
||
641 | 2819 |
insertLine:aString before:lineNr |
2820 |
"insert the line aString before line lineNr" |
|
2821 |
||
2822 |
^ self insertLines:(Array with:aString) from:1 to:1 before:lineNr. |
|
2823 |
||
2824 |
"Modified: 14.5.1996 / 13:42:54 / cg" |
|
2825 |
! |
|
2826 |
||
155 | 2827 |
insertLines:aStringCollection before:lineNr |
2828 |
"insert a bunch before line lineNr" |
|
2829 |
||
2830 |
self insertLines:aStringCollection from:1 to:aStringCollection size before:lineNr |
|
2831 |
||
2832 |
"Modified: 6.9.1995 / 20:51:03 / claus" |
|
2833 |
! |
|
2834 |
||
654 | 2835 |
insertLines:lines withCR:withCr |
3160 | 2836 |
"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
|
2837 |
Cursor is moved behind insertion. |
641 | 2838 |
If withCr is true, append cr after last line" |
2839 |
||
2840 |
|start end nLines wasOn| |
|
2841 |
||
2842 |
lines notNil ifTrue:[ |
|
3160 | 2843 |
nLines := lines size. |
2844 |
(nLines == 1) ifTrue:[ |
|
2845 |
self insertStringAtCursor:(lines at:1). |
|
2846 |
withCr ifTrue:[ |
|
2847 |
self insertCharAtCursor:(Character cr) |
|
2848 |
] |
|
2849 |
] ifFalse:[ |
|
2850 |
(cursorCol ~~ 1) ifTrue:[ |
|
2851 |
self insertStringAtCursor:(lines at:1). |
|
2852 |
self insertCharAtCursor:(Character cr). |
|
2853 |
start := 2 |
|
2854 |
] ifFalse:[ |
|
2855 |
start := 1 |
|
2856 |
]. |
|
2857 |
withCr ifTrue:[ |
|
2858 |
end := nLines |
|
2859 |
] ifFalse:[ |
|
2860 |
end := nLines - 1 |
|
2861 |
]. |
|
2862 |
(start < nLines) ifTrue:[ |
|
2863 |
(end >= start) ifTrue:[ |
|
2864 |
wasOn := self hideCursor. |
|
2865 |
self insertLines:lines from:start to:end before:cursorLine. |
|
2866 |
self setCursorLine:(cursorLine + (end - start + 1)). |
|
2867 |
wasOn ifTrue:[self showCursor]. |
|
2868 |
] |
|
2869 |
]. |
|
2870 |
withCr ifFalse:[ |
|
2871 |
"last line without cr" |
|
2872 |
self insertStringAtCursor:(lines at:nLines) |
|
2873 |
] |
|
2874 |
] |
|
641 | 2875 |
] |
654 | 2876 |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
2877 |
"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
|
2878 |
"Modified: / 12.6.1998 / 21:51:16 / cg" |
654 | 2879 |
! |
2880 |
||
2881 |
insertLines:lines withCr:withCr |
|
2882 |
"insert a bunch of lines at cursor position. Cursor |
|
2883 |
is moved behind insertion. |
|
2884 |
If withCr is true, append cr after last line" |
|
2885 |
||
2363 | 2886 |
<resource:#obsolete> |
2887 |
||
1292 | 2888 |
self obsoleteMethodWarning:'use #insertLines:withCR:'. |
2889 |
self insertLines:lines withCR:withCr. |
|
2890 |
||
2891 |
"Modified: 31.7.1997 / 23:07:22 / cg" |
|
641 | 2892 |
! |
2893 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2894 |
insertSelectedStringAtCursor:aString |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2895 |
"insert the argument, aString at cursor position and select it" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2896 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2897 |
|startLine startCol| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2898 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2899 |
startLine := cursorLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2900 |
startCol := cursorCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2901 |
self insertStringAtCursor:aString. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2902 |
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
|
2903 |
toLine:cursorLine col:(cursorCol - 1). |
3514
98e103cad51d
insertSelectedStringAtCursor: - make selection visible afterwards;
Michael Beyl <mb@exept.de>
parents:
3510
diff
changeset
|
2904 |
self makeSelectionVisible. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2905 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2906 |
|
1935
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2907 |
insertString:aString atCharacterPosition:charPos |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2908 |
"insert the argument, aString at a character position" |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2909 |
|
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2910 |
|line col| |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2911 |
|
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2912 |
line := self lineOfCharacterPosition:charPos. |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2913 |
col := charPos - (self characterPositionOfLine:line col:1) + 1. |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2914 |
self insertString:aString atLine:line col:col |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2915 |
! |
b59ff4681762
added #insertString:atCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
1929
diff
changeset
|
2916 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2917 |
insertString:aString atLine:lineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2918 |
"insert the string, aString at line/col; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2919 |
handle cr's correctly" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2920 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2921 |
|start "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2922 |
stop "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2923 |
end "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2924 |
subString c |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2925 |
l "{ Class: SmallInteger }" | |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2926 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2927 |
aString isNil ifTrue:[^ self]. |
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2928 |
(aString includes:(Character cr)) ifFalse:[ |
3160 | 2929 |
^ self insertStringWithoutCRs:aString atLine:lineNr col:colNr |
121 | 2930 |
]. |
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2931 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2932 |
l := lineNr. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2933 |
c := colNr. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2934 |
start := 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2935 |
end := aString size. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2936 |
[start <= end] whileTrue:[ |
3160 | 2937 |
stop := aString indexOf:(Character cr) startingAt:start. |
2938 |
stop == 0 ifTrue:[ |
|
2939 |
stop := end + 1 |
|
2940 |
]. |
|
2941 |
subString := aString copyFrom:start to:(stop - 1). |
|
2942 |
self insertStringWithoutCRs:subString atLine:l col:c. |
|
2943 |
(stop <= end) ifTrue:[ |
|
2944 |
c := c + subString size. |
|
2945 |
self insert:(Character cr) atLine:l col:c. |
|
2946 |
l := l + 1. |
|
2947 |
c := 1 |
|
2948 |
]. |
|
2949 |
start := stop + 1 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2950 |
] |
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
2951 |
|
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2952 |
"Modified: / 10.6.1998 / 19:03:59 / cg" |
121 | 2953 |
! |
2954 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2955 |
insertStringAtCursor:aString |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2956 |
"insert the argument, aString at cursor position |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2957 |
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
|
2958 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2959 |
aString isNil ifTrue:[ |
3160 | 2960 |
"new:" |
2961 |
self insertCharAtCursor:(Character cr). |
|
2962 |
^ self |
|
105 | 2963 |
]. |
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2964 |
(aString includes:(Character cr)) ifFalse:[ |
3160 | 2965 |
^ self insertStringWithoutCRsAtCursor:aString |
105 | 2966 |
]. |
2967 |
||
654 | 2968 |
self insertLines:aString asStringCollection withCR:false. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2969 |
|
1560
43d0f7c2143f
use includes: instead of occurrencesOf:.
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
2970 |
"Modified: / 10.6.1998 / 19:03:21 / cg" |
105 | 2971 |
! |
2972 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2973 |
insertStringWithoutCRs:aString atLine:lineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2974 |
"insert aString (which has no crs) at lineNr/colNr" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2975 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2976 |
self withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr. |
4190 | 2977 |
shown ifTrue:[ |
2978 |
font hasOverlappingCharacters ifTrue:[ |
|
2979 |
self invalidateLine:lineNr. |
|
2980 |
] ifFalse:[ |
|
2981 |
self redrawLine:lineNr from:colNr |
|
2982 |
] |
|
2983 |
] |
|
2984 |
||
4191 | 2985 |
"Modified: / 09-11-2010 / 13:43:03 / cg" |
105 | 2986 |
! |
2987 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2988 |
insertStringWithoutCRsAtCursor:aString |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2989 |
"insert a string (which has no crs) at cursor position |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2990 |
- advance cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
2991 |
|
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2992 |
|wasOn oldLen newLen deltaLen| |
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2993 |
|
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
2994 |
aString size > 0 ifTrue:[ |
3160 | 2995 |
wasOn := self hideCursor. |
2996 |
(aString includes:Character tab) ifTrue:[ |
|
2997 |
self checkForExistingLine:cursorLine. |
|
2998 |
oldLen := (list at:cursorLine) size. |
|
2999 |
self insertString:aString atLine:cursorLine col:cursorCol. |
|
3000 |
newLen := (list at:cursorLine) size. |
|
3001 |
deltaLen := newLen - oldLen. |
|
3002 |
] ifFalse:[ |
|
3003 |
self insertString:aString atLine:(cursorLine ? 1) col:cursorCol. |
|
3004 |
deltaLen := aString size. |
|
3005 |
]. |
|
3006 |
self setCursorCol:(cursorCol + deltaLen). |
|
3007 |
wasOn ifTrue:[self showCursor] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3008 |
] |
1563
b4eb49efdfcd
fixed cursor positioning if inserting a string with tabs.
Claus Gittinger <cg@exept.de>
parents:
1561
diff
changeset
|
3009 |
|
b4eb49efdfcd
fixed cursor positioning if inserting a string with tabs.
Claus Gittinger <cg@exept.de>
parents:
1561
diff
changeset
|
3010 |
"Modified: / 10.6.1998 / 20:43:52 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3011 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3012 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3013 |
insertTabAtCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3014 |
"insert spaces to next tab" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3015 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3016 |
|wasOn nextTab| |
105 | 3017 |
|
121 | 3018 |
wasOn := self hideCursor. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3019 |
nextTab := self nextTabAfter:cursorCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3020 |
self insertStringAtCursor:(String new:(nextTab - cursorCol)). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3021 |
self makeCursorVisibleAndShowCursor:wasOn. |
105 | 3022 |
! |
3023 |
||
3542 | 3024 |
joinLines |
3890 | 3025 |
"join lines (remove line-break)" |
3026 |
||
3583 | 3027 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
3028 |
||
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3029 |
self |
3890 | 3030 |
undoableDo:[ |
3031 |
|line col lineLen| |
|
3032 |
||
3033 |
line := cursorLine. |
|
3034 |
col := cursorCol. |
|
3035 |
lineLen := (list at:line) size. |
|
3036 |
col > lineLen ifTrue:[ |
|
3037 |
self insertString:(String new:col-lineLen) atLine:line col:col+1. |
|
3038 |
] ifFalse:[ |
|
3039 |
self deleteCharsAtLine:line fromCol:col toCol:lineLen. |
|
3040 |
]. |
|
3041 |
self mergeLine:line removeBlanks:true. |
|
3042 |
self cursorLine:line col:col. |
|
3043 |
] |
|
3044 |
info:'Join' |
|
3542 | 3045 |
! |
3046 |
||
2952 | 3047 |
mergeLine:lineNr |
3048 |
"merge line lineNr with line lineNr+1" |
|
3049 |
||
3050 |
self mergeLine:lineNr removeBlanks:true |
|
3051 |
||
3052 |
"Modified: 9.9.1997 / 09:28:03 / cg" |
|
3053 |
! |
|
3054 |
||
2506 | 3055 |
parenthizeSelectionWith:openingCharacter and:closingCharacter |
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3056 |
|newSelectionEnd| |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3057 |
|
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3058 |
self hasSelection ifFalse:[^ self]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3059 |
|
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3060 |
newSelectionEnd := selectionEndCol. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3061 |
|
2506 | 3062 |
(self characterAtLine:selectionStartLine col:selectionStartCol) == openingCharacter ifTrue:[ |
3160 | 3063 |
(self characterAtLine:selectionEndLine col:selectionEndCol) == closingCharacter ifTrue:[ |
3064 |
self deleteCharAtLine:selectionEndLine col:selectionEndCol. |
|
3065 |
newSelectionEnd := newSelectionEnd-1. |
|
3066 |
]. |
|
3067 |
self deleteCharAtLine:selectionStartLine col:selectionStartCol. |
|
3068 |
selectionStartLine == selectionEndLine ifTrue:[ |
|
3069 |
newSelectionEnd := newSelectionEnd-1. |
|
3070 |
] |
|
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3071 |
] ifFalse:[ |
3160 | 3072 |
self insert:closingCharacter atLine:selectionEndLine col:selectionEndCol+1. |
3073 |
newSelectionEnd := newSelectionEnd+1. |
|
3074 |
self insert:openingCharacter atLine:selectionStartLine col:selectionStartCol. |
|
3075 |
selectionStartLine == selectionEndLine ifTrue:[ |
|
3076 |
newSelectionEnd := newSelectionEnd+1. |
|
3077 |
] |
|
3078 |
]. |
|
3079 |
self |
|
3080 |
selectFromLine:selectionStartLine col:selectionStartCol |
|
3081 |
toLine:selectionEndLine col:newSelectionEnd. |
|
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3082 |
! |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
3083 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3084 |
removeTrailingBlankLines |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3085 |
"remove all blank lines at end of text" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3086 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3087 |
|lastLine "{ Class: SmallInteger }" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3088 |
line finished| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3089 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3090 |
lastLine := list size. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3091 |
finished := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3092 |
[finished] whileFalse:[ |
3160 | 3093 |
(lastLine <= 1) ifTrue:[ |
3094 |
finished := true |
|
3095 |
] ifFalse:[ |
|
3096 |
line := list at:lastLine. |
|
3097 |
line notNil ifTrue:[ |
|
3098 |
line isBlank ifTrue:[ |
|
3099 |
list at:lastLine put:nil. |
|
3100 |
line := nil |
|
3101 |
] |
|
3102 |
]. |
|
3103 |
line notNil ifTrue:[ |
|
3104 |
finished := true |
|
3105 |
] ifFalse:[ |
|
3106 |
lastLine := lastLine - 1 |
|
3107 |
] |
|
3108 |
] |
|
118 | 3109 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3110 |
(lastLine ~~ list size) ifTrue:[ |
3160 | 3111 |
list grow:lastLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3112 |
"/ self textChanged |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3113 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3114 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3115 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3116 |
replace:patternArg by:replacePatternArg all:all ignoreCase:ign |
3430 | 3117 |
|pattern replacePattern| |
3118 |
||
3119 |
pattern := patternArg string. |
|
3120 |
replacePattern := replacePatternArg string. |
|
3121 |
^ (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
|
3122 |
self rememberSearchPattern:pattern. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3123 |
self rememberSearchPattern:replacePattern. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3124 |
LastSearchIgnoredCase := ign. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3125 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3126 |
undoableDo:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3127 |
all ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3128 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3129 |
replaceString:pattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3130 |
to:replacePattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3131 |
ignoreCase:ign |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3132 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3133 |
(self selectionAsString notNil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3134 |
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
|
3135 |
ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3136 |
self replaceSelectionWith:replacePattern. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3137 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3138 |
search:pattern |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3139 |
ignoreCase:ign |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3140 |
forward:(lastSearchDirection = #forward). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3141 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3142 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3143 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3144 |
info:'Replace' |
3430 | 3145 |
] |
3146 |
||
3147 |
"Created: / 11-07-2006 / 11:19:57 / fm" |
|
3148 |
! |
|
3149 |
||
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3150 |
replaceCharAtCursor:aCharacter |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3151 |
"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
|
3152 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3153 |
|wasOn| |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3154 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3155 |
wasOn := self hideCursor. |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3156 |
aCharacter == (Character cr) ifTrue:[ |
3160 | 3157 |
self cursorReturn |
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3158 |
] ifFalse:[ |
3160 | 3159 |
self replace:aCharacter atLine:cursorLine col:cursorCol. |
3160 |
self cursorRight. |
|
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3161 |
]. |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3162 |
self makeCursorVisibleAndShowCursor:wasOn. |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3163 |
|
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3164 |
"Created: 6.3.1996 / 12:27:42 / cg" |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3165 |
! |
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3166 |
|
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3167 |
replaceFromCharacterPosition:charPos1 to:charPos2 with:newString |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3168 |
"replace a substring at a character position" |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3169 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3170 |
self insertString:newString atCharacterPosition:charPos1. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3171 |
self deleteFromCharacterPosition:charPos1+newString size to:charPos2+newString size. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3172 |
! |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3173 |
|
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3174 |
replaceLines:lines withCR:withCr |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3175 |
"replace a bunch of lines at cursor position. Cursor |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3176 |
is moved behind replacement. |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3177 |
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
|
3178 |
after the last line" |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3179 |
|
1809 | 3180 |
|line col nLines wasOn| |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3181 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3182 |
lines notNil ifTrue:[ |
3160 | 3183 |
wasOn := self hideCursor. |
3184 |
nLines := lines size. |
|
3185 |
line := cursorLine. |
|
3186 |
col := cursorCol. |
|
3187 |
lines keysAndValuesDo:[:i :l | |
|
3188 |
self replaceString:l atLine:line col:col. |
|
3189 |
(i ~~ nLines or:[withCr]) ifTrue:[ |
|
3190 |
line := line + 1. |
|
3191 |
col := 1. |
|
3192 |
] ifFalse:[ |
|
3193 |
col := col + (l size). |
|
3194 |
] |
|
3195 |
]. |
|
3196 |
self cursorLine:line col:col. |
|
3197 |
self makeCursorVisibleAndShowCursor:wasOn. |
|
3198 |
"/ wasOn ifTrue:[self showCursor]. |
|
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3199 |
] |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3200 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3201 |
"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
|
3202 |
"Modified: / 12.6.1998 / 22:05:51 / cg" |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3203 |
! |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3204 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3205 |
replaceSelectionBy:something |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3206 |
"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
|
3207 |
leave cursor after insertion" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3208 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
3209 |
self replaceSelectionBy:something keepCursor:false |
105 | 3210 |
! |
3211 |
||
3212 |
replaceSelectionBy:something keepCursor:keep |
|
3213 |
"delete the selection (if any) and insert something, a character or string; |
|
3214 |
leave cursor after insertion or leave it, depending on keep" |
|
3215 |
||
4051 | 3216 |
|sel l c | |
105 | 3217 |
|
3218 |
l := cursorLine. |
|
3219 |
c := cursorCol. |
|
3220 |
||
3221 |
sel := self selection. |
|
3222 |
sel notNil ifTrue:[ |
|
4053 | 3223 |
self setLastStringToReplace: sel. |
3224 |
||
4010 | 3225 |
self deleteSelection. |
3226 |
replacing := true. |
|
4048 | 3227 |
lastReplacementInfo lastReplacement: ''. |
4010 | 3228 |
undoSupport actionInfo:'replace'. |
3161 | 3229 |
]. |
3230 |
||
3231 |
something isCharacter ifTrue:[ |
|
4051 | 3232 |
lastReplacementInfo lastReplacement notNil ifTrue:[ |
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3233 |
"/ "XXX - replacing text with spaces ..." |
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3234 |
"/ (lastReplacement endsWith:Character space) ifTrue:[ |
4051 | 3235 |
"/ lastReplacement := lastReplacementInfo lastReplacement copyWithoutLast:1 "copyTo:(lastReplacement size - 1)". |
3236 |
"/ lastReplacement := lastReplacementInfo lastReplacement copyWith:something. |
|
3237 |
"/ lastReplacement := lastReplacementInfo lastReplacement copyWith:Character space |
|
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3238 |
"/ ] ifFalse:[ |
4051 | 3239 |
lastReplacementInfo lastReplacement: (lastReplacementInfo lastReplacement copyWith:something). |
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3240 |
"/ ] |
4010 | 3241 |
]. |
3242 |
self isInInsertMode ifTrue:[ |
|
3243 |
self insertCharAtCursor:something |
|
3244 |
] ifFalse:[ |
|
3245 |
self replaceCharAtCursor:something |
|
3246 |
] |
|
105 | 3247 |
] ifFalse:[ |
4010 | 3248 |
something isString ifTrue:[ |
4048 | 3249 |
lastReplacementInfo lastReplacement: something. |
4010 | 3250 |
self isInInsertMode ifTrue:[ |
3251 |
self insertStringAtCursor:something |
|
3252 |
] ifFalse:[ |
|
3253 |
self replaceStringAtCursor:something |
|
3254 |
] |
|
3255 |
] ifFalse:[ |
|
3256 |
Transcript showCR:'EditTextView: non String-or-Character in replace'. |
|
3257 |
]. |
|
105 | 3258 |
]. |
3259 |
keep ifTrue:[ |
|
4010 | 3260 |
self cursorLine:l col:c |
105 | 3261 |
] |
477
e7c29649e8ae
fixed autoIndent & added insert vs. overwriteMode
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3262 |
|
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
3263 |
"Modified: 9.10.1996 / 16:14:35 / cg" |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3264 |
! |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3265 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3266 |
replaceString:aString to:aNewString ignoreCase:ign |
3549 | 3267 |
|continue count| |
3268 |
||
3269 |
self cursorToTop. |
|
3270 |
self selectFromBeginning. |
|
3271 |
count := 0. |
|
3272 |
continue := true. |
|
3273 |
[ continue ] whileTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3274 |
(self selectionAsString notNil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3275 |
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
|
3276 |
ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3277 |
self replaceSelectionWith:aNewString. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3278 |
count := count + 1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3279 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3280 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3281 |
searchFwd:aString |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3282 |
ignoreCase:ign |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3283 |
ifAbsent:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3284 |
Dialog |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3285 |
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
|
3286 |
, count printString , ' times'. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3287 |
continue := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3288 |
]. |
3549 | 3289 |
]. |
3430 | 3290 |
|
3291 |
"Created: / 10-07-2006 / 16:42:48 / fm" |
|
3292 |
! |
|
3293 |
||
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3294 |
replaceStringAtCursor:aString |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3295 |
"replace multiple characters at cursor-position - advance cursor" |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3296 |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3297 |
|wasOn i1 i2| |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3298 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3299 |
wasOn := self hideCursor. |
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3300 |
(aString includes:Character tab) ifTrue:[ |
3160 | 3301 |
"/ need special care for TAB (to move cursor correctly) |
3302 |
i1 := 1. |
|
3303 |
[i1 ~~ 0] whileTrue:[ |
|
3304 |
i2 := aString indexOf:Character tab startingAt:i1. |
|
3305 |
i2 ~~ 0 ifTrue:[ |
|
3306 |
i1 ~~ i2 ifTrue:[ |
|
3307 |
self replaceString:(aString copyFrom:i1 to:i2-1) atLine:cursorLine col:cursorCol. |
|
3308 |
self cursorCol:(cursorCol + (i2 - i1)). |
|
3309 |
]. |
|
3310 |
self replaceTABAtCursor. |
|
3311 |
i2 := i2 + 1. |
|
3312 |
] ifFalse:[ |
|
3313 |
self replaceString:(aString copyFrom:i1) atLine:cursorLine col:cursorCol. |
|
3314 |
self cursorCol:(cursorCol + (aString size - i1 + 1)). |
|
3315 |
]. |
|
3316 |
i1 := i2. |
|
3317 |
] |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3318 |
] ifFalse:[ |
3160 | 3319 |
self replaceString:aString atLine:cursorLine col:cursorCol. |
3320 |
self cursorCol:(cursorCol + aString size). |
|
1566
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3321 |
]. |
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3322 |
self makeCursorVisibleAndShowCursor:wasOn. |
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3323 |
|
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
3324 |
"Created: / 9.6.1998 / 20:33:20 / cg" |
1597
5fdcfcedb91c
fixed cursor positioning after replaceStringAtCursor.
Claus Gittinger <cg@exept.de>
parents:
1596
diff
changeset
|
3325 |
"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
|
3326 |
! |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3327 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3328 |
replaceTABAtCursor |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3329 |
"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
|
3330 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3331 |
|wasOn nextTab| |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3332 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3333 |
wasOn := self hideCursor. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3334 |
nextTab := self nextTabAfter:cursorCol. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3335 |
self replaceStringAtCursor:(String new:(nextTab - cursorCol)). |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3336 |
self makeCursorVisibleAndShowCursor:wasOn. |
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3337 |
|
4e37a55bd140
care for TAB chars in new replace functions.
Claus Gittinger <cg@exept.de>
parents:
1564
diff
changeset
|
3338 |
"Created: / 12.6.1998 / 21:53:23 / cg" |
3890 | 3339 |
! |
3340 |
||
3341 |
wrapLines |
|
3342 |
"wrap lines (insert line-break)" |
|
3343 |
||
3344 |
|lineLength answerString string| |
|
3345 |
||
3346 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
3347 |
||
3348 |
self hasSelection ifFalse:[ |
|
3349 |
self selectLine:cursorLine. |
|
3350 |
]. |
|
3351 |
string := self selectionAsString. |
|
3352 |
string isEmptyOrNil ifTrue:[ |
|
3353 |
Dialog information:(resources string:'Nothing selected.'). |
|
3354 |
^ self. |
|
3355 |
]. |
|
3356 |
||
3357 |
answerString := Dialog request:(resources string:'Line length (wrap after how many chars)?') initialAnswer:80. |
|
3358 |
lineLength := Number readFrom:answerString onError:nil. |
|
3359 |
lineLength < 1 ifTrue:[ |
|
3360 |
lineLength := 1. |
|
3361 |
]. |
|
3362 |
||
3363 |
self |
|
3364 |
undoableDo:[ |
|
3365 |
|inStream line col lineLen lastGoodCol lastStartCol word| |
|
3366 |
||
3367 |
line := selectionStartLine. |
|
3368 |
col := selectionStartCol. |
|
3369 |
||
3370 |
self cutSelection. |
|
3371 |
self cursorLine:line col:col. |
|
3372 |
||
3373 |
lastGoodCol := col. |
|
3374 |
||
3375 |
inStream := string readStream. |
|
3376 |
[ inStream atEnd ] whileFalse:[ |
|
3377 |
[inStream atEnd not and:[inStream peek isSeparator]] whileTrue:[ inStream next ]. |
|
3378 |
word := WriteStream on:(String new:10). |
|
3379 |
[inStream atEnd not and:[inStream peek isSeparator not]] whileTrue:[ word nextPut:inStream next ]. |
|
3380 |
(col + 1 + word size > lineLength) ifTrue:[ |
|
3381 |
self insertCharAtCursor:(Character cr). |
|
3382 |
col := 1. |
|
3383 |
] ifFalse:[ |
|
3384 |
col ~~ 1 ifTrue:[ |
|
3385 |
self insertStringAtCursor:' '. |
|
3386 |
col := col + 1. |
|
3387 |
] |
|
3388 |
]. |
|
3389 |
self insertStringAtCursor:word contents. |
|
3390 |
col := col + word size. |
|
3391 |
]. |
|
3392 |
] |
|
3393 |
info:'Wrap' |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3394 |
! ! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3395 |
|
2752 | 3396 |
!EditTextView methodsFor:'editing-basic'! |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3397 |
|
2952 | 3398 |
basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol |
3549 | 3399 |
"delete characters from startCol to endCol in line lineNr" |
3400 |
||
1803
ac7cc1b99407
scroll left as required, if deleting characters of the longest line,
Claus Gittinger <cg@exept.de>
parents:
1796
diff
changeset
|
3401 |
|line lineSize newLine start stop prevWidth newWidth| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3402 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3403 |
line := self listAt:lineNr. |
827 | 3404 |
|
3160 | 3405 |
(self checkModificationsAllowed and:[line notNil]) ifTrue:[ |
4190 | 3406 |
lineSize := line size. |
3407 |
||
3408 |
startCol == 0 ifFalse:[ start := startCol ] |
|
3409 |
ifTrue:[ start := 1 ]. |
|
3410 |
||
3411 |
endCol > lineSize ifFalse:[ stop := endCol ] |
|
3412 |
ifTrue:[ stop := lineSize ]. |
|
3413 |
||
3414 |
stop >= start ifTrue:[ |
|
3415 |
start ~~ 1 ifTrue:[ newLine := line copyFrom:1 to:(start-1) ] |
|
3416 |
ifFalse:[ newLine := '' ]. |
|
3417 |
||
3418 |
stop == lineSize ifFalse:[ |
|
3419 |
line bitsPerCharacter > newLine bitsPerCharacter ifTrue:[ |
|
3420 |
newLine := line string species fromString:newLine. |
|
3421 |
]. |
|
3422 |
newLine := newLine, (line copyFrom:(stop + 1) to:lineSize) |
|
3423 |
]. |
|
3424 |
||
3425 |
(trimBlankLines and:[newLine isBlank]) ifTrue:[ |
|
3426 |
newLine := nil |
|
3427 |
]. |
|
3428 |
||
3429 |
prevWidth := self widthOfLine:lineNr. |
|
3430 |
||
3431 |
list at:lineNr put:newLine. |
|
3432 |
||
3433 |
(prevWidth = widthOfWidestLine) ifTrue:[ |
|
3434 |
"/ remember old width of this line, |
|
3435 |
"/ only clear widthOfWidestLine, if this lines |
|
3436 |
"/ length was (one of) the longest. |
|
3437 |
"/ avoids slow delete with huge texts. |
|
3438 |
widthOfWidestLine := nil. "i.e. unknown" |
|
3439 |
||
3440 |
"/ scroll left if reqiured |
|
3441 |
viewOrigin x > 0 ifTrue:[ |
|
3442 |
newWidth := self widthOfLine:lineNr. |
|
3443 |
newWidth < (viewOrigin x + width) ifTrue:[ |
|
3444 |
self scrollHorizontalTo:(newWidth |
|
3445 |
- width |
|
3446 |
+ margin + margin |
|
3447 |
+ (font widthOf:' ')) |
|
3448 |
] |
|
3449 |
]. |
|
3450 |
self textChanged. |
|
3451 |
] ifFalse:[ |
|
3452 |
self textChanged "/ textChangedButNoSizeChange |
|
3453 |
]. |
|
3454 |
font hasOverlappingCharacters ifTrue:[ |
|
3455 |
self invalidateLine:lineNr. |
|
3456 |
] ifFalse:[ |
|
3457 |
self redrawLine:lineNr from:start. |
|
3458 |
]. |
|
3459 |
] |
|
827 | 3460 |
] |
3461 |
||
4191 | 3462 |
"Modified: / 09-11-2010 / 13:42:45 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3463 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3464 |
|
2952 | 3465 |
basicDeleteFromLine:startLineNr toLine:endLineNr |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3466 |
"delete some lines" |
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 |
|wasOn nLines| |
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 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3471 |
list isNil ifTrue:[^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3472 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3473 |
wasOn := self hideCursor. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3474 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3475 |
"/ isnt this the same as: |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3476 |
"/ self deleteLinesWithoutRedrawFrom:startLineNr to:endLineNr. |
4226 | 3477 |
startLineNr <= list size ifTrue:[ |
3478 |
list removeFromIndex:startLineNr toIndex:(endLineNr min:list size). |
|
3479 |
]. |
|
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3480 |
"/ TODO: remember old maxwidth of linerange, |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3481 |
"/ only clear widthOfWidestLine, if this max |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3482 |
"/ length was (one of) the longest. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3483 |
"/ avoids slow delete with huge texts. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3484 |
widthOfWidestLine := nil. "/ i.e. unknown |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3485 |
self textChanged. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3486 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3487 |
self redrawFromLine:startLineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3488 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3489 |
nLines := list size. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3490 |
(firstLineShown >= nLines) ifTrue:[ |
4226 | 3491 |
self makeLineVisible:nLines |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3492 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3493 |
wasOn ifTrue:[self showCursor]. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3494 |
|
4226 | 3495 |
"Modified: / 10-11-1998 / 23:55:05 / cg" |
3496 |
"Modified: / 18-03-2011 / 18:26:23 / az" |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3497 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3498 |
|
2952 | 3499 |
basicDeleteLineWithoutRedraw:lineNr |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3500 |
"delete line - no redraw; |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3501 |
return true, if something was really deleted" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3502 |
|
2952 | 3503 |
self checkModificationsAllowed ifFalse:[ ^ false]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3504 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3505 |
(list isNil or:[lineNr > list size]) ifTrue:[^ false]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3506 |
list removeIndex:lineNr. |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3507 |
"/ TODO: remember old maxwidth of linerange, |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3508 |
"/ only clear widthOfWidestLine, if this max |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3509 |
"/ length was (one of) the longest. |
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3510 |
"/ avoids slow delete with huge texts. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3511 |
widthOfWidestLine := nil. "/ i.e. unknown |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3512 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3513 |
^ true |
1717
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3514 |
|
83203096a851
dont forget widthOfWidestLine information when deleting single
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
3515 |
"Modified: / 10.11.1998 / 23:53:24 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3516 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3517 |
|
2952 | 3518 |
basicInsert:aCharacter atLine:lineNr col:colNr |
3160 | 3519 |
"insert a single character at lineNr/colNr; |
827 | 3520 |
set emphasis to character at current position" |
3521 |
||
1929
8e70fb7c9701
fixed handling of italic text when inserting
Claus Gittinger <cg@exept.de>
parents:
1928
diff
changeset
|
3522 |
|line lineSize newLine drawCharacterOnly attribute oldClip x y| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3523 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3524 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3525 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3526 |
aCharacter == (Character cr) ifTrue:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3527 |
self splitLine:lineNr before:colNr. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3528 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3529 |
]. |
827 | 3530 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3531 |
drawCharacterOnly := false. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3532 |
self checkForExistingLine:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3533 |
line := list at:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3534 |
lineSize := line size. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3535 |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
3536 |
self st80EditMode ifFalse:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3537 |
(trimBlankLines |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3538 |
and:[colNr > lineSize |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3539 |
and:[aCharacter == Character space]]) ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3540 |
^ self |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3541 |
] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3542 |
]. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3543 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3544 |
(lineSize == 0) ifTrue:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3545 |
newLine := aCharacter asString species new:colNr. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3546 |
drawCharacterOnly := true |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3547 |
] ifFalse: [ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3548 |
(colNr > lineSize) ifTrue: [ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3549 |
colNr == (lineSize +1) ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3550 |
attribute := line emphasisAt:lineSize |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3551 |
]. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3552 |
newLine := line species new:colNr. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3553 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3554 |
drawCharacterOnly := true |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3555 |
] ifFalse: [ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3556 |
attribute := line emphasisAt:colNr. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3557 |
newLine := line species new:(lineSize + 1). |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3558 |
|
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3559 |
newLine replaceFrom:1 to:(colNr - 1) with:line startingAt:1. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3560 |
newLine replaceFrom:(colNr + 1) to:(lineSize + 1) with:line startingAt:colNr |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3561 |
] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3562 |
]. |
827 | 3563 |
|
2869
48d830f0aea5
insertCharacter: care for wide chars
Claus Gittinger <cg@exept.de>
parents:
2866
diff
changeset
|
3564 |
aCharacter asString bitsPerCharacter > newLine bitsPerCharacter ifTrue:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3565 |
newLine := aCharacter asString species fromString:newLine. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3566 |
line isText ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3567 |
newLine := newLine asText |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3568 |
] |
2869
48d830f0aea5
insertCharacter: care for wide chars
Claus Gittinger <cg@exept.de>
parents:
2866
diff
changeset
|
3569 |
]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3570 |
newLine at:colNr put:aCharacter. |
827 | 3571 |
|
3572 |
attribute notNil ifTrue:[ |
|
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3573 |
newLine emphasisAt:colNr put:attribute. |
827 | 3574 |
]. |
3575 |
||
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3576 |
aCharacter == (Character tab) ifTrue:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3577 |
newLine := self withTabsExpanded:newLine. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3578 |
drawCharacterOnly := false |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3579 |
]. |
827 | 3580 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3581 |
list at:lineNr put:newLine. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3582 |
widthOfWidestLine notNil ifTrue:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3583 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3584 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3585 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3586 |
shown ifTrue:[ |
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3587 |
"/ care for italic text - in this case, we must also |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3588 |
"/ redraw the character before the insertion in order |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3589 |
"/ to fix the slanted piece of the character. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3590 |
"/ (but we must clip, to avoid destoying the character before) |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3591 |
(newLine notNil and:[newLine isText]) ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3592 |
colNr > 1 ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3593 |
cursorVisibleLine notNil ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3594 |
oldClip := self clippingRectangleOrNil. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3595 |
x := (self xOfCol:colNr-1 inVisibleLine:cursorVisibleLine) - viewOrigin x. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3596 |
y := self yOfVisibleLine:cursorVisibleLine. |
4190 | 3597 |
|
3598 |
font hasOverlappingCharacters ifTrue:[ |
|
3599 |
self invalidateLine:lineNr. |
|
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3600 |
] ifFalse:[ |
4190 | 3601 |
drawCharacterOnly ifTrue:[ |
3602 |
self clippingRectangle:(x@y extent:((font width * 2) @ fontHeight)). |
|
3603 |
self redrawLine:lineNr from:colNr-1 to:colNr |
|
3604 |
] ifFalse:[ |
|
3605 |
self clippingRectangle:(x@y extent:((width - x) @ fontHeight)). |
|
3606 |
self redrawLine:lineNr from:colNr-1 |
|
3607 |
]. |
|
3608 |
self clippingRectangle:oldClip. |
|
4189
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3609 |
]. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3610 |
]. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3611 |
^ self. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3612 |
]. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3613 |
]. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3614 |
font hasOverlappingCharacters ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3615 |
self invalidateLine:lineNr. |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3616 |
] ifFalse:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3617 |
drawCharacterOnly ifTrue:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3618 |
self redrawLine:lineNr col:colNr |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3619 |
] ifFalse:[ |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3620 |
self redrawLine:lineNr from:colNr |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3621 |
] |
c9adf30e582a
changed: #basicInsert:atLine:col:
Claus Gittinger <cg@exept.de>
parents:
4165
diff
changeset
|
3622 |
] |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3623 |
] |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3624 |
|
4191 | 3625 |
"Modified: / 09-11-2010 / 13:43:18 / cg" |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3626 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3627 |
|
2952 | 3628 |
basicMergeLine:lineNr removeBlanks:removeBlanks |
1319 | 3629 |
"merge line lineNr with line lineNr+1" |
3630 |
||
827 | 3631 |
|leftPart rightPart bothParts nextLineNr i| |
3632 |
||
2356
6416beb0f23a
backSpace if behond end of text.
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3633 |
(list notNil and:[(list size) >= lineNr]) ifFalse:[ |
3160 | 3634 |
"/ empty list or beyond end of text |
3635 |
^ self |
|
827 | 3636 |
]. |
3637 |
leftPart := self listAt:lineNr. |
|
3638 |
||
3639 |
leftPart isNil ifTrue:[ |
|
3160 | 3640 |
leftPart := ''. |
3641 |
autoIndent ifTrue:[ |
|
3642 |
(i := self leftIndentForLine:cursorLine) == 0 ifFalse:[ |
|
3643 |
leftPart := String new:i |
|
3644 |
] |
|
3645 |
] |
|
827 | 3646 |
]. |
3647 |
self cursorLine:lineNr col:((leftPart size) + 1). |
|
3648 |
nextLineNr := self validateCursorLine:(lineNr + 1). |
|
3649 |
||
3650 |
nextLineNr > (list size) ifFalse:[ |
|
3160 | 3651 |
(rightPart := self listAt:nextLineNr) isNil ifTrue:[ |
3652 |
rightPart := '' |
|
3653 |
] ifFalse:[ |
|
3654 |
removeBlanks ifTrue:[ |
|
3655 |
rightPart := rightPart withoutLeadingSeparators. |
|
3656 |
] |
|
3657 |
]. |
|
3658 |
||
3659 |
bothParts := leftPart , rightPart. |
|
3660 |
(trimBlankLines and:[bothParts isBlank]) ifTrue:[bothParts := nil]. |
|
3661 |
list at:lineNr put:bothParts. |
|
3662 |
self redrawLine:lineNr. |
|
3663 |
self deleteLine:nextLineNr |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3664 |
] |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3665 |
|
1319 | 3666 |
"Created: 9.9.1997 / 09:27:38 / cg" |
3667 |
"Modified: 9.9.1997 / 09:28:27 / cg" |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3668 |
! |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3669 |
|
2952 | 3670 |
basicReplace:aCharacter atLine:lineNr col:colNr |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3671 |
"replace a single character at lineNr/colNr" |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3672 |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3673 |
|line lineSize newLine drawCharacterOnly| |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3674 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3675 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3676 |
|
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3677 |
aCharacter == (Character cr) ifTrue:[ |
4190 | 3678 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3679 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3680 |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3681 |
drawCharacterOnly := true. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3682 |
self checkForExistingLine:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3683 |
line := list at:lineNr. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3684 |
lineSize := line size. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3685 |
|
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3686 |
(trimBlankLines |
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3687 |
and:[colNr > lineSize |
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3688 |
and:[aCharacter == Character space]]) ifTrue:[ |
4190 | 3689 |
^ self |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3690 |
]. |
671
f3fe0d8c604d
added trimBlankLines flag & handling
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
3691 |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3692 |
(lineSize == 0) ifTrue:[ |
4190 | 3693 |
newLine := aCharacter asString species new:colNr. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3694 |
] ifFalse: [ |
4190 | 3695 |
(colNr > lineSize) ifTrue: [ |
3696 |
newLine := line species new:colNr. |
|
3697 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
|
3698 |
] ifFalse: [ |
|
3699 |
newLine := line copy. |
|
3700 |
] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3701 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3702 |
newLine at:colNr put:aCharacter. |
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3703 |
aCharacter == (Character tab) ifTrue:[ |
4190 | 3704 |
newLine := self withTabsExpanded:newLine. |
3705 |
drawCharacterOnly := false |
|
1558
abf35cc39757
minimize redraw in overwrite-replace;
Claus Gittinger <cg@exept.de>
parents:
1557
diff
changeset
|
3706 |
]. |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3707 |
list at:lineNr put:newLine. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3708 |
widthOfWidestLine notNil ifTrue:[ |
4190 | 3709 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3710 |
]. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3711 |
self textChanged. |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3712 |
shown ifTrue:[ |
4190 | 3713 |
font hasOverlappingCharacters ifTrue:[ |
3714 |
self invalidateLine:lineNr. |
|
3715 |
] ifFalse:[ |
|
3716 |
drawCharacterOnly ifTrue:[ |
|
3717 |
self redrawLine:lineNr col:colNr |
|
3718 |
] ifFalse:[ |
|
3719 |
self redrawLine:lineNr from:colNr |
|
3720 |
] |
|
3721 |
] |
|
629
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3722 |
] |
cf0a3ab9b9f1
Text fixes & category changes
Claus Gittinger <cg@exept.de>
parents:
606
diff
changeset
|
3723 |
|
4190 | 3724 |
"Created: / 06-03-1996 / 12:29:20 / cg" |
4191 | 3725 |
"Modified: / 09-11-2010 / 13:42:54 / cg" |
105 | 3726 |
! |
3727 |
||
3235 | 3728 |
basicReplaceString:aString atLine:lineNr col:colNr |
3729 |
"replace multiple characters starting at lineNr/colNr. |
|
3730 |
This is not prepared to encounter special chars (except TAB) |
|
3731 |
in the string." |
|
3732 |
||
3733 |
|line lineSize newLine endCol| |
|
3734 |
||
3735 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
3736 |
||
3737 |
self checkForExistingLine:lineNr. |
|
3738 |
line := list at:lineNr. |
|
3739 |
lineSize := line size. |
|
3740 |
||
3741 |
endCol := colNr + aString size - 1. |
|
3742 |
(lineSize == 0) ifTrue:[ |
|
4190 | 3743 |
newLine := aString species new:endCol. |
3235 | 3744 |
] ifFalse: [ |
4190 | 3745 |
(endCol > lineSize) ifTrue: [ |
3746 |
aString isText ifTrue:[ |
|
3747 |
newLine := aString species new:endCol. |
|
3748 |
] ifFalse:[ |
|
3749 |
newLine := line species new:endCol. |
|
3750 |
]. |
|
3751 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
|
3752 |
] ifFalse: [ |
|
3753 |
aString isText ifTrue:[ |
|
3754 |
newLine := aString species new:line size. |
|
3755 |
newLine replaceFrom:1 to:lineSize with:line startingAt:1. |
|
3756 |
] ifFalse:[ |
|
3757 |
newLine := line copy. |
|
3758 |
] |
|
3759 |
] |
|
3235 | 3760 |
]. |
3761 |
newLine replaceFrom:colNr with:aString. |
|
3762 |
(aString includes:(Character tab)) ifTrue:[ |
|
4190 | 3763 |
newLine := self withTabsExpanded:newLine. |
3235 | 3764 |
]. |
3765 |
list at:lineNr put:newLine. |
|
3766 |
widthOfWidestLine notNil ifTrue:[ |
|
4190 | 3767 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:line). |
3235 | 3768 |
]. |
3769 |
self textChanged. |
|
3770 |
shown ifTrue:[ |
|
4190 | 3771 |
font hasOverlappingCharacters ifTrue:[ |
3772 |
self invalidateLine:lineNr. |
|
3773 |
] ifFalse:[ |
|
3774 |
self redrawLine:lineNr from:colNr |
|
3775 |
] |
|
3235 | 3776 |
] |
3777 |
||
4190 | 3778 |
"Created: / 11-06-1998 / 10:38:32 / cg" |
4191 | 3779 |
"Modified: / 09-11-2010 / 13:42:56 / cg" |
3235 | 3780 |
! |
3781 |
||
2952 | 3782 |
basicSplitLine:lineNr before:colNr |
3783 |
"split the line linNr before colNr; the right part (from colNr) |
|
3784 |
is cut off and inserted after lineNr; the view is redrawn" |
|
3785 |
||
3160 | 3786 |
|line lineSize leftRest rightRest visLine w h mustWait |
2952 | 3787 |
srcY "{ Class: SmallInteger }" | |
3788 |
||
3027 | 3789 |
list isNil ifTrue:[ ^ self ]. |
3790 |
lineNr > (list size) ifTrue:[ ^ self ]. |
|
3791 |
||
3792 |
(colNr == 1) ifTrue:[ |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3793 |
self nonUndoableDo:[ |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3794 |
self insertLine:nil before:lineNr. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3795 |
]. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3796 |
^ self |
3027 | 3797 |
]. |
3798 |
||
3799 |
line := list at:lineNr. |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3800 |
line notNil ifTrue:[ |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3801 |
lineSize := line size. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3802 |
(colNr <= lineSize) ifTrue:[ |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3803 |
rightRest := line copyFrom:colNr to:lineSize. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3804 |
(colNr > 1) ifTrue:[ |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3805 |
leftRest := line copyTo:(colNr - 1) |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3806 |
] |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3807 |
] ifFalse:[ |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3808 |
leftRest := line |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3809 |
] |
3027 | 3810 |
]. |
3811 |
leftRest notNil ifTrue:[ |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3812 |
(trimBlankLines and:[leftRest isBlank]) ifTrue:[leftRest := nil] |
3027 | 3813 |
]. |
3814 |
list at:lineNr put:leftRest. |
|
3815 |
self nonUndoableDo:[ |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3816 |
self withoutRedrawInsertLine:rightRest before:(lineNr + 1). |
3027 | 3817 |
]. |
3818 |
visLine := self listLineToVisibleLine:(lineNr). |
|
3819 |
visLine notNil ifTrue:[ |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3820 |
w := self widthForScrollBetween:lineNr |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3821 |
and:(firstLineShown + nLinesShown). |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3822 |
srcY := topMargin + (visLine * fontHeight). |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3823 |
h := ((nLinesShown - visLine - 1) * fontHeight). |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3824 |
(mustWait := (w > 0 and:[h > 0])) ifTrue:[ |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3825 |
self catchExpose. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3826 |
self |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3827 |
copyFrom:self |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3828 |
x:textStartLeft y:srcY |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3829 |
toX:textStartLeft y:(srcY + fontHeight) |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3830 |
width:w |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3831 |
height:((nLinesShown - visLine - 1) * fontHeight) |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3832 |
async:true. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3833 |
]. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3834 |
self redrawLine:lineNr. |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3835 |
self redrawLine:(lineNr + 1). |
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3836 |
mustWait ifTrue:[self waitForExpose] |
3027 | 3837 |
]. |
3838 |
widthOfWidestLine := nil. "/ unknown |
|
3839 |
self textChanged. |
|
2952 | 3840 |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
3841 |
"Modified: / 06-12-2010 / 13:12:55 / cg" |
2952 | 3842 |
! |
3843 |
||
3844 |
basicWithoutRedrawInsertLine:aString before:lineNr |
|
3845 |
"insert the argument, aString before line lineNr; the string |
|
3846 |
becomes line nileNr; everything else is moved down; the view |
|
3847 |
is not redrawn" |
|
3848 |
||
3849 |
|line| |
|
3850 |
||
3851 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
3852 |
||
3853 |
line := aString. |
|
3854 |
line notNil ifTrue:[ |
|
3160 | 3855 |
line isString ifTrue:[ |
3856 |
line isBlank ifTrue:[ |
|
3857 |
line := nil |
|
3858 |
] ifFalse:[ |
|
3859 |
(line includes:(Character tab)) ifTrue:[ |
|
3860 |
line := self withTabsExpanded:line |
|
3861 |
] |
|
3862 |
] |
|
3863 |
] |
|
2952 | 3864 |
]. |
3865 |
list isNil ifTrue: [ |
|
3160 | 3866 |
list := StringCollection new:lineNr |
2952 | 3867 |
] ifFalse: [ |
3160 | 3868 |
list grow:((list size + 1) max:lineNr) |
3869 |
]. |
|
3870 |
||
3871 |
"I have changed 'replaceFrom:to:with:startingAt:' to correctly handle |
|
2952 | 3872 |
overlapping copy - if it didn't, we had to use:" |
3873 |
" |
|
3874 |
index := list size. |
|
3875 |
[index > lineNr] whileTrue: [ |
|
3160 | 3876 |
pIndex := index - 1. |
3877 |
list at:index put:(list at:pIndex). |
|
3878 |
index := pIndex |
|
2952 | 3879 |
]. |
3880 |
" |
|
3881 |
list replaceFrom:(lineNr + 1) to:(list size) with:list startingAt:lineNr. |
|
3882 |
list at:lineNr put:line. |
|
3883 |
self contentsChanged |
|
3884 |
||
3885 |
"Modified: / 10.6.1998 / 19:00:56 / cg" |
|
3886 |
! |
|
3887 |
||
2954 | 3888 |
basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr |
3889 |
"insert a bunch of lines before line lineNr; the view is not redrawn" |
|
3890 |
||
3891 |
|newLine newLines nLines| |
|
3892 |
||
3893 |
nLines := end - start + 1. |
|
3894 |
newLines := Array new:(lines size). |
|
3895 |
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
|
3896 |
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
|
3897 |
newLine notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3898 |
newLine isString ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3899 |
newLine isBlank ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3900 |
newLine := nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3901 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3902 |
(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
|
3903 |
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
|
3904 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3905 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3906 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3907 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3908 |
newLines at:index put:newLine |
2954 | 3909 |
]. |
3910 |
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
|
3911 |
list := StringCollection new:(lineNr + nLines + 1) |
2954 | 3912 |
] ifFalse: [ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3913 |
list grow:((list size + nLines) max:(lineNr + nLines - 1)) |
3160 | 3914 |
]. |
3915 |
||
3916 |
"I have changed 'replaceFrom:to:with:startingAt:' to correctly handle |
|
2954 | 3917 |
overlapping copy - if it didn't, we had to use:" |
3918 |
" |
|
3919 |
index := list size. |
|
3920 |
[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
|
3921 |
pIndex := index - 1. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3922 |
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
|
3923 |
index := pIndex |
2954 | 3924 |
]. |
3925 |
" |
|
3926 |
list replaceFrom:(lineNr + nLines) to:(list size) with:list startingAt:lineNr. |
|
3927 |
list replaceFrom:lineNr to:(lineNr + nLines - 1) with:newLines startingAt:start. |
|
3928 |
self contentsChanged |
|
3929 |
||
3930 |
"Modified: / 10.6.1998 / 19:01:16 / cg" |
|
3931 |
! |
|
3932 |
||
3933 |
basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr |
|
3934 |
"insert aString (which has no crs) at lineNr/colNr" |
|
3935 |
||
3936 |
|isText strLen line lineSize newLine stringType sz| |
|
3937 |
||
3938 |
(aString notNil) ifFalse:[ ^ self]. |
|
3939 |
||
3940 |
strLen := aString size. |
|
3941 |
self checkForExistingLine:lineNr. |
|
3942 |
||
3943 |
stringType := aString string species. |
|
3944 |
isText := aString isText. |
|
3945 |
line := list at:lineNr. |
|
3946 |
||
3947 |
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
|
3948 |
lineSize := line size. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3949 |
line isString ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3950 |
stringType := line species |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3951 |
] ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3952 |
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
|
3953 |
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
|
3954 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3955 |
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
|
3956 |
]. |
2954 | 3957 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3958 |
lineSize := 0 |
2954 | 3959 |
]. |
3960 |
||
3961 |
((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
|
3962 |
newLine := aString |
2954 | 3963 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3964 |
(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
|
3965 |
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
|
3966 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3967 |
sz := lineSize + strLen |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3968 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3969 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3970 |
isText ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3971 |
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
|
3972 |
] ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3973 |
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
|
3974 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3975 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3976 |
(lineSize ~~ 0) ifTrue: [ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3977 |
(colNr > lineSize) ifTrue: [ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3978 |
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
|
3979 |
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
|
3980 |
] ifFalse: [ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3981 |
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
|
3982 |
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
|
3983 |
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
|
3984 |
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
|
3985 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3986 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
3987 |
newLine replaceFrom:(colNr max:1) to:(colNr + strLen - 1) with:aString startingAt:1 |
2954 | 3988 |
]. |
3989 |
||
3990 |
(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
|
3991 |
newLine := self withTabsExpanded:newLine |
2954 | 3992 |
]. |
3993 |
||
3994 |
list at:lineNr put:newLine. |
|
3995 |
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
|
3996 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:newLine). |
2954 | 3997 |
]. |
3998 |
self textChanged. |
|
3999 |
||
4000 |
"Modified: / 10.6.1998 / 19:01:52 / cg" |
|
4001 |
! |
|
4002 |
||
2952 | 4003 |
deleteCharsAtLine:lineNr fromCol:startCol toCol:endCol |
3549 | 4004 |
"delete characters from startCol to endCol in line lineNr" |
4005 |
||
2952 | 4006 |
|deleted| |
4007 |
||
4008 |
deleted := self textFromLine:lineNr col:startCol toLine:lineNr col:endCol. |
|
4009 |
self basicDeleteCharsAtLine:lineNr fromCol:startCol toCol:endCol. |
|
3115 | 4010 |
self addUndo:(PasteString line:lineNr col:startCol string:deleted info:'delete'). |
2952 | 4011 |
! |
4012 |
||
4013 |
deleteFromLine:startLineNr toLine:endLineNr |
|
4014 |
"delete some lines" |
|
4015 |
||
4016 |
|deleted| |
|
4017 |
||
4018 |
deleted := self textFromLine:startLineNr col:1 toLine:endLineNr+1 col:0. |
|
4019 |
self basicDeleteFromLine:startLineNr toLine:endLineNr. |
|
3115 | 4020 |
self addUndo:(PasteString line:startLineNr col:1 string:deleted info:'delete'). |
2952 | 4021 |
! |
4022 |
||
4023 |
deleteLineWithoutRedraw:lineNr |
|
4024 |
"delete line - no redraw; |
|
4025 |
return true, if something was really deleted" |
|
4026 |
||
4027 |
|deleted ret| |
|
4028 |
||
4029 |
deleted := self textFromLine:lineNr col:1 toLine:lineNr+1 col:0. |
|
4030 |
ret := self basicDeleteLineWithoutRedraw:lineNr. |
|
3115 | 4031 |
self addUndo:(PasteString line:lineNr col:1 string:deleted info:'delete'). |
2952 | 4032 |
^ ret. |
4033 |
! |
|
4034 |
||
4035 |
insert:aCharacter atLine:lineNr col:colNr |
|
3160 | 4036 |
"insert a single character at lineNr/colNr; |
2952 | 4037 |
set emphasis to character at current position" |
4038 |
||
4039 |
self basicInsert:aCharacter atLine:lineNr col:colNr. |
|
4040 |
aCharacter ~~ Character cr ifTrue:[ |
|
3160 | 4041 |
self addUndo:(DeleteCharacters line:lineNr col:colNr info:'insert'). |
2952 | 4042 |
] |
4043 |
! |
|
4044 |
||
4045 |
insertLines:someText from:start to:end before:lineNr |
|
4046 |
"insert a bunch of lines before line lineNr" |
|
4047 |
||
2954 | 4048 |
|text indent visLine w nLines "{ Class: SmallInteger }" |
4049 |
srcY "{ Class: SmallInteger }" |
|
4050 |
dstY "{ Class: SmallInteger }" | |
|
4051 |
||
4052 |
autoIndent ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4053 |
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
|
4054 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4055 |
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
|
4056 |
ln notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4057 |
line := ln withoutLeadingSeparators. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4058 |
(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
|
4059 |
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
|
4060 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4061 |
line |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4062 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4063 |
nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4064 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4065 |
]. |
2954 | 4066 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4067 |
text := someText |
2954 | 4068 |
]. |
4069 |
||
4070 |
visLine := self listLineToVisibleLine:lineNr. |
|
4071 |
(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
|
4072 |
self withoutRedrawInsertLines:text |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4073 |
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
|
4074 |
before:lineNr. |
2954 | 4075 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4076 |
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
|
4077 |
((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
|
4078 |
self withoutRedrawInsertLines:text |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4079 |
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
|
4080 |
before:lineNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4081 |
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
|
4082 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4083 |
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
|
4084 |
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
|
4085 |
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
|
4086 |
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
|
4087 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4088 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4089 |
"/ scroll ... |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4090 |
"/ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4091 |
" |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4092 |
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
|
4093 |
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
|
4094 |
" |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4095 |
self catchExpose. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4096 |
self withoutRedrawInsertLines:text |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4097 |
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
|
4098 |
before:lineNr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4099 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4100 |
copyFrom:self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4101 |
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
|
4102 |
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
|
4103 |
width:w |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4104 |
height:(height - dstY) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4105 |
async:true. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4106 |
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
|
4107 |
self waitForExpose |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4108 |
]. |
2954 | 4109 |
]. |
4110 |
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
|
4111 |
text do:[:line | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4112 |
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
|
4113 |
] |
2954 | 4114 |
]. |
4115 |
self textChanged. |
|
4116 |
||
4117 |
"Modified: 29.1.1997 / 13:02:39 / cg" |
|
2952 | 4118 |
! |
4119 |
||
4120 |
mergeLine:lineNr removeBlanks:removeBlanks |
|
4121 |
"merge line lineNr with line lineNr+1" |
|
4122 |
||
4123 |
|len| |
|
4124 |
||
3583 | 4125 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
4126 |
||
2952 | 4127 |
len := (self listAt:lineNr) size. |
4128 |
self nonUndoableDo:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4129 |
self basicMergeLine:lineNr removeBlanks:removeBlanks. |
2952 | 4130 |
]. |
4131 |
self addUndo:(PasteString new line:lineNr col:len+1 string:(Character cr asString) selected:false). |
|
4132 |
! |
|
4133 |
||
4134 |
replace:aCharacter atLine:lineNr col:colNr |
|
4135 |
"replace a single character at lineNr/colNr" |
|
4136 |
||
4137 |
|originalChar| |
|
4138 |
||
4139 |
originalChar := self characterAtLine:lineNr col:colNr. |
|
4140 |
self basicReplace:aCharacter atLine:lineNr col:colNr. |
|
3235 | 4141 |
self addUndo:(ReplaceCharacters line:lineNr col:colNr character:originalChar info:'replace'). |
2952 | 4142 |
! |
4143 |
||
3131 | 4144 |
replaceContentsWith:newContents |
4145 |
"replace everything" |
|
4146 |
||
4147 |
|originalContents| |
|
4148 |
||
4149 |
originalContents := self contents. |
|
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3241
diff
changeset
|
4150 |
self contents:newContents keepUndoHistory:true. |
3131 | 4151 |
self addUndo:(ReplaceContents text:originalContents info:'replace'). |
4152 |
! |
|
4153 |
||
3130 | 4154 |
replaceLine:lineNr with:newText |
4155 |
"replace a line at lineNr" |
|
4156 |
||
4157 |
|originalLine| |
|
4158 |
||
4159 |
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
|
4160 |
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
|
4161 |
self checkForExistingLine:lineNr |
3479
5f9c6ff4fe6d
care for non-existing line when replacing (i.e. comment)
Claus Gittinger <cg@exept.de>
parents:
3476
diff
changeset
|
4162 |
]. |
3130 | 4163 |
self list at:lineNr put:newText. |
4164 |
self addUndo:(ReplaceLine line:lineNr string:originalLine info:'replace'). |
|
4165 |
self invalidateLine:lineNr. |
|
3479
5f9c6ff4fe6d
care for non-existing line when replacing (i.e. comment)
Claus Gittinger <cg@exept.de>
parents:
3476
diff
changeset
|
4166 |
|
5f9c6ff4fe6d
care for non-existing line when replacing (i.e. comment)
Claus Gittinger <cg@exept.de>
parents:
3476
diff
changeset
|
4167 |
"Modified: / 12-04-2007 / 09:31:33 / cg" |
3130 | 4168 |
! |
4169 |
||
1564
04c13358013e
renamed replaceAll:* to replaceString:*;
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
4170 |
replaceString:aString atLine:lineNr col:colNr |
1557 | 4171 |
"replace multiple characters starting at lineNr/colNr. |
3235 | 4172 |
This is not prepared to encounter special chars (except TAB) in the string." |
4173 |
||
4174 |
|originalString| |
|
1557 | 4175 |
|
4176 |
self checkModificationsAllowed ifFalse:[ ^ self]. |
|
4177 |
||
3235 | 4178 |
originalString := self textFromLine:lineNr col:colNr toLine:lineNr col:colNr+aString size-1. |
4179 |
||
4180 |
self basicReplaceString:aString atLine:lineNr col:colNr. |
|
4181 |
self addUndo:(ReplaceCharacters line:lineNr col:colNr characters:originalString info:'replace'). |
|
1557 | 4182 |
! |
4183 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4184 |
splitLine:lineNr before:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4185 |
"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
|
4186 |
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
|
4187 |
|
2952 | 4188 |
self basicSplitLine:lineNr before:colNr. |
3115 | 4189 |
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
|
4190 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4191 |
|
3130 | 4192 |
withoutRedrawAt:lineNr put:aString |
4193 |
"replace a line at lineNr" |
|
4194 |
||
4195 |
|originalLine| |
|
4196 |
||
4197 |
originalLine := self listAt:lineNr. |
|
4198 |
self addUndo:(ReplaceLine line:lineNr string:originalLine info:'replace'). |
|
4199 |
super withoutRedrawAt:lineNr put:aString. |
|
4200 |
! |
|
4201 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4202 |
withoutRedrawInsertLine:aString before:lineNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4203 |
"insert the argument, aString before line lineNr; the string |
2954 | 4204 |
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
|
4205 |
is not redrawn" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4206 |
|
2952 | 4207 |
self basicWithoutRedrawInsertLine:aString before:lineNr. |
3115 | 4208 |
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
|
4209 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4210 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4211 |
withoutRedrawInsertLines:lines from:start to:end before:lineNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4212 |
"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
|
4213 |
|
2954 | 4214 |
self basicWithoutRedrawInsertLines:lines from:start to:end before:lineNr. |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
4215 |
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
|
4216 |
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
|
4217 |
]. |
121 | 4218 |
! |
4219 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4220 |
withoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4221 |
"insert aString (which has no crs) at lineNr/colNr" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4222 |
|
2954 | 4223 |
self basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr. |
3115 | 4224 |
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
|
4225 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4226 |
|
2752 | 4227 |
!EditTextView methodsFor:'event handling'! |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4228 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4229 |
buttonPress:button x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4230 |
"hide the cursor when button is activated" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4231 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4232 |
hasKeyboardFocus := true. |
2589 | 4233 |
dragIsActive := false. |
4234 |
||
1817
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
4235 |
cursorShown ifTrue: [ |
3915
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4236 |
self drawCursor |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4237 |
]. |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4238 |
|
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4239 |
(button == 1) ifTrue:[ |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4240 |
self hideCursor |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4241 |
]. |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4242 |
"/ 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
|
4243 |
"/ |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4244 |
"/ (button == #paste) ifTrue:[ |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4245 |
"/ self pasteOrReplace. |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4246 |
"/ ^ self |
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4247 |
"/ ]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4248 |
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
|
4249 |
|
1a9e22f755c8
show non-focus cursor when disabled or readOnly
Claus Gittinger <cg@exept.de>
parents:
1816
diff
changeset
|
4250 |
"Modified: / 23.3.1999 / 13:51:40 / cg" |
121 | 4251 |
! |
4252 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4253 |
buttonRelease:button x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4254 |
"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
|
4255 |
|
3789
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4256 |
|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
|
4257 |
|
3915
737e276852c8
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3907
diff
changeset
|
4258 |
(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
|
4259 |
typeOfSelection := nil. |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4260 |
|
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4261 |
dragIsActive ifTrue:[ |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4262 |
self unselect |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4263 |
]. |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4264 |
selectionStartLine isNil ifTrue:[ |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4265 |
clickCol notNil ifTrue:[ |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4266 |
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
|
4267 |
newCursorCol := clickCol. |
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4268 |
|
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4269 |
cursorType ~~ #block ifTrue:[ |
3790 | 4270 |
clickPos notNil ifTrue:[ |
4271 |
"/ we do something special, if the text-cursor's type is not a block-cursor |
|
4272 |
"/ (i.e. if its an ibeam). |
|
4273 |
"/ adjust clickCol if the user clicked in the right third of a character. |
|
4274 |
x1 := self xOfCol:clickCol inVisibleLine:clickLine. |
|
4275 |
x2 := self xOfCol:clickCol+1 inVisibleLine:clickLine. |
|
4276 |
x2_3 := x1 + ((x2-x1) * (2/3)). |
|
4277 |
(clickPos x >= x2_3) ifTrue:[ newCursorCol := clickCol+1 ]. |
|
4278 |
]. |
|
3789
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4279 |
]. |
a9b4805e0754
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
4280 |
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
|
4281 |
] |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4282 |
] |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4283 |
] ifFalse:[ |
4048 | 4284 |
lastStringFromReplaceForNextSearch := nil. "new selection invalidates remembered string" |
3788
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4285 |
]. |
b72271bf0bc2
when clicking on a character, position the cursor on the next
Claus Gittinger <cg@exept.de>
parents:
3786
diff
changeset
|
4286 |
self showCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4287 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4288 |
super buttonRelease:button x:x y:y |
1580
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
4289 |
|
d30e562bea15
allow cursorMovement with button-press
Claus Gittinger <cg@exept.de>
parents:
1577
diff
changeset
|
4290 |
"Modified: / 18.6.1998 / 14:14:05 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4291 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4292 |
|
2580 | 4293 |
cursorKeyPress:key shifted:shifted |
2730
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
4294 |
|n| |
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
4295 |
|
2606
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
4296 |
self changeTypeOfSelectionTo:nil. |
2580 | 4297 |
|
4298 |
(key == #CursorRight) ifTrue:[ |
|
4100
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4299 |
(shifted and:[selectionStartLine isNil]) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4300 |
selectionStartLine := selectionEndLine := clickStartLine := cursorLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4301 |
selectionStartCol := selectionEndCol := clickStartCol := cursorCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4302 |
expandingTop := false. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4303 |
self validateNewSelection. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4304 |
self selectionChanged. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4305 |
self redrawLine:selectionStartLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4306 |
^ self. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4307 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4308 |
|
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4309 |
selectionStartLine notNil ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4310 |
self cursorMovementAllowed ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4311 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4312 |
"/ treat the whole selection as cursor |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4313 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4314 |
self setCursorLine:(selectionEndLine ? selectionStartLine). |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4315 |
selectionEndCol == 0 ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4316 |
selectionEndCol := 1. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4317 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4318 |
self setCursorCol:selectionEndCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4319 |
shifted ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4320 |
self expandSelectionRight. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4321 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4322 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4323 |
self unselect; makeCursorVisible. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4324 |
cursorCol == 1 ifTrue:[^ self]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4325 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4326 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4327 |
self cursorRight. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4328 |
^ self |
2580 | 4329 |
]. |
4330 |
(key == #CursorDown) ifTrue:[ |
|
4100
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4331 |
(shifted and:[selectionStartLine isNil]) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4332 |
selectionStartLine := clickStartLine := cursorLine. selectionEndLine := cursorLine + 1. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4333 |
selectionStartCol := clickStartCol := selectionEndCol := cursorCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4334 |
selectionEndCol == 1 ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4335 |
selectionEndCol := 0. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4336 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4337 |
self validateNewSelection. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4338 |
self selectionChanged. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4339 |
self redrawLine:selectionStartLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4340 |
expandingTop := false. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4341 |
self redrawLine:selectionEndLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4342 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4343 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4344 |
|
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4345 |
selectionStartLine notNil ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4346 |
self cursorMovementAllowed ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4347 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4348 |
"/ treat the whole selection as cursor |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4349 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4350 |
self setCursorLine:(selectionEndLine ? selectionStartLine). |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4351 |
self setCursorCol:selectionStartCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4352 |
cursorCol == 0 ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4353 |
self setCursorCol:1. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4354 |
self setCursorLine:(cursorLine - 1). |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4355 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4356 |
self makeCursorVisible. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4357 |
|
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4358 |
shifted ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4359 |
clickLine := cursorLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4360 |
clickCol := cursorCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4361 |
self expandSelectionDown. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4362 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4363 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4364 |
self unselect. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4365 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4366 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4367 |
|
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4368 |
n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorDown). |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4369 |
self cursorDown:n. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4370 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4371 |
"/ flush keyboard to avoid runaway cursor |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4372 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4373 |
self sensor flushKeyboardFor:self. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4374 |
^ self |
2580 | 4375 |
]. |
4376 |
(key == #CursorLeft or:[key == #CursorUp]) ifTrue:[ |
|
4100
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4377 |
(shifted and:[selectionStartLine isNil]) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4378 |
expandingTop := true. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4379 |
key == #CursorLeft ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4380 |
cursorCol > 1 ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4381 |
selectionStartLine := selectionEndLine := clickStartLine := cursorLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4382 |
selectionEndCol := clickStartCol := cursorCol-1. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4383 |
selectionStartCol := cursorCol-1. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4384 |
self validateNewSelection. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4385 |
self selectionChanged. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4386 |
self redrawLine:selectionStartLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4387 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4388 |
] |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4389 |
] ifFalse:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4390 |
cursorLine > 1 ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4391 |
selectionEndLine := clickStartLine := cursorLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4392 |
selectionEndCol := selectionStartCol := clickStartCol := cursorCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4393 |
selectionStartLine := cursorLine - 1. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4394 |
selectionEndCol == 1 ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4395 |
selectionEndCol := 0. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4396 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4397 |
self validateNewSelection. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4398 |
self selectionChanged. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4399 |
self redrawFromLine:selectionStartLine to:cursorLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4400 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4401 |
] |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4402 |
] |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4403 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4404 |
|
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4405 |
selectionStartLine notNil ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4406 |
self cursorMovementAllowed ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4407 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4408 |
"/ treat the whole selection as cursor |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4409 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4410 |
self setCursorLine:selectionStartLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4411 |
self setCursorCol:selectionStartCol. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4412 |
(key == #CursorLeft) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4413 |
self setCursorCol:(cursorCol+1). "/ compensate for followup crsr-left |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4414 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4415 |
self makeCursorVisible. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4416 |
|
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4417 |
shifted ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4418 |
(key == #CursorUp) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4419 |
clickLine := cursorLine. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4420 |
self expandSelectionUp. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4421 |
] ifFalse:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4422 |
self expandSelectionLeft. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4423 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4424 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4425 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4426 |
self unselect. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4427 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4428 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4429 |
(key == #CursorLeft) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4430 |
self cursorLeft. ^self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4431 |
]. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4432 |
(key == #CursorUp) ifTrue:[ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4433 |
n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorUp). |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4434 |
self cursorUp:n. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4435 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4436 |
"/ flush keyboard to avoid runaway cursor |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4437 |
"/ |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4438 |
self sensor flushKeyboardFor:self. |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4439 |
^ self |
3fbb7392a6e1
changed: #cursorKeyPress:shifted:
Claus Gittinger <cg@exept.de>
parents:
4097
diff
changeset
|
4440 |
]. |
2580 | 4441 |
]. |
4442 |
! |
|
4443 |
||
2952 | 4444 |
doKeyPress:key x:x y:y |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4445 |
"handle keyboard input" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4446 |
|
3781 | 4447 |
<resource: #keyboard (#Paste #Insert #Cut #Again #AgainForAll |
4448 |
#Replace #Undo #Redo #Accept |
|
3780 | 4449 |
#Delete #BasicDelete #BackSpace #BasicBackspace |
4450 |
#SelectWord #DeleteSpaces #Join |
|
4451 |
#SearchMatchingParent #SelectMatchingParents |
|
4452 |
#SelectToEnd #SelectFromBeginning |
|
4453 |
#BeginOfLine #EndOfLine #NextWord #PreviousWord |
|
4454 |
#CursorRight #CursorDown #CursorLeft #CursorUp |
|
4455 |
#Return #Tab #BackTab #NonInsertingTab #Escape |
|
4456 |
#GotoLine #BeginOfText #EndOfText |
|
4457 |
#SelectLine #ExpandSelectionByLine |
|
4458 |
#InsertLine #DeleteLine |
|
4459 |
#SelectLineFromBeginning |
|
4460 |
#LearnKeyboardMacro #ExecuteKeyboardMacro #ToggleInsertMode |
|
4162 | 4461 |
#OpenSpecialCharacterWindow |
3780 | 4462 |
#'F*' #'f*')> |
2017 | 4463 |
|
4238 | 4464 |
|fKeyMacros shiftPressed ctrlPressed i event macroName| |
2184
fb634dc3e606
learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
4465 |
|
fb634dc3e606
learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
4466 |
event := WindowGroup lastEventQuerySignal query. |
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
4467 |
shiftPressed := event hasShift. |
3976 | 4468 |
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
|
4469 |
|
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4470 |
(key == #LearnKeyboardMacro) ifTrue:[ |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4471 |
self toggleLearnMode. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4472 |
^ self |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4473 |
]. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4474 |
(key == #ExecuteKeyboardMacro) ifTrue:[ |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4475 |
self executeLearnedKeyboardMacro. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4476 |
^ self. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4477 |
]. |
3799 | 4478 |
(key == #Undo) ifTrue:[self undo. ^self]. |
4479 |
(key == #Redo) ifTrue:[self redo. ^self]. |
|
4480 |
||
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4481 |
self learnMode ifTrue:[ |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4482 |
learnedMacro add:event. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4483 |
]. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
4484 |
|
4238 | 4485 |
(self executekeyboardMacroNamed:key) ifTrue:[ |
4486 |
"the macro named key exists" |
|
3780 | 4487 |
^ self |
2416
56acdd9e31b5
lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents:
2406
diff
changeset
|
4488 |
]. |
56acdd9e31b5
lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents:
2406
diff
changeset
|
4489 |
|
3257 | 4490 |
(key == #BackSpace or:[key == #BasicBackspace]) ifTrue:[ |
3780 | 4491 |
selectionStartLine notNil ifTrue:[ |
4492 |
((key == #BasicBackspace) |
|
4493 |
or:[ UserPreferences current deleteSetsClipboardText not ]) |
|
4494 |
ifTrue:[ |
|
4495 |
self deleteSelection. |
|
4496 |
] ifFalse: [ |
|
4497 |
self copyAndDeleteSelection. |
|
4498 |
]. |
|
4499 |
^ self |
|
4500 |
]. |
|
4501 |
||
4502 |
self makeCursorVisible. |
|
4503 |
shiftPressed ifTrue:[ |
|
4504 |
self deleteWordBeforeCursor. |
|
4505 |
] ifFalse:[ |
|
4506 |
self deleteCharBeforeCursor. |
|
4507 |
]. |
|
4508 |
||
4509 |
^ self |
|
2205
230cf9cef6c3
searchPatter, if from selection (escape meta characters)
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
4510 |
]. |
2184
fb634dc3e606
learn (Cmd-l)and executeMacro (Cmd-M)
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
4511 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4512 |
(key isMemberOf:Character) ifTrue:[ |
3780 | 4513 |
self handleNonCommandKey:key. |
4514 |
^ self |
|
3235 | 4515 |
]. |
4516 |
||
3782
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4517 |
(key == #ToggleAutoIndent) ifTrue:[ |
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4518 |
self autoIndent:(autoIndent not). |
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4519 |
^ self. |
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4520 |
]. |
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4521 |
|
3235 | 4522 |
key == #ToggleInsertMode ifTrue:[ |
3782
79ae5dad28d4
Ctrl-Insert to toggle insert mode.
Claus Gittinger <cg@exept.de>
parents:
3781
diff
changeset
|
4523 |
self insertMode:(editMode value == EditMode insertMode) not. |
3780 | 4524 |
^ self. |
3160 | 4525 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4526 |
|
4162 | 4527 |
key == #OpenSpecialCharacterWindow ifTrue:[ |
4528 |
CharacterSetView notNil ifTrue:[ |
|
4529 |
self specialCharacters. |
|
4530 |
^ self. |
|
4531 |
] |
|
4532 |
]. |
|
4533 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4534 |
replacing := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4535 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4536 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4537 |
Fn pastes a key-sequence (but only if not overlayed with |
3780 | 4538 |
another function in the keyboard map) |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4539 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4540 |
see TextView>>:x:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4541 |
" |
1177
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
4542 |
(key at:1) asLowercase == $f ifTrue:[ |
3780 | 4543 |
(('[fF][0-9]' match:key) |
4544 |
or:['[fF][0-9][0-9]' match:key]) ifTrue:[ |
|
4545 |
shiftPressed ifFalse:[ |
|
4546 |
fKeyMacros := UserPreferences current functionKeySequences. |
|
4547 |
fKeyMacros notNil ifTrue:[ |
|
4548 |
(fKeyMacros includesKey:key) ifTrue:[ |
|
4549 |
self pasteOrReplace:(fKeyMacros at:key) asStringCollection. |
|
4550 |
^ self |
|
4551 |
] |
|
4552 |
] |
|
4553 |
] |
|
4554 |
]. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4555 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4556 |
|
2506 | 4557 |
(key == #'Ctrl8' or:[key == #'Ctrl9']) ifTrue:[ |
3780 | 4558 |
self parenthizeSelectionWith:$( and:$). |
4559 |
^ self. |
|
2506 | 4560 |
]. |
4561 |
(key == #'Ctrl2') ifTrue:[ |
|
3780 | 4562 |
self parenthizeSelectionWith:$" and:$". |
4563 |
^ self. |
|
2506 | 4564 |
]. |
4565 |
(key == #'Ctrl#') ifTrue:[ |
|
3780 | 4566 |
self parenthizeSelectionWith:$' and:$'. |
4567 |
^ self. |
|
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4568 |
]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4569 |
|
274
6df4bb990f04
handle accept where acceptAction is define (this was a historic leftover)
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
4570 |
(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
|
4571 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4572 |
((key == #Paste) or:[key == #Insert]) ifTrue:[self pasteOrReplace. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4573 |
(key == #Cut) ifTrue:[self cut. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4574 |
(key == #Again) ifTrue:[self again. ^self]. |
3781 | 4575 |
(key == #AgainForAll) ifTrue:[self multipleAgain. ^self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4576 |
|
3542 | 4577 |
(key == #Join) ifTrue:[self joinLines. ^self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4578 |
(key == #Replace) ifTrue:[self replace. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4579 |
(key == #SelectWord) ifTrue:[ |
3780 | 4580 |
self makeCursorVisible. |
4581 |
self selectWordUnderCursor. |
|
4582 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4583 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4584 |
|
2505
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4585 |
(key == #SearchMatchingParent) ifTrue:[self searchForMatchingParenthesis. ^ self]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4586 |
(key == #SelectMatchingParents) ifTrue:[self searchForAndSelectMatchingParenthesis. ^ self]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4587 |
(key == #SelectToEnd) ifTrue:[self selectUpToEnd. ^ self]. |
9204d5313979
Ctrl-8 / Ctrl-9 to parenthize/unparenthize
Claus Gittinger <cg@exept.de>
parents:
2491
diff
changeset
|
4588 |
(key == #SelectFromBeginning) ifTrue:[self selectFromBeginning. ^ self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4589 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4590 |
" disabled - nobody liked it ... |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4591 |
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
|
4592 |
|
1304
173d00c195f9
flush pending keyboard events in cursor-up/down
Claus Gittinger <cg@exept.de>
parents:
1300
diff
changeset
|
4593 |
(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
|
4594 |
(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
|
4595 |
(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
|
4596 |
(key == #Ctrlp) ifTrue:[self unselect. self cursorUp. ^ self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4597 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4598 |
|
1675
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
4599 |
(key == #BeginOfLine) ifTrue:[ |
3780 | 4600 |
shiftPressed ifTrue: [ |
4601 |
"/ "Original St/X code - now use Ctrl modifier" |
|
4602 |
"/ self unselect. |
|
4603 |
"/ self cursorHome. |
|
4604 |
"Jan's modification" |
|
4605 |
self addToSelectionAfter:[ self cursorToBeginOfLine ]. |
|
4606 |
] ifFalse: [ |
|
4607 |
self unselect. |
|
4608 |
ctrlPressed ifTrue:[ |
|
4609 |
self cursorHome. |
|
4610 |
] ifFalse:[ |
|
4611 |
self cursorToBeginOfLine. |
|
4612 |
] |
|
4613 |
]. |
|
4614 |
^ self |
|
1675
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
4615 |
]. |
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
4616 |
(key == #EndOfLine) ifTrue:[ |
3780 | 4617 |
shiftPressed ifTrue:[ |
4618 |
"/ "Original St/X code - now use Ctrl modifier" |
|
4619 |
"/ self unselect. |
|
4620 |
"/ self cursorToBottom |
|
4621 |
"Jan's modification" |
|
4622 |
self addToSelectionAfter:[ self cursorToEndOfLine ] . |
|
4623 |
] ifFalse:[ |
|
4624 |
self unselect. |
|
4625 |
ctrlPressed ifTrue:[ |
|
4626 |
self cursorToBottom |
|
4627 |
] ifFalse:[ |
|
4628 |
self cursorToEndOfLine. |
|
4629 |
] |
|
4630 |
]. |
|
4631 |
^ self |
|
1675
b1cba2341f95
EndOfLine / BeginOfLine unselect first.
Claus Gittinger <cg@exept.de>
parents:
1601
diff
changeset
|
4632 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4633 |
(key == #NextWord) ifTrue:[self cursorToNextWord. ^self]. |
3310 | 4634 |
(key == #EndOfWord) ifTrue:[self cursorToEndOfWord. ^self]. |
499 | 4635 |
(key == #PreviousWord) ifTrue:[self cursorToPreviousWord. ^self]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4636 |
(key == #GotoLine) ifTrue:[self gotoLine. ^self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4637 |
|
2580 | 4638 |
(key == #CursorRight |
4639 |
or:[key == #CursorDown |
|
4640 |
or:[key == #CursorLeft |
|
4641 |
or:[key == #CursorUp]]]) ifTrue:[ |
|
3780 | 4642 |
self cursorKeyPress:key shifted:shiftPressed. |
4643 |
^ self. |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4644 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4645 |
|
3257 | 4646 |
(key == #NonInsertingReturn) ifTrue:[ |
3780 | 4647 |
self unselect. self cursorReturn. |
4648 |
^ self |
|
3257 | 4649 |
]. |
4650 |
||
4651 |
(key == #Return) ifTrue:[ |
|
3780 | 4652 |
shiftPressed ifTrue:[ |
4653 |
self unselect. self cursorReturn. |
|
4654 |
^ self |
|
4655 |
]. |
|
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
4656 |
|
3780 | 4657 |
self isReadOnly ifTrue:[ |
4658 |
self unselect; makeCursorVisible. |
|
4659 |
self cursorReturn |
|
4660 |
] ifFalse:[ |
|
4661 |
self isInInsertMode ifFalse:[ |
|
4662 |
self cursorReturn. |
|
4663 |
autoIndent == true ifTrue:[ |
|
4664 |
i := self leftIndentForLine:(cursorLine + 1). |
|
4665 |
self cursorCol:(i+1 max:1) |
|
4666 |
] |
|
4667 |
] ifTrue:[ |
|
4668 |
"/ old version just unselected ... |
|
4669 |
"/ self unselect; makeCursorVisible. |
|
4670 |
||
4671 |
"/ new version deletes ... |
|
4672 |
typeOfSelection == #paste ifTrue:[ |
|
4673 |
self unselect; makeCursorVisible. |
|
4674 |
] ifFalse:[ |
|
4675 |
self copyAndDeleteSelection. |
|
4676 |
]. |
|
4677 |
self insertCharAtCursor:(Character cr). |
|
4678 |
autoIndent == true ifTrue:[ |
|
4679 |
i := self leftIndentForLine:cursorLine. |
|
4680 |
self indentFromLine:cursorLine toLine:cursorLine. |
|
4681 |
self cursorCol:(i+1 max:1) |
|
4682 |
]. |
|
4683 |
]. |
|
4684 |
]. |
|
4685 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4686 |
]. |
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
|
4687 |
|
2819
a7a41dfb9df7
BackTab / NonInsertingTab modifiers now defined in keyboard.rc
ca
parents:
2817
diff
changeset
|
4688 |
(key == #NonInsertingTab) ifTrue:[ |
3780 | 4689 |
self unselect. self cursorTab. |
4690 |
^ self |
|
2819
a7a41dfb9df7
BackTab / NonInsertingTab modifiers now defined in keyboard.rc
ca
parents:
2817
diff
changeset
|
4691 |
]. |
3422
a0c68e8bd56e
tab with line selection means: indent/undent
Claus Gittinger <cg@exept.de>
parents:
3416
diff
changeset
|
4692 |
((key == #BackTab) or:[(key == #Tab)]) ifTrue:[ |
3780 | 4693 |
self tabMeansNextField ifTrue:[^ super keyPress:key x:x y:y]. |
4694 |
||
4695 |
self hasSelection ifTrue:[ |
|
4696 |
selectStyle == #line ifTrue:[ |
|
4238 | 4697 |
((key == #Tab) and:[shiftPressed not]) ifTrue:[ |
4698 |
macroName := #IndentBy4. |
|
4699 |
] ifFalse:[ |
|
4700 |
macroName := #UndentBy4. |
|
4701 |
]. |
|
4702 |
macroName notNil ifTrue:[ |
|
4703 |
self executekeyboardMacroNamed:macroName. |
|
3780 | 4704 |
]. |
4705 |
] |
|
4706 |
]. |
|
4707 |
||
4708 |
self unselect. |
|
4709 |
(key == #Tab) ifTrue:[ |
|
4710 |
(shiftPressed or:[self isInInsertMode not]) ifTrue:[ |
|
4711 |
self cursorTab. |
|
4712 |
^ self |
|
4713 |
]. |
|
4714 |
self insertTabAtCursor. |
|
4715 |
^ self |
|
4716 |
]. |
|
4717 |
self cursorBacktab. |
|
4718 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4719 |
]. |
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
|
4720 |
|
2883
6cdb4a5a7b5e
shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents:
2880
diff
changeset
|
4721 |
"/ key == #DeleteSpaces ifTrue:[ |
6cdb4a5a7b5e
shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents:
2880
diff
changeset
|
4722 |
(key == #Delete) ifTrue:[ |
3780 | 4723 |
shiftPressed ifTrue:[ |
4724 |
[(cursorCol <= (self listAt:cursorLine) size) |
|
4725 |
and:[self characterUnderCursor isSeparator]] whileTrue:[ |
|
4726 |
self makeCursorVisible. |
|
4727 |
self deleteCharAtCursor. |
|
4728 |
]. |
|
4729 |
^ self |
|
4730 |
] |
|
2883
6cdb4a5a7b5e
shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents:
2880
diff
changeset
|
4731 |
]. |
6cdb4a5a7b5e
shift-delete - delete whiteSpace
Claus Gittinger <cg@exept.de>
parents:
2880
diff
changeset
|
4732 |
|
870 | 4733 |
(key == #Delete |
4734 |
or:[key == #BasicDelete]) ifTrue:[ |
|
4129 | 4735 |
selectionStartLine notNil ifTrue:[ |
4130 | 4736 |
"/ Again function is not supporting Delete action (on purpose, to avoid replacing the next search string) |
4737 |
"/ To remove text repetetively, use Cut instead. |
|
4738 |
"/ self setLastStringToReplace: self selection asStringWithoutFinalCR. |
|
4739 |
"/ lastReplacementInfo lastReplacement: nil. |
|
3780 | 4740 |
((key == #BasicDelete) |
4741 |
or:[UserPreferences current deleteSetsClipboardText not]) ifTrue:[ |
|
4742 |
self deleteSelection. |
|
4743 |
] ifFalse:[ |
|
4744 |
self copyAndDeleteSelection. |
|
4745 |
]. |
|
4746 |
^ self |
|
4747 |
]. |
|
4748 |
self makeCursorVisible. |
|
4749 |
self deleteCharAtCursor. |
|
4750 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4751 |
]. |
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
|
4752 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4753 |
(key == #BeginOfText) ifTrue:[ "i.e. HOME" |
3780 | 4754 |
self unselect. |
4755 |
cursorVisibleLine == 1 ifTrue:[ |
|
4756 |
self cursorHome. |
|
4757 |
] ifFalse:[ |
|
4758 |
self cursorToFirstVisibleLine |
|
4759 |
]. |
|
4760 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4761 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4762 |
(key == #EndOfText) ifTrue:[ "i.e. END" |
3780 | 4763 |
self unselect. |
4764 |
cursorVisibleLine == nFullLinesShown ifTrue:[ |
|
4765 |
self cursorToBottom. |
|
4766 |
] ifFalse:[ |
|
4767 |
self cursorToLastVisibleLine |
|
4768 |
]. |
|
4769 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4770 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4771 |
((key == #Escape) |
3257 | 4772 |
or:[key == #SelectLineFromBeginning]) ifTrue:[ |
3780 | 4773 |
self makeCursorVisible. |
4774 |
self unselect. self selectCursorLineFromBeginning. |
|
4775 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4776 |
]. |
3257 | 4777 |
(key == #SelectLine) ifTrue:[ |
3780 | 4778 |
self makeCursorVisible. |
4779 |
self unselect. self selectCursorLine. |
|
4780 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4781 |
]. |
3257 | 4782 |
(key == #ExpandSelectionByLine) ifTrue:[ |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4783 |
"/ self makeCursorVisible. |
3780 | 4784 |
self selectExpandCursorLine. |
4785 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4786 |
]. |
3257 | 4787 |
(key == #DeleteLine) ifTrue:[ |
3780 | 4788 |
self makeCursorVisible. |
4789 |
self unselect. self deleteCursorLine. |
|
4790 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4791 |
]. |
3257 | 4792 |
(key == #InsertLine) ifTrue:[ |
3780 | 4793 |
self makeCursorVisible. |
4794 |
self unselect. self insertLine:nil before:cursorLine. |
|
4795 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4796 |
]. |
3781 | 4797 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4798 |
super keyPress:key x:x y:y |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4799 |
|
3310 | 4800 |
"Modified: / 06-02-1998 / 11:59:59 / stefan" |
4199
cd7069b3bc33
comment/format in: #doKeyPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
4192
diff
changeset
|
4801 |
"Modified: / 06-12-2010 / 13:15:46 / cg" |
121 | 4802 |
! |
4803 |
||
2952 | 4804 |
executeKeyboardMacro:cmdMacro |
4805 |
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
|
4806 |
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
|
4807 |
ex return. |
2952 | 4808 |
] do:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4809 |
AbortOperationRequest handle:[:ex | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4810 |
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
|
4811 |
ex return. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4812 |
] do:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4813 |
Parser |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4814 |
evaluate:cmdMacro asString |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4815 |
receiver:self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4816 |
notifying:nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4817 |
compile:false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4818 |
]. |
2952 | 4819 |
]. |
4820 |
! |
|
4821 |
||
4822 |
handleNonCommandKey:keyArg |
|
4823 |
|selStartLine selStartCol selEndLine selEndCol sel key| |
|
4824 |
||
4825 |
self isReadOnly ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4826 |
self flash. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4827 |
^ self. |
2952 | 4828 |
]. |
4829 |
||
4830 |
key := keyArg. |
|
4831 |
||
4832 |
typeOfSelection == #paste ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4833 |
"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
|
4834 |
self unselect |
2952 | 4835 |
]. |
4836 |
||
4837 |
selStartLine := selectionStartLine. |
|
4838 |
selStartCol := self selectionStartCol. |
|
4839 |
selEndLine := selectionEndLine. |
|
4840 |
selEndCol := self selectionEndCol. |
|
4841 |
sel := self selection. |
|
4842 |
||
4843 |
(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
|
4844 |
key := CharacterEncoder encode:key from:#'iso10646-1' into:characterEncoding. |
2952 | 4845 |
]. |
4846 |
||
4847 |
"replace selection by what is typed in - |
|
3235 | 4848 |
if word was selected with a space, keep it. |
4849 |
if there was no selection, the keys character is inserted" |
|
4850 |
||
4851 |
editMode value isInsertAndSelectMode ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4852 |
selectionStartLine := selectionStartCol := selectionEndLine := selectionEndCol := nil. |
3235 | 4853 |
]. |
2952 | 4854 |
|
4855 |
(selectStyle == #wordLeft) ifTrue:[ |
|
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4856 |
self replaceSelectionBy:(' ' , key asString) |
2952 | 4857 |
] ifFalse:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4858 |
(selectStyle == #wordRight) ifTrue:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4859 |
self replaceSelectionBy:(key asString , ' '). |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4860 |
self cursorLeft |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4861 |
] ifFalse:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4862 |
self replaceSelectionBy:key |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4863 |
] |
3160 | 4864 |
]. |
2952 | 4865 |
selectStyle := nil. |
4866 |
||
3235 | 4867 |
editMode value isInsertAndSelectMode ifTrue:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4868 |
selectionStartLine := selStartLine. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4869 |
selectionStartCol := selStartCol. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4870 |
selectionEndLine := selEndLine. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4871 |
selectionEndCol := selEndCol. |
3235 | 4872 |
]. |
4873 |
||
2952 | 4874 |
showMatchingParenthesis ifTrue:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4875 |
"emacs style parenthesis shower" |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4876 |
(ExecutingMacroQuery query ? false) ifFalse:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4877 |
"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
|
4878 |
otherwise its too anoying. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4879 |
" |
2952 | 4880 |
" |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4881 |
(#( $( $) $[ $] ${ $} ) includes:key) ifTrue:[ |
2952 | 4882 |
" |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4883 |
(#( $) $] $} ) includes:key) ifTrue:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4884 |
self |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4885 |
searchForMatchingParenthesisFromLine:cursorLine col:(cursorCol - 1) |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4886 |
ifFound:[:line :col | |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4887 |
|savLine savCol sensor| |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4888 |
|
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4889 |
self withCursor:Cursor eye do:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4890 |
savLine := cursorLine. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4891 |
savCol := cursorCol. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4892 |
self cursorLine:line col:col. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4893 |
device flush. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4894 |
|
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4895 |
"/ 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
|
4896 |
"/ arrives in the meantime ... |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4897 |
|
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4898 |
sensor := self sensor. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4899 |
5 timesRepeat:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4900 |
(sensor hasKeyPressEventFor:self) ifFalse:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4901 |
Processor activeProcess millisecondDelay:40. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4902 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4903 |
]. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4904 |
self cursorLine:savLine col:savCol |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4905 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4906 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4907 |
ifNotFound:[self showNotFound] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4908 |
onError:[self beep] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4909 |
]. |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4910 |
] |
2952 | 4911 |
]. |
4912 |
||
4913 |
"/ true "autoExpandWhileTyping" ifTrue:[ |
|
4914 |
"/ self wordAtLine:cursorLine col:cursorCol-1 do:[ |
|
4915 |
"/ :beginLine :beginCol :endLine :endCol :style | |
|
4916 |
"/ |
|
4917 |
"/ self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
|
4918 |
"/ self selection. |
|
4919 |
"/ typeOfSelection := #paste. |
|
3160 | 4920 |
"/ ]. |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4921 |
"/ ]. |
3235 | 4922 |
editMode value isInsertAndSelectMode ifTrue:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4923 |
selectionStartLine isNil ifTrue:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4924 |
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
|
4925 |
] ifFalse:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
4926 |
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
|
4927 |
]. |
3235 | 4928 |
]. |
2952 | 4929 |
! |
4930 |
||
4931 |
keyPress:key x:x y:y |
|
4932 |
"handle keyboard input" |
|
4933 |
||
4934 |
self undoableDo:[ |
|
4242 | 4935 |
self doKeyPress:key x:x y:y |
4936 |
]. |
|
4937 |
self repairDamage |
|
4938 |
||
4939 |
"Modified: / 18-04-2011 / 21:35:27 / cg" |
|
2952 | 4940 |
! |
4941 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4942 |
mapped |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4943 |
"view was made visible" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4944 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4945 |
super mapped. |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
4946 |
self updateCursorVisibleLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4947 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4948 |
|
3268
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4949 |
requestAutoAccept |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4950 |
"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
|
4951 |
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
|
4952 |
|
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4953 |
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
|
4954 |
"/ nope - |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
4955 |
^ false |
3268
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4956 |
]. |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4957 |
self accept. |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4958 |
^ true. |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4959 |
! |
d30df22739ca
move #requestAutoAccept from EditField to superclass EditTextView
Stefan Vogel <sv@exept.de>
parents:
3257
diff
changeset
|
4960 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4961 |
sizeChanged:how |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4962 |
"make certain, cursor is visible after the sizechange" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4963 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4964 |
|cv| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4965 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4966 |
cv := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4967 |
super sizeChanged:how. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4968 |
cv notNil ifTrue:[ |
3160 | 4969 |
self makeLineVisible:cursorLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4970 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4971 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
4972 |
|
1807 | 4973 |
!EditTextView methodsFor:'focus handling'! |
4974 |
||
4975 |
hasKeyboardFocus:aBoolean |
|
4976 |
"sent by the windowGroup, a delegate or myself to make me show a block cursor |
|
4977 |
(otherwise, I would not know about this)" |
|
4978 |
||
4979 |
hasKeyboardFocus := aBoolean. |
|
3160 | 4980 |
(cursorShown |
4981 |
and:[self enabled |
|
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
4982 |
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
|
4983 |
self drawCursor |
1816
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
4984 |
]. |
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
4985 |
|
0b9380a0cc7e
only take keyboardFocus (and show cursor)
Claus Gittinger <cg@exept.de>
parents:
1811
diff
changeset
|
4986 |
"Modified: / 23.3.1999 / 13:49:35 / cg" |
1807 | 4987 |
! |
4988 |
||
4989 |
showFocus:explicit |
|
4990 |
"in addition to however my superclass thinks how a focusView is to be |
|
4991 |
displayed, show the cursor when I got the focus" |
|
4992 |
||
4993 |
self showCursor. |
|
4994 |
self hasKeyboardFocus:true. |
|
4995 |
super showFocus:explicit |
|
4996 |
||
4997 |
"Modified: 11.12.1996 / 16:56:54 / cg" |
|
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
4998 |
! |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
4999 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5000 |
wantsFocusWithPointerEnter |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5001 |
"return true, if I want the focus when |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5002 |
the mouse pointer enters" |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5003 |
|
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
5004 |
(UserPreferences current focusFollowsMouse ~~ false |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
5005 |
and:[(styleSheet at:#'editText.requestFocusOnPointerEnter' default:true) |
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
5006 |
and:[self enabled |
4097
233d27a2b0a0
comment/format in: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
5007 |
and:[self isReadOnly not]]] |
233d27a2b0a0
comment/format in: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
5008 |
) ifTrue:[ |
233d27a2b0a0
comment/format in: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
5009 |
^ true |
1918
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5010 |
]. |
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5011 |
|
3ac07b97b4f7
use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
5012 |
^ false |
1807 | 5013 |
! ! |
5014 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5015 |
!EditTextView methodsFor:'formatting'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5016 |
|
4237 | 5017 |
executekeyboardMacroNamed:macroName |
4238 | 5018 |
|functionKeySequences cmdMacro| |
5019 |
||
5020 |
functionKeySequences := UserPreferences current functionKeySequences. |
|
5021 |
functionKeySequences notNil ifTrue:[ |
|
5022 |
cmdMacro := functionKeySequences at:macroName ifAbsent:nil. |
|
5023 |
]. |
|
5024 |
||
5025 |
cmdMacro isNil ifTrue:[ |
|
5026 |
^ false. |
|
5027 |
] ifFalse:[ |
|
5028 |
self |
|
5029 |
undoableDo:[ self executeKeyboardMacro:cmdMacro ] |
|
5030 |
info: macroName. |
|
5031 |
^ true. |
|
5032 |
]. |
|
5033 |
||
5034 |
" |
|
5035 |
EditTextView new open |
|
5036 |
contents:'bla'; |
|
5037 |
selectAll; |
|
5038 |
executekeyboardMacroNamed:#IndentBy4. |
|
5039 |
EditTextView new open |
|
5040 |
contents:'bla'; |
|
5041 |
selectAll; |
|
5042 |
executekeyboardMacroNamed:#blabla. |
|
5043 |
" |
|
4237 | 5044 |
! |
5045 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5046 |
indent |
3221 | 5047 |
"indent a line-range - this is done by searching for the |
5048 |
last non-empty line before the selection, and changing the indent |
|
5049 |
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
|
5050 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5051 |
|start end| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5052 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5053 |
selectionStartLine isNil ifTrue:[^ self]. |
3221 | 5054 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5055 |
start := selectionStartLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5056 |
end := selectionEndLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5057 |
(selectionEndCol == 0) ifTrue:[ |
3786 | 5058 |
end := end - 1 |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5059 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5060 |
self unselect. |
3160 | 5061 |
self |
3786 | 5062 |
undoableDo:[self indentFromLine:start toLine:end] |
5063 |
info:'Indent' |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5064 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5065 |
|
4237 | 5066 |
indentBy4 |
4238 | 5067 |
self executekeyboardMacroNamed:#IndentBy4 |
4237 | 5068 |
|
5069 |
"Modified: / 06-04-2011 / 18:52:40 / cg" |
|
5070 |
! |
|
5071 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5072 |
indentFromLine:start toLine:end |
3221 | 5073 |
"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
|
5074 |
last non-empty line before start, and change the indent |
3221 | 5075 |
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
|
5076 |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5077 |
|leftStart delta d line spaces| |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5078 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5079 |
leftStart := self leftIndentForLine:start. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5080 |
(leftStart == 0) ifTrue:[^ self]. |
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 |
delta := leftStart - (self leftIndentOfLine:start). |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5083 |
(delta == 0) ifTrue:[^ self]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5084 |
(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
|
5085 |
spaces := String new:delta |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5086 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5087 |
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
|
5088 |
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
|
5089 |
line notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5090 |
line isBlank ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5091 |
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
|
5092 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5093 |
(delta > 0) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5094 |
line := spaces , line. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5095 |
widthOfWidestLine notNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5096 |
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
|
5097 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5098 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5099 |
"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
|
5100 |
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
|
5101 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5102 |
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
|
5103 |
(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
|
5104 |
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
|
5105 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5106 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5107 |
widthOfWidestLine := nil |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5108 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5109 |
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
|
5110 |
self textChanged. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5111 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5112 |
] |
3221 | 5113 |
]. |
5114 |
"/ self redrawFromLine:start to:end |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5115 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5116 |
"Modified: 5.3.1996 / 14:59:18 / cg" |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5117 |
! |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5118 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5119 |
leftIndentForLine:lineNr |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5120 |
"find an appropriate indent for a line. |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5121 |
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
|
5122 |
and returning its indent." |
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5123 |
|
827 | 5124 |
"SHOULD GO TO ListView" |
5125 |
||
5126 |
|line lnr indent| |
|
5127 |
||
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5128 |
lnr := lineNr. |
827 | 5129 |
|
5130 |
[lnr ~~ 1] whileTrue:[ |
|
3160 | 5131 |
lnr := lnr - 1. |
5132 |
line := self listAt:lnr. |
|
5133 |
||
5134 |
line notNil ifTrue:[ |
|
5135 |
indent := line indexOfNonSeparatorStartingAt:1. |
|
5136 |
indent ~~ 0 ifTrue:[ |
|
5137 |
^ indent - 1 |
|
5138 |
] |
|
5139 |
] |
|
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5140 |
]. |
827 | 5141 |
^ 0 |
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5142 |
|
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5143 |
"Created: 5.3.1996 / 14:58:53 / cg" |
4237 | 5144 |
! |
5145 |
||
5146 |
undentBy4 |
|
4238 | 5147 |
self executekeyboardMacroNamed:#UndentBy4. |
4237 | 5148 |
|
5149 |
"Modified: / 06-04-2011 / 18:52:49 / cg" |
|
105 | 5150 |
! ! |
5151 |
||
0 | 5152 |
!EditTextView methodsFor:'initialization'! |
5153 |
||
941 | 5154 |
fetchDeviceResources |
5155 |
"fetch device colors, to avoid reallocation at redraw time" |
|
5156 |
||
5157 |
super fetchDeviceResources. |
|
5158 |
||
1993 | 5159 |
cursorFgColor notNil ifTrue:[cursorFgColor := cursorFgColor onDevice:device]. |
5160 |
cursorBgColor notNil ifTrue:[cursorBgColor := cursorBgColor onDevice:device]. |
|
5161 |
cursorNoFocusFgColor notNil ifTrue:[cursorNoFocusFgColor := cursorNoFocusFgColor onDevice:device]. |
|
941 | 5162 |
|
5163 |
"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
|
5164 |
"Modified: 18.2.1997 / 15:02:46 / cg" |
941 | 5165 |
! |
5166 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5167 |
initEvents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5168 |
"enable enter/leave events in addition" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5169 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5170 |
super initEvents. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5171 |
self enableEnterLeaveEvents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5172 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5173 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5174 |
initStyle |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5175 |
"initialize style specific stuff" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5176 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5177 |
super initStyle. |
2088 | 5178 |
lineSpacing := 1. "/ for underwave - also looks better |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5179 |
lockUpdates := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5180 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5181 |
cursorFgColor := DefaultCursorForegroundColor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5182 |
cursorFgColor isNil ifTrue:[cursorFgColor := bgColor]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5183 |
cursorBgColor := DefaultCursorBackgroundColor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5184 |
cursorBgColor isNil ifTrue:[cursorBgColor := fgColor]. |
1334 | 5185 |
cursorType := cursorTypeNoFocus := DefaultCursorType. |
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
5186 |
DefaultCursorTypeNoFocus notNil ifTrue:[ |
3160 | 5187 |
cursorTypeNoFocus := DefaultCursorTypeNoFocus. |
1534
bcb211e1b41a
read noFocus cursorStyle from styleSheet
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
5188 |
]. |
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
5189 |
cursorNoFocusFgColor := DefaultCursorNoFocusForegroundColor. |
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
5190 |
cursorNoFocusFgColor isNil ifTrue:[ |
3160 | 5191 |
cursorType ~~ #block ifTrue:[ |
5192 |
cursorNoFocusFgColor := cursorBgColor |
|
5193 |
] ifFalse:[ |
|
5194 |
cursorNoFocusFgColor := cursorFgColor |
|
5195 |
] |
|
1022
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
5196 |
]. |
4362861fe15e
allow specification of noFocusCursor color in styleSheet.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
5197 |
|
2088 | 5198 |
"Modified: / 15.12.1999 / 22:27:45 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5199 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5200 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5201 |
initialize |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5202 |
"initialize a new EditTextView; |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5203 |
setup some instance variables" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5204 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5205 |
super initialize. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5206 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5207 |
self level:-1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5208 |
readOnly := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5209 |
fixedSize := false. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5210 |
exceptionBlock := [:errorText | ]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5211 |
cursorShown := prevCursorState := true. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5212 |
cursorLine := 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5213 |
cursorVisibleLine := 1. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5214 |
cursorCol := 1. |
2815 | 5215 |
cursorLineHolder := 1 asValue. |
5216 |
cursorColHolder := 1 asValue. |
|
2119 | 5217 |
modifiedChannel := ValueHolder with:false. |
5218 |
acceptChannel := ValueHolder with:false. |
|
1437
ab84b08a9f9c
allow modified- and acceptChannels to be set.
Claus Gittinger <cg@exept.de>
parents:
1426
diff
changeset
|
5219 |
acceptChannel addDependent:self. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5220 |
showMatchingParenthesis := false. |
3296
7322b2e5222c
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3269
diff
changeset
|
5221 |
hasKeyboardFocus := false. |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
5222 |
tabMeansNextField := false. |
474
f73ed1f5cb75
added autoIndent functionality
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5223 |
autoIndent := false. |
3235 | 5224 |
editMode := EditMode insertMode asValue. |
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5225 |
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
|
5226 |
trimBlankLines := self st80EditMode not. |
2131 | 5227 |
cursorMovementWhenUpdating := #beginOfText. |
4048 | 5228 |
lastReplacementInfo := LastReplacementInfo new. |
1596
0bbdb4e9fc43
made st80Mode also an inst-flag;
Claus Gittinger <cg@exept.de>
parents:
1591
diff
changeset
|
5229 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5230 |
"/ enable drop by default |
2589 | 5231 |
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
|
5232 |
|
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
5233 |
undoSupport := UndoSupport for:self. |
0 | 5234 |
! ! |
5235 |
||
2580 | 5236 |
!EditTextView methodsFor:'macros'! |
5237 |
||
5238 |
executeLearnedKeyboardMacro |
|
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5239 |
(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
|
5240 |
ExecutingMacroQuery |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5241 |
answer:true |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5242 |
do:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5243 |
learnedMacro do:[:event | |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5244 |
WindowGroup lastEventQuerySignal answer:event |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5245 |
do:[ |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5246 |
self |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5247 |
dispatchEvent:event |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5248 |
withFocusOn:nil |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5249 |
delegate:false |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5250 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5251 |
] |
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5252 |
]. |
2580 | 5253 |
] ifFalse:[ |
3813
8d719ca5812d
dont show matching parents when executing a keyboard macros
Claus Gittinger <cg@exept.de>
parents:
3811
diff
changeset
|
5254 |
self flash. |
2580 | 5255 |
]. |
5256 |
! |
|
5257 |
||
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5258 |
learnMode |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5259 |
"true if currently learning" |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5260 |
|
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5261 |
^ (learnMode value ? false). |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5262 |
! |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5263 |
|
2580 | 5264 |
learnMode:aBoolean |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5265 |
"toggle the learn-mode" |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5266 |
|
2580 | 5267 |
|fg bg| |
5268 |
||
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5269 |
self learnModeHolder value:aBoolean. |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5270 |
|
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5271 |
aBoolean ifTrue:[ |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5272 |
learnedMacro := OrderedCollection new. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5273 |
fg := Color white. |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5274 |
bg := Color black. |
2580 | 5275 |
] ifFalse:[ |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5276 |
cursorFgColor := fg := (DefaultCursorForegroundColor ? bgColor). |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5277 |
cursorBgColor := bg := (DefaultCursorBackgroundColor ? fgColor). |
2580 | 5278 |
]. |
5279 |
self cursorForegroundColor:fg backgroundColor:bg. |
|
5280 |
! |
|
5281 |
||
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5282 |
learnModeHolder |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5283 |
learnMode isNil ifTrue:[ |
3160 | 5284 |
learnMode := false asValue |
2795
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5285 |
]. |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5286 |
^ learnMode |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5287 |
! |
1f7b5f242eee
learnMode and insertMode as valueHolders
Claus Gittinger <cg@exept.de>
parents:
2792
diff
changeset
|
5288 |
|
2580 | 5289 |
toggleLearnMode |
3793
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5290 |
"toggle the learn-mode" |
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5291 |
|
5a6074a257c1
learnmode: also learn backspace !
Claus Gittinger <cg@exept.de>
parents:
3790
diff
changeset
|
5292 |
self learnMode:(self learnMode not). |
2580 | 5293 |
! ! |
5294 |
||
121 | 5295 |
!EditTextView methodsFor:'menu actions'! |
5296 |
||
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5297 |
babelFishTranslate:fromToModeString |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5298 |
"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
|
5299 |
|
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5300 |
|original translated| |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5301 |
|
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5302 |
original := self selectionAsString. |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5303 |
original size == 0 ifTrue:[^ self]. |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5304 |
|
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5305 |
self withWaitCursorDo:[ |
4143
34d78a2ca94f
changed: #babelFishTranslate:
Claus Gittinger <cg@exept.de>
parents:
4142
diff
changeset
|
5306 |
(HostNameLookupError , SOAP::SoapImplError) handle:[:ex | |
3799 | 5307 |
Dialog warn:('Translation failed - WEB Service error:\\%1.' bindWith:ex description allBold) withCRs |
5308 |
] do:[ |
|
5309 |
translated := SOAP::BabelFishClient new translate:original mode:fromToModeString. |
|
5310 |
] |
|
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5311 |
]. |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5312 |
|
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5313 |
"/ v pasteOrReplace:translated |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5314 |
self cursorLine:(self selectionEndLine) col:(self selectionEndCol + 1). |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5315 |
self unselect. |
3799 | 5316 |
self |
5317 |
undoablePaste:translated |
|
5318 |
info:'Translate' |
|
3495 | 5319 |
|
5320 |
"Modified: / 28-07-2007 / 13:27:21 / cg" |
|
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5321 |
! |
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5322 |
|
3517 | 5323 |
compareWithClipboard |
5324 |
"compare the selection against the clipboard contents" |
|
5325 |
||
5326 |
|t1 t2| |
|
5327 |
||
5328 |
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
|
5329 |
t2 isEmptyOrNil ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5330 |
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
|
5331 |
^ self. |
3517 | 5332 |
]. |
5333 |
||
5334 |
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
|
5335 |
t1 := self selectionAsString. |
3517 | 5336 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5337 |
t1 := self contents asString |
3517 | 5338 |
]. |
5339 |
t1 := t1 string. |
|
5340 |
||
5341 |
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
|
5342 |
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
|
5343 |
^ self. |
3517 | 5344 |
]. |
5345 |
DiffTextView |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5346 |
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
|
5347 |
and:t2 label:'Clipboard' |
3517 | 5348 |
! |
5349 |
||
121 | 5350 |
cut |
5351 |
"cut selection into copybuffer" |
|
5352 |
||
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5353 |
self deleteCopyToClipboard:true |
121 | 5354 |
! |
5355 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5356 |
defaultForGotoLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5357 |
"return a default value to show in the gotoLine box" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5358 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5359 |
cursorLine notNil ifTrue:[ |
3160 | 5360 |
^ cursorLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5361 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5362 |
^ super defaultForGotoLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5363 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5364 |
|
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5365 |
deleteCopyToClipboard:toClipboard |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5366 |
"cut selection into copybuffer" |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5367 |
|
4129 | 5368 |
|line col history sel | |
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5369 |
|
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5370 |
(self checkModificationsAllowed) ifFalse:[ |
3786 | 5371 |
self flash. |
5372 |
^ self |
|
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5373 |
]. |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5374 |
|
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5375 |
sel := self selection. |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5376 |
sel notNil ifTrue:[ |
4129 | 5377 |
self setLastStringToReplace: sel. |
4053 | 5378 |
|
3786 | 5379 |
line := selectionStartLine. |
5380 |
col := selectionStartCol. |
|
5381 |
||
5382 |
toClipboard ifTrue:[ |
|
5383 |
" |
|
5384 |
remember in CopyBuffer |
|
5385 |
" |
|
5386 |
self setClipboardText:sel. "/ lastString. |
|
5387 |
]. |
|
5388 |
||
5389 |
" |
|
5390 |
append to DeleteHistory (if there is one) |
|
5391 |
" |
|
5392 |
history := Smalltalk at:#DeleteHistory. |
|
5393 |
history notNil ifTrue:[ |
|
5394 |
history addAll:(sel asStringCollection). |
|
5395 |
history size > 1000 ifTrue:[ |
|
5396 |
history := history copyFrom:(history size - 1000) |
|
5397 |
]. |
|
5398 |
]. |
|
5399 |
||
5400 |
" |
|
5401 |
now, delete it |
|
5402 |
" |
|
5403 |
self |
|
5404 |
undoableDo:[self deleteSelection] |
|
5405 |
info:'Delete'. |
|
4048 | 5406 |
lastReplacementInfo lastReplacement: nil |
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5407 |
] ifFalse:[ |
3786 | 5408 |
" |
5409 |
a cut without selection will search&cut again |
|
5410 |
" |
|
5411 |
self undoableDo:[ |
|
5412 |
self again |
|
5413 |
] |
|
3324
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5414 |
] |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5415 |
|
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5416 |
"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
|
5417 |
! |
1297aecf6699
delete does not (by default) update the clipboard
Claus Gittinger <cg@exept.de>
parents:
3313
diff
changeset
|
5418 |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5419 |
editMenu |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5420 |
"return the views middleButtonMenu" |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5421 |
|
3781 | 5422 |
<resource: #keyboard (#Again #AgainForAll #Copy #Cut #Paste #Accept |
5423 |
#Find #GotoLine #SaveAs #Print |
|
3890 | 5424 |
#PasteFromHistory #Join #Wrap #Undo #Redo |
3781 | 5425 |
#ToggleAutoIndent #ToggleInsertMode |
5426 |
#LearnKeyboardMacro #ExecuteKeyboardMacro )> |
|
1261
bdb18f73205c
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1198
diff
changeset
|
5427 |
<resource: #programMenu> |
1054 | 5428 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5429 |
|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
|
5430 |
transSub sortSub what undoIdx redoIdx sensor main mainItems| |
1515 | 5431 |
|
2460 | 5432 |
items := #( |
3781 | 5433 |
('Redo' redo Redo ) |
5434 |
('Again (for All)' multipleAgain AgainForAll ) |
|
3731 | 5435 |
('-' ) |
5436 |
('Search...' search Find ) |
|
5437 |
('Goto Line...' gotoLine GotoLine ) |
|
5438 |
('-' ) |
|
4213 | 5439 |
('Tools' tools ) ). |
5440 |
CharacterSetView notNil ifTrue:[ |
|
5441 |
items := items , |
|
5442 |
#( |
|
5443 |
('Special Characters...' specialCharacters OpenSpecialCharacterWindow ) |
|
5444 |
). |
|
5445 |
]. |
|
5446 |
items := items , #( |
|
3731 | 5447 |
('-' ) |
5448 |
('Save As...' save SaveAs ) |
|
5449 |
('Print' doPrint Print ) |
|
5450 |
('=' ) |
|
4213 | 5451 |
('Misc' misc ShiftCtrl) ). |
2460 | 5452 |
|
2866 | 5453 |
miscItems := #( |
3781 | 5454 |
('AutoIndent \c' autoIndent: ToggleAutoIndent ) |
5455 |
('InsertMode \c' insertMode: ToggleInsertMode ) |
|
3731 | 5456 |
('-' ) |
5457 |
('Paste Previous...' pasteOrReplaceFromHistory PasteFromHistory ) |
|
3781 | 5458 |
('Join Lines' joinLines Join ) |
3890 | 5459 |
('Wrap Lines' wrapLines Wrap ) |
3731 | 5460 |
('-' ) |
3781 | 5461 |
('Learn Macro' learnMode: LearnKeyboardMacro) |
5462 |
('Execute Macro' executeLearnedKeyboardMacro ExecuteKeyboardMacro ) |
|
3731 | 5463 |
('-' ) |
3811 | 5464 |
('Insert File...' insertFile ) |
5465 |
('Insert URL Contents...' insertURL ) |
|
3781 | 5466 |
('Insert new UUID' insertUUID ) |
5467 |
('Insert Date && Time' insertDateAndTime ) |
|
3732 | 5468 |
('-' ) |
5469 |
('Insert File as String Literal...' insertFileAsStringLiteral ) |
|
5470 |
('Paste as String Literal' pasteAsStringLiteral ) |
|
3731 | 5471 |
('-' ) |
5472 |
). |
|
4213 | 5473 |
"/ CharacterSetView notNil ifTrue:[ |
5474 |
"/ miscItems := miscItems , |
|
5475 |
"/ #( |
|
5476 |
"/ ('Special Characters...' specialCharacters OpenSpecialCharacterWindow ) |
|
5477 |
"/ ). |
|
5478 |
"/ ]. |
|
3406
c5efa51e7929
dont offer CharacterSetView display in menu, if its not available.
Claus Gittinger <cg@exept.de>
parents:
3402
diff
changeset
|
5479 |
miscItems := miscItems , |
3731 | 5480 |
#( |
5481 |
('Font...' changeFont ) |
|
2870 | 5482 |
"/ ('Encoding...' changeEncoding ) |
3731 | 5483 |
). |
2866 | 5484 |
|
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5485 |
translateItems := #( |
3731 | 5486 |
('English -> German' (babelFishTranslate: 'en_de') ) |
5487 |
('English -> French' (babelFishTranslate: 'en_fr') ) |
|
5488 |
('English -> Italian' (babelFishTranslate: 'en_it') ) |
|
5489 |
('English -> Spanish' (babelFishTranslate: 'en_es') ) |
|
5490 |
('English -> Portuguese' (babelFishTranslate: 'en_pt') ) |
|
5491 |
('-' ) |
|
5492 |
('German -> English' (babelFishTranslate: 'de_en') ) |
|
5493 |
('French -> English' (babelFishTranslate: 'fr_en') ) |
|
5494 |
('Italian -> English' (babelFishTranslate: 'it_en') ) |
|
5495 |
('Spanish -> English' (babelFishTranslate: 'es_en') ) |
|
5496 |
('Portuguese -> English' (babelFishTranslate: 'pt_en') ) |
|
5497 |
). |
|
3221 | 5498 |
|
5499 |
sortItems := #( |
|
3731 | 5500 |
('Lines' (sortSelection:ignoreCase: #lines false) ) |
5501 |
('Lines by First Word' (sortSelection:ignoreCase: #linesByFirstWord false) ) |
|
5502 |
('Lines by nth Word' (sortSelection:ignoreCase: #linesByNthWord false) ) |
|
5503 |
('Words' (sortSelection:ignoreCase: #words false) ) |
|
5504 |
('-' ) |
|
5505 |
('Lines (ignore case)' (sortSelection:ignoreCase: #lines true) ) |
|
5506 |
('Lines by First Word (ignore case)'(sortSelection:ignoreCase: #linesByFirstWord true) ) |
|
5507 |
('Lines by nth Word (ignore case)' (sortSelection:ignoreCase: #linesByNthWord true) ) |
|
5508 |
('Words (ignore case)' (sortSelection:ignoreCase: #words true) ) |
|
5509 |
). |
|
2680
208d99c47d7c
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
5510 |
|
2762 | 5511 |
toolItems := #( |
3731 | 5512 |
('Indent' indent ) |
5513 |
('Sort' sort ) |
|
5514 |
('-' ) |
|
5515 |
('Google Spell' googleSpellingSuggestion ) |
|
5516 |
('Translate' babelFishTranslate ) |
|
5517 |
('Compare with Clipboard...' compareWithClipboard ) |
|
5518 |
). |
|
2762 | 5519 |
|
3623
f99c70d99425
close door to fileBrowser and workspace
Claus Gittinger <cg@exept.de>
parents:
3595
diff
changeset
|
5520 |
Smalltalk isStandAloneApp ifFalse:[ |
3731 | 5521 |
toolItems := toolItems , #( |
5522 |
('-' ) |
|
5523 |
('Open FileBrowser on It' openFileBrowserOnIt ) |
|
5524 |
('Open Workspace with It' openWorkspaceWithIt ) |
|
5525 |
). |
|
3623
f99c70d99425
close door to fileBrowser and workspace
Claus Gittinger <cg@exept.de>
parents:
3595
diff
changeset
|
5526 |
]. |
f99c70d99425
close door to fileBrowser and workspace
Claus Gittinger <cg@exept.de>
parents:
3595
diff
changeset
|
5527 |
|
2460 | 5528 |
sub := PopUpMenu itemList:items resources:resources performer:model. |
2461 | 5529 |
sub receiver:self. |
2460 | 5530 |
|
2919 | 5531 |
toolSub := PopUpMenu itemList:toolItems resources:resources performer:model. |
5532 |
toolSub receiver:self. |
|
5533 |
sub subMenuAt:#tools put:toolSub. |
|
5534 |
||
3495 | 5535 |
transSub := PopUpMenu itemList:translateItems resources:resources performer:model. |
5536 |
transSub receiver:self. |
|
5537 |
toolSub subMenuAt:#babelFishTranslate put:transSub. |
|
5538 |
||
5539 |
sortSub := PopUpMenu itemList:sortItems resources:resources performer:model. |
|
5540 |
sortSub receiver:self. |
|
5541 |
toolSub subMenuAt:#sort put:sortSub. |
|
3221 | 5542 |
|
2866 | 5543 |
subSub := PopUpMenu itemList:miscItems resources:resources performer:model. |
5544 |
subSub receiver:self. |
|
2952 | 5545 |
subSub checkToggleAt:#autoIndent: put:autoIndent. |
3235 | 5546 |
subSub checkToggleAt:#insertMode: put:(self isInInsertMode). |
2952 | 5547 |
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
|
5548 |
|
2866 | 5549 |
sub subMenuAt:#misc put:subSub. |
5550 |
||
3495 | 5551 |
mainItems := #( |
3731 | 5552 |
('Undo' undo Undo ) |
5553 |
('Again' again Again ) |
|
5554 |
('-' ) |
|
5555 |
('Cut' cut Cut ) |
|
5556 |
('Copy' copySelection Copy ) |
|
5557 |
('Paste' pasteOrReplace Paste ) |
|
5558 |
('-' ) |
|
5559 |
('Accept' accept Accept ) |
|
5560 |
('=' ) |
|
5561 |
('More' others Ctrl ) |
|
5562 |
). |
|
3495 | 5563 |
main := PopUpMenu itemList:mainItems resources:resources. |
5564 |
main subMenuAt:#others put:sub. |
|
5565 |
||
5566 |
sensor := self sensor. |
|
5567 |
(sensor notNil and:[sensor ctrlDown]) ifTrue:[ |
|
5568 |
sensor shiftDown ifTrue:[ |
|
3731 | 5569 |
m := subSub |
5570 |
] ifFalse:[ |
|
5571 |
m := sub |
|
5572 |
] |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5573 |
] ifFalse:[ |
3731 | 5574 |
m := main |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5575 |
]. |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5576 |
|
2676 | 5577 |
SOAP::GoogleClient isNil ifTrue:[ |
3731 | 5578 |
"/ GoogleClient new spellingSuggestionOf: 'Smmalltlaak and Soaap'. |
5579 |
m disable:#googleSpellingSuggestion |
|
2676 | 5580 |
]. |
5581 |
||
3811 | 5582 |
HTTPInterface isNil ifTrue:[ |
5583 |
m disableAll:#(insertURL) |
|
5584 |
]. |
|
5585 |
||
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
5586 |
self isReadOnly ifTrue:[ |
3731 | 5587 |
m disableAll:#(undo again multipleAgain redo |
5588 |
paste pasteOrReplace pasteOrReplaceFromHistory |
|
5589 |
cut indent autoIndent: insertMode: |
|
3811 | 5590 |
insertFile insertFileAsStringLiteral insertURL |
5591 |
babelFishTranslate googleSpellingSuggestion sort |
|
3731 | 5592 |
joinLines insertUUID insertDateAndTime pasteAsStringLiteral |
5593 |
specialCharacters) |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5594 |
]. |
2817 | 5595 |
self hasSelectionForCopy ifFalse:[ |
3731 | 5596 |
m disable:#copySelection. |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5597 |
]. |
2416
56acdd9e31b5
lifted mkeyboardMacro handling from Workspace to EditTextView
Claus Gittinger <cg@exept.de>
parents:
2406
diff
changeset
|
5598 |
self hasSelection ifFalse:[ |
3731 | 5599 |
m disableAll:#(cut googleSpellingSuggestion babelFishTranslate openFileBrowserOnIt openWorkspaceWithIt sort indent). |
2762 | 5600 |
] ifTrue:[ |
3731 | 5601 |
(Error handle:[:ex | |
5602 |
ex return:false |
|
5603 |
] do:[ |
|
4042 | 5604 |
|fn| |
5605 |
fn := self selectionAsString. |
|
5606 |
fn asFilename exists or:[ fn withoutSeparators withoutQuotes asFilename exists ] |
|
3731 | 5607 |
]) ifFalse:[ |
5608 |
m disableAll:#(openFileBrowserOnIt). |
|
5609 |
] |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5610 |
]. |
2569 | 5611 |
self hasUndoAction ifFalse:[ |
3731 | 5612 |
m disable:#undo. |
3115 | 5613 |
] ifTrue:[ |
3731 | 5614 |
what := undoSupport undoActionInfo. |
5615 |
what notNil ifTrue:[ |
|
5616 |
undoIdx := m indexOf:#undo. |
|
5617 |
m labelAt:undoIdx put:(resources string:'Undo (%1)' with:what). |
|
5618 |
] |
|
1818
aa16d9b96e40
fixed cut to not compress multiple blanks.
Claus Gittinger <cg@exept.de>
parents:
1817
diff
changeset
|
5619 |
]. |
2952 | 5620 |
self hasRedoAction ifFalse:[ |
3731 | 5621 |
sub disable:#redo. |
3569
d3eec21d0ece
also show \"what-would-be-done\" in redo item
Claus Gittinger <cg@exept.de>
parents:
3566
diff
changeset
|
5622 |
] ifTrue:[ |
3731 | 5623 |
what := undoSupport redoActionInfo. |
5624 |
what notNil ifTrue:[ |
|
5625 |
redoIdx := sub indexOf:#redo. |
|
5626 |
sub labelAt:redoIdx put:(resources string:'Redo (%1)' with:what). |
|
5627 |
] |
|
2952 | 5628 |
]. |
1108 | 5629 |
acceptEnabled == false ifTrue:[ |
3731 | 5630 |
m disable:#accept |
1108 | 5631 |
]. |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5632 |
^ m. |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5633 |
|
4213 | 5634 |
"Modified: / 17-01-2011 / 11:29:21 / cg" |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5635 |
! |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
400
diff
changeset
|
5636 |
|
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5637 |
getTextSelectionFromHistory |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5638 |
|sel list box history| |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5639 |
|
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5640 |
history := device getCopyBufferHistory copy. |
3160 | 5641 |
list := history collect:[:entry | |
4165
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5642 |
|text shown| |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5643 |
|
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5644 |
text := entry asString string asCollectionOfLines. |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5645 |
shown := text detect:[:line| line notEmptyOrNil] ifNone:[' ']. |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5646 |
text size > 1 ifTrue:[ |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5647 |
shown := shown,(resources string:' ... [%1 lines]' with:text size). |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5648 |
]. |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5649 |
shown |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5650 |
]. |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5651 |
|
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5652 |
box := ListSelectionBox |
4165
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5653 |
title:(resources string:'Clipboard History') |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5654 |
okText:(resources string:'Paste') |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5655 |
abortText:(resources string:'Cancel') |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5656 |
list:list |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5657 |
action:[:idx | idx notNil ifTrue:[sel := history at:idx]]. |
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5658 |
box label:(resources string:'Select Previous Copybuffer String'). |
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5659 |
box useIndex:true. |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5660 |
box show. |
3160 | 5661 |
^ sel. |
4165
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5662 |
|
869b207a6964
changed: #getTextSelectionFromHistory
Claus Gittinger <cg@exept.de>
parents:
4162
diff
changeset
|
5663 |
"Modified: / 25-08-2010 / 22:02:14 / cg" |
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5664 |
! |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5665 |
|
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5666 |
getTextSelectionOrTextSelectionFromHistory |
2730
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
5667 |
|
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
5668 |
self sensor shiftDown ifTrue:[ |
3855 | 5669 |
^ self getTextSelectionFromHistory |
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5670 |
]. |
2724 | 5671 |
|
5672 |
"/ return either the (xterm-) selection or the clipBoard |
|
3160 | 5673 |
^ self |
3855 | 5674 |
getClipboardText:(self sensor ctrlDown |
5675 |
ifTrue:[#selection] |
|
5676 |
ifFalse:[#clipboard]) |
|
2544
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5677 |
! |
48ab4ed67816
shift-paste: select pasted string from copyBuffer history
Claus Gittinger <cg@exept.de>
parents:
2540
diff
changeset
|
5678 |
|
2676 | 5679 |
googleSpellingSuggestion |
5680 |
"insert the google-spelling suggestion for the selected text. |
|
5681 |
Requires that the SOAP stuff is loaded and working." |
|
5682 |
||
2677 | 5683 |
|text suggestion| |
2676 | 5684 |
|
5685 |
self withWaitCursorDo:[ |
|
3799 | 5686 |
text := self selection asString string withoutSeparators. |
5687 |
text size == 0 ifTrue:[^ self]. |
|
5688 |
||
5689 |
SOAP::SoapImplError handle:[:ex | |
|
5690 |
Dialog warn:('Spelling correction failed - WEB Service error:\\%1.' bindWith:ex description allBold) withCRs. |
|
5691 |
^ self. |
|
5692 |
] do:[ |
|
5693 |
suggestion := SOAP::GoogleClient new spellingSuggestionOf:text. |
|
5694 |
]. |
|
5695 |
suggestion size == 0 ifTrue:[ |
|
5696 |
Transcript showCR:'No SpellingSuggestion from Google for: ' , text. |
|
5697 |
^ self. |
|
5698 |
]. |
|
5699 |
]. |
|
5700 |
self |
|
5701 |
undoablePaste:suggestion |
|
5702 |
info:'Spelling Suggestion'. |
|
3495 | 5703 |
|
5704 |
"Modified: / 28-07-2007 / 13:25:10 / cg" |
|
2676 | 5705 |
! |
5706 |
||
3595 | 5707 |
insertDateAndTime |
5708 |
"insert the curent date and time string" |
|
5709 |
||
5710 |
typeOfSelection := nil. |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5711 |
self |
3786 | 5712 |
undoableDo:[ self pasteOrReplace:(Timestamp now printStringRFC1123Format)] |
3799 | 5713 |
info:'Paste Date and Time' |
3595 | 5714 |
! |
5715 |
||
2676 | 5716 |
insertFile |
3160 | 5717 |
"insert contents of a file |
2676 | 5718 |
- ask user for filename using a fileSelectionBox." |
5719 |
||
3731 | 5720 |
self insertFileAsStringLiteral:false |
5721 |
! |
|
5722 |
||
5723 |
insertFileAsStringLiteral |
|
5724 |
"insert a file's contents as a string literal. |
|
5725 |
Almost the same as the insert file, but single-quotes are doubled, |
|
5726 |
to make it a legal string literal" |
|
5727 |
||
5728 |
self insertFileAsStringLiteral:true |
|
5729 |
! |
|
5730 |
||
5731 |
insertFileAsStringLiteral:asStringLiteral |
|
5732 |
"insert contents of a file; either as-is or as a string literal. |
|
5733 |
- ask user for filename using a fileSelectionBox." |
|
5734 |
||
3409
d650e3ae9085
insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents:
3406
diff
changeset
|
5735 |
|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
|
5736 |
|
d650e3ae9085
insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents:
3406
diff
changeset
|
5737 |
((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
|
5738 |
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
|
5739 |
and:[ selFn isRegularFile ]]) |
d650e3ae9085
insert-file menu item cares for current selection being a filename
Claus Gittinger <cg@exept.de>
parents:
3406
diff
changeset
|
5740 |
ifTrue:[ |
3731 | 5741 |
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
|
5742 |
]. |
2757
b98097eaf8dc
Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents:
2756
diff
changeset
|
5743 |
|
b98097eaf8dc
Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents:
2756
diff
changeset
|
5744 |
[ |
3731 | 5745 |
|why| |
5746 |
||
5747 |
file := Dialog |
|
5748 |
requestFileName:(resources string:'Insert Contents Of:') |
|
5749 |
default:initial |
|
5750 |
ok:(resources string:'Insert') |
|
5751 |
abort:(resources string:'Cancel') |
|
5752 |
pattern:nil |
|
5753 |
fromDirectory:directoryForFileDialog. |
|
5754 |
file isNil ifTrue:[ |
|
5755 |
"cancel" |
|
5756 |
^ self. |
|
5757 |
]. |
|
5758 |
file := file asFilename. |
|
5759 |
directoryForFileDialog := file. |
|
5760 |
||
5761 |
ok := file isReadable and:[file isDirectory not]. |
|
5762 |
ok ifFalse:[ |
|
5763 |
file isReadable ifFalse:[ |
|
5764 |
why := '%1 is unreadable.\\Please try again.' |
|
5765 |
] ifTrue:[ |
|
5766 |
why := '%1 is a directory.\\Please try again.' |
|
5767 |
]. |
|
5768 |
Dialog warn:(resources stringWithCRs:why with:file pathName). |
|
5769 |
]. |
|
2909 | 5770 |
] doUntil:[ok]. |
2757
b98097eaf8dc
Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents:
2756
diff
changeset
|
5771 |
|
b98097eaf8dc
Stc cannot handle thisContext restart in true-Block.
Stefan Vogel <sv@exept.de>
parents:
2756
diff
changeset
|
5772 |
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
|
5773 |
self |
3786 | 5774 |
undoableDo:[ self paste:(asStringLiteral ifTrue:[text storeString] ifFalse:[text]) ] |
3799 | 5775 |
info:'Paste File' |
3495 | 5776 |
|
5777 |
"Modified: / 28-07-2007 / 13:23:32 / cg" |
|
5778 |
! |
|
5779 |
||
3811 | 5780 |
insertURL |
5781 |
"insert contents of a URL |
|
5782 |
- ask user for URL using a dialog." |
|
5783 |
||
5784 |
self insertURLAsStringLiteral:false |
|
5785 |
! |
|
5786 |
||
5787 |
insertURLAsStringLiteral:asStringLiteral |
|
5788 |
"insert contents of a file; either as-is or as a string literal. |
|
5789 |
- ask user for filename using a fileSelectionBox." |
|
5790 |
||
5791 |
|sel url text response initial| |
|
5792 |
||
5793 |
(sel := self selectionAsString) notEmptyOrNil |
|
5794 |
ifTrue:[ |
|
5795 |
initial := sel. |
|
5796 |
]. |
|
5797 |
||
5798 |
url := Dialog |
|
5799 |
request:(resources string:'Insert Contents of URL:') |
|
5800 |
initialAnswer:initial |
|
5801 |
okLabel:(resources string:'Insert') |
|
5802 |
title:(resources string:'URL'). |
|
5803 |
url isNil ifTrue:[ |
|
5804 |
"cancel" |
|
5805 |
^ self. |
|
5806 |
]. |
|
5807 |
response := HTTPInterface get:url. |
|
5808 |
response isErrorResponse ifTrue:[ |
|
5809 |
Dialog warn:(resources string:'Could not fetch the document: %1' with:url). |
|
5810 |
^ self. |
|
5811 |
]. |
|
5812 |
text := response data asString. |
|
5813 |
||
5814 |
self |
|
5815 |
undoableDo:[ |
|
5816 |
self paste:(asStringLiteral ifTrue:[text storeString] ifFalse:[text]) |
|
5817 |
] |
|
5818 |
info:'Insert Contents of URL' |
|
5819 |
! |
|
5820 |
||
3495 | 5821 |
insertUUID |
5822 |
"insert a new UUID's string" |
|
5823 |
||
5824 |
typeOfSelection := nil. |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5825 |
self |
3786 | 5826 |
undoableDo:[ self pasteOrReplace:(UUID genUUID printString)] |
3799 | 5827 |
info:'Paste New UUID' |
3495 | 5828 |
|
5829 |
"Created: / 28-07-2007 / 13:01:16 / cg" |
|
2676 | 5830 |
! |
5831 |
||
2762 | 5832 |
openFileBrowserOnIt |
5833 |
"open a fileBrowser on the selected fileName" |
|
5834 |
||
5835 |
|fn dir| |
|
5836 |
||
5837 |
fn := self selectionAsString asFilename. |
|
5838 |
fn exists ifFalse:[ |
|
4042 | 5839 |
fn := self selectionAsString withoutSeparators withoutQuotes asFilename. |
5840 |
fn exists ifFalse:[ |
|
5841 |
^ self warn:'Oops - file is gone'. |
|
5842 |
]. |
|
2762 | 5843 |
]. |
5844 |
(dir := fn) isDirectory ifFalse:[ |
|
4042 | 5845 |
dir := fn directory |
2762 | 5846 |
]. |
5847 |
UserPreferences fileBrowserClass openOn:dir |
|
5848 |
! |
|
5849 |
||
3483
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5850 |
openWorkspaceWithIt |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5851 |
"open a workspace containing the selected text" |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5852 |
|
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5853 |
|text| |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5854 |
|
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5855 |
text := self selectionAsString. |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5856 |
WorkspaceApplication openWith:text selected:true |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5857 |
|
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5858 |
"Created: / 26-05-2007 / 06:05:22 / cg" |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5859 |
! |
8ef0f9a0737f
+openWorkspaceWithSelection menu function
Claus Gittinger <cg@exept.de>
parents:
3482
diff
changeset
|
5860 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5861 |
paste |
1289 | 5862 |
"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
|
5863 |
Then paste at cursor position." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5864 |
|
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
5865 |
self checkModificationsAllowed ifTrue:[ |
3160 | 5866 |
self withSelfAndTextForPasteDo:[:me :text | |
5867 |
me unselect. |
|
5868 |
me undoablePaste:text |
|
5869 |
] |
|
2952 | 5870 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5871 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5872 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5873 |
paste:someText |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5874 |
"paste someText at cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5875 |
|
3825 | 5876 |
self paste:someText withCR:false |
5877 |
! |
|
5878 |
||
5879 |
paste:someText withCR:withCR |
|
5880 |
"paste someText at cursor" |
|
5881 |
||
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
5882 |
|s nLines startLine startCol l1 l2 c1 c2 codingErrorReported| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5883 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
5884 |
self checkModificationsAllowed ifFalse:[^ self]. |
2853
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5885 |
someText isNil ifTrue:[^ self]. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5886 |
|
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5887 |
s := someText. |
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
5888 |
codingErrorReported := false. |
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
5889 |
CharacterEncoderError handle:[:ex | |
3825 | 5890 |
|code msg| |
5891 |
||
5892 |
code := ex parameter. |
|
5893 |
codingErrorReported ifFalse:[ |
|
5894 |
msg := 'Cannot represent pasted string in this Views encoding (',characterEncoding,').'. |
|
5895 |
code notNil ifTrue:[ |
|
5896 |
msg := msg , '\\Reason: No representation for ' , (code radixPrintStringRadix:16). |
|
5897 |
]. |
|
5898 |
Dialog warn:(resources stringWithCRs:msg). |
|
5899 |
codingErrorReported := true. |
|
5900 |
]. |
|
5901 |
ex proceedWith:ex defaultValue |
|
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
5902 |
] do:[ |
3825 | 5903 |
s isString ifTrue:[ |
5904 |
s encoding ~~ characterEncoding ifTrue:[ |
|
5905 |
s := s encodeFrom:(s encoding) into:characterEncoding. |
|
5906 |
]. |
|
5907 |
||
5908 |
s := s asStringCollection. |
|
5909 |
(someText endsWith:Character cr) ifTrue:[ |
|
5910 |
"/ s := s copyWith:nil. |
|
5911 |
s := s copyWith:'' "/ an empty line at the end |
|
5912 |
||
5913 |
] |
|
5914 |
] ifFalse:[ |
|
5915 |
s isStringCollection ifTrue:[ |
|
5916 |
s := s encodeFrom:(s encoding) into:characterEncoding. |
|
5917 |
] ifFalse:[ |
|
5918 |
(self |
|
5919 |
confirm:(resources |
|
5920 |
stringWithCRs:'Selection (%1) is not convertable to Text.\\Paste storeString ?' |
|
5921 |
with:s class name)) ifFalse:[^ self]. |
|
5922 |
s := StringCollection with:s storeString . |
|
5923 |
"/ ^ self |
|
5924 |
]. |
|
5925 |
]. |
|
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
5926 |
]. |
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
5927 |
|
2853
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5928 |
(nLines := s size) == 0 ifTrue:[^ self]. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5929 |
(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
|
5930 |
|
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5931 |
typeOfSelection := #paste. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5932 |
|
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5933 |
startLine := l1 := cursorLine. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5934 |
startCol := c1 := cursorCol. |
3180 | 5935 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5936 |
"do not expand tabs in s here - |
3180 | 5937 |
they get expanded in basicWithoutRedrawInsertStringWithoutCRs:aString atLine:lineNr col:colNr. |
5938 |
Some Subviews want to paste with unexpanded tabs!!" |
|
5939 |
||
3825 | 5940 |
self insertLines:s withCR:withCR. |
2853
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5941 |
l2 := cursorLine. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5942 |
c2 := (cursorCol - 1). |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5943 |
self selectFromLine:l1 col:c1 toLine:l2 col:c2. |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5944 |
typeOfSelection := #paste. "/ sigh - cleared by #selectFromLine: |
f8c1d3963b49
preps for character conversions (paste)
Claus Gittinger <cg@exept.de>
parents:
2846
diff
changeset
|
5945 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
5946 |
"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
|
5947 |
"Modified: / 30.1.2000 / 02:32:42 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5948 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5949 |
|
3731 | 5950 |
pasteAsStringLiteral |
5951 |
"insert clipboard string as a string literal. |
|
5952 |
Almost the same as a normal paste, but single-quotes are doubled, |
|
5953 |
to make it a legal string literal" |
|
5954 |
||
5955 |
typeOfSelection := nil. |
|
5956 |
self |
|
3786 | 5957 |
undoableDo:[ self pasteOrReplace:(self getClipboardText storeString) ] |
5958 |
info:'Paste as String Literal' |
|
3731 | 5959 |
! |
5960 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5961 |
pasteOrReplace |
1289 | 5962 |
"paste the copybuffer; if there is a selection, replace it. |
3160 | 5963 |
otherwise paste at cursor position. |
5964 |
Replace is not done for selections which were created by a paste, |
|
2010 | 5965 |
to allow multiple paste operations in a row." |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5966 |
|
2724 | 5967 |
self withSelfAndTextForPasteDo:[:me :text | me pasteOrReplace:text] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5968 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5969 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5970 |
pasteOrReplace:someText |
1289 | 5971 |
"paste someText; if there is a selection, replace it. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5972 |
otherwise paste at cursor position. Replace is not done |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5973 |
for originating by a paste, to allow multiple |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5974 |
paste." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5975 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
5976 |
self checkModificationsAllowed ifFalse:[^ self]. |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
5977 |
|
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
5978 |
self undoableDo:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5979 |
((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
|
5980 |
self replace:someText |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5981 |
] ifFalse:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5982 |
self paste:someText. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5983 |
] |
3542 | 5984 |
] info:'Paste/Replace'. |
1289 | 5985 |
|
2107
9d44232af0a0
textSelection fixes (added newLine) for MSDOS;
Claus Gittinger <cg@exept.de>
parents:
2101
diff
changeset
|
5986 |
"Modified: / 30.1.2000 / 02:33:00 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5987 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
5988 |
|
3474
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5989 |
pasteOrReplaceFromHistory |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5990 |
"paste a previous item from the copybuffer history. |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5991 |
(i.e. repaste some previously deleted or copied text)" |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5992 |
|
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5993 |
|text| |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5994 |
|
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5995 |
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
|
5996 |
self flash. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
5997 |
^ self |
3474
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5998 |
]. |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
5999 |
text := self getTextSelectionFromHistory. |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6000 |
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
|
6001 |
self pasteOrReplace:text |
3474
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6002 |
] |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6003 |
! |
357e16440725
slight popupmenu reorganization
Claus Gittinger <cg@exept.de>
parents:
3473
diff
changeset
|
6004 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6005 |
replace |
1289 | 6006 |
"replace the selection by the contents of the copybuffer" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6007 |
|
3269
03d04670a5d2
replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
6008 |
self hasSelection ifFalse:[^ self]. |
03d04670a5d2
replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
6009 |
self checkModificationsAllowed ifFalse:[^ self]. |
03d04670a5d2
replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
6010 |
|
03d04670a5d2
replace is a no op, if there is no selection
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
6011 |
self withSelfAndTextForPasteDo:[:me :text | |
3786 | 6012 |
me undoableDo:[ me replace:text ] |
6013 |
info:'Replace' |
|
2952 | 6014 |
] |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6015 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6016 |
|
121 | 6017 |
replace:someText |
1289 | 6018 |
"replace the selection by someText" |
121 | 6019 |
|
3160 | 6020 |
|selected selectedString |
6021 |
selStartLine selStartCol selEndLine selEndCol| |
|
121 | 6022 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
6023 |
self checkModificationsAllowed ifFalse:[^ self]. |
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
6024 |
|
3130 | 6025 |
self undoableDo:[ |
4010 | 6026 |
selected := self selection. |
6027 |
selected isNil ifTrue:[ |
|
6028 |
^ self paste:someText |
|
6029 |
]. |
|
6030 |
||
6031 |
self deleteSelection. |
|
6032 |
||
6033 |
"take care, if we replace a selection without space by a word selected |
|
6034 |
with one - in this case we usually do not want the space. |
|
6035 |
But, if we replace a word-selected selection by something without a |
|
6036 |
space, we DO want the space added." |
|
6037 |
||
6038 |
selected size == 1 ifTrue:[ |
|
6039 |
selectedString := selected at:1. |
|
6040 |
]. |
|
6041 |
||
6042 |
someText size == 1 ifTrue:[ |
|
6043 |
|cutOffSpace addSpace replacement replacementString| |
|
6044 |
||
6045 |
cutOffSpace := false. |
|
6046 |
addSpace := false. |
|
6047 |
replacement := someText copyFrom:1. |
|
6048 |
||
6049 |
selectedString notNil ifTrue:[ |
|
6050 |
((selectedString startsWith:' ') or:[selectedString endsWith:' ']) ifFalse:[ |
|
6051 |
"selection has no space" |
|
6052 |
||
6053 |
((selectStyle == #wordleft) or:[selectStyle == #wordRight]) ifTrue:[ |
|
6054 |
cutOffSpace := true |
|
6055 |
] |
|
6056 |
] ifTrue:[ |
|
6057 |
addSpace := true |
|
6058 |
] |
|
6059 |
]. |
|
6060 |
replacementString := replacement at:1. |
|
6061 |
cutOffSpace ifTrue:[ |
|
6062 |
(replacementString startsWith:' ') ifTrue:[ |
|
6063 |
replacementString := replacementString withoutSpaces |
|
6064 |
]. |
|
6065 |
] ifFalse:[ |
|
6066 |
selectStyle == #wordLeft ifTrue:[ |
|
6067 |
"want a space at left" |
|
6068 |
(replacementString startsWith:' ') ifFalse:[ |
|
6069 |
replacementString := replacementString withoutSpaces. |
|
6070 |
replacementString := ' ' , replacementString |
|
6071 |
] |
|
6072 |
]. |
|
6073 |
selectStyle == #wordRight ifTrue:[ |
|
6074 |
"want a space at right" |
|
6075 |
||
6076 |
(replacementString endsWith:' ') ifFalse:[ |
|
6077 |
replacementString := replacementString withoutSpaces. |
|
6078 |
replacementString := replacementString , ' ' |
|
6079 |
] |
|
6080 |
]. |
|
6081 |
]. |
|
6082 |
replacement at:1 put: replacementString. |
|
6083 |
self paste:replacement. |
|
6084 |
] ifFalse:[ |
|
6085 |
self paste:someText |
|
6086 |
]. |
|
4053 | 6087 |
self setLastStringToReplace: selectedString. |
6088 |
||
4048 | 6089 |
lastReplacementInfo lastReplacement: someText. |
4010 | 6090 |
|
6091 |
selStartLine := selectionStartLine. |
|
6092 |
selStartCol := self selectionStartCol. |
|
6093 |
selEndLine := selectionEndLine. |
|
6094 |
selEndCol := self selectionEndCol. |
|
3130 | 6095 |
] |
3542 | 6096 |
info:'Replace' |
362
3993ba6c31a0
Expand tabs before pasting a string.
Stefan Vogel <sv@exept.de>
parents:
331
diff
changeset
|
6097 |
|
1480
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
6098 |
"Modified: / 14.2.1996 / 10:37:02 / stefan" |
eabb1848e2fa
fixed insert at character position.
Claus Gittinger <cg@exept.de>
parents:
1476
diff
changeset
|
6099 |
"Modified: / 5.4.1998 / 16:55:28 / cg" |
121 | 6100 |
! |
6101 |
||
3430 | 6102 |
searchReplace |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6103 |
"search for a string - show a box to enter searchpattern |
3430 | 6104 |
replace for the found searchpattern or replace all searchpattern found to a new pattern - show a box to enter replacepattern |
6105 |
- 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
|
6106 |
|
3430 | 6107 |
|searchBox patternHolder replacePatternHolder caseHolder flag ign initialString bindings bldr search modal replace action| |
6108 |
||
6109 |
modal := false "(UserPreferences current searchDialogIsModal)". |
|
6110 |
lastSearchDirection := #forward. |
|
6111 |
ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. |
|
6112 |
caseHolder := ign asValue. |
|
6113 |
patternHolder := '' asValue. |
|
6114 |
replacePatternHolder := '' asValue. |
|
6115 |
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
|
6116 |
initialString := lastSearchPattern |
3430 | 6117 |
]. |
6118 |
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
|
6119 |
initialString := self selectionAsString |
3430 | 6120 |
]. |
6121 |
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
|
6122 |
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
|
6123 |
initialString := LastSearchPatterns first |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6124 |
] |
3430 | 6125 |
]. |
6126 |
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
|
6127 |
patternHolder value:initialString. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6128 |
replacePatternHolder value:initialString. |
3430 | 6129 |
]. |
6130 |
flag := true. |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6131 |
search := [:fwd | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6132 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6133 |
search:patternHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6134 |
ignoreCase:caseHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6135 |
forward:fwd. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6136 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6137 |
replace := [:all | |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6138 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6139 |
replace:patternHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6140 |
by:replacePatternHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6141 |
all:all |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6142 |
ignoreCase:caseHolder value |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6143 |
]. |
3430 | 6144 |
bindings := IdentityDictionary new. |
6145 |
bindings at:#searchPattern put:patternHolder. |
|
6146 |
bindings at:#replacePattern put:replacePatternHolder. |
|
6147 |
modal ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6148 |
bindings at:#nextAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6149 |
put:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6150 |
flag := true. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6151 |
action := search. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6152 |
searchBox doAccept. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6153 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6154 |
bindings at:#prevAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6155 |
put:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6156 |
flag := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6157 |
action := search. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6158 |
searchBox doAccept. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6159 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6160 |
bindings at:#replaceAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6161 |
put:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6162 |
flag := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6163 |
action := replace. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6164 |
searchBox doAccept. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6165 |
]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6166 |
bindings at:#replaceAllAction |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6167 |
put:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6168 |
flag := true. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6169 |
action := replace. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6170 |
searchBox doAccept. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6171 |
]. |
3430 | 6172 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6173 |
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
|
6174 |
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
|
6175 |
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
|
6176 |
bindings at:#replaceAllAction put:[ replace value:true. ]. |
3430 | 6177 |
]. |
6178 |
bindings at:#ignoreCase put:caseHolder. |
|
6179 |
bindings at:#patternList put:LastSearchPatterns. |
|
6180 |
modal ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6181 |
searchBox := SimpleDialog new. |
3430 | 6182 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6183 |
searchBox := ApplicationModel new. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6184 |
searchBox createBuilder. |
3430 | 6185 |
]. |
6186 |
searchBox resources:(self resources). |
|
6187 |
bldr := searchBox builder. |
|
6188 |
bldr addBindings:bindings. |
|
6189 |
searchBox allButOpenFrom:(self class searchReplaceDialogSpec). |
|
6190 |
(bldr componentAt:#nextButton) cursor:(Cursor thumbsUp). |
|
6191 |
(bldr componentAt:#prevButton) cursor:(Cursor thumbsUp). |
|
6192 |
(bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown). |
|
6193 |
modal ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6194 |
searchBox openDialog. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6195 |
searchBox accepted ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6196 |
action value:flag |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6197 |
]. |
3430 | 6198 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6199 |
(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
|
6200 |
(bldr componentAt:#cancelButton) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6201 |
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
|
6202 |
action:[ searchBox closeRequest ]. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6203 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6204 |
"/ 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
|
6205 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6206 |
self topView beMaster. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6207 |
(searchBox window) |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6208 |
beSlave; |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6209 |
openInGroup:(self windowGroup). |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6210 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6211 |
"/ searchBox window open. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6212 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6213 |
searchBox window assignKeyboardFocusToFirstInputField. |
3430 | 6214 |
] |
6215 |
||
6216 |
"Modified: / 11-07-2006 / 11:20:06 / fm" |
|
6217 |
! |
|
6218 |
||
121 | 6219 |
showDeleted |
6220 |
"open a readonly editor on all deleted text" |
|
6221 |
||
6222 |
|v| |
|
6223 |
||
6224 |
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
|
6225 |
v readOnly:true. |
121 | 6226 |
v topView label:'deleted text'. |
2624
22d352e56c27
preps for special characters
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6227 |
! |
22d352e56c27
preps for special characters
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6228 |
|
3221 | 6229 |
sort:how ignoreCase:ignoreCase fromLine:start toLine:end |
6230 |
"sort the selected lines" |
|
6231 |
||
6232 |
|lines extractor fetcher lineWise nStr n s words| |
|
6233 |
||
6234 |
lineWise := true. |
|
6235 |
||
6236 |
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
|
6237 |
extractor := [:l | l withoutLeadingSeparators]. |
3221 | 6238 |
] 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
|
6239 |
extractor := [:l | ((l asCollectionOfWords select:[:w | w isEmpty or:[w first isLetterOrDigit]]) at:1 ifAbsent:'')]. |
3221 | 6240 |
] 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
|
6241 |
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
|
6242 |
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
|
6243 |
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
|
6244 |
|
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6245 |
extractor := [:l | ((l asCollectionOfWords) at:n ifAbsent:'')]. |
3221 | 6246 |
] 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
|
6247 |
lineWise := false. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6248 |
extractor := [:w | w]. |
3221 | 6249 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6250 |
self error:'unknown sort criteria: ', how printString. |
3221 | 6251 |
]]]]. |
6252 |
||
6253 |
ignoreCase ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6254 |
fetcher := [:l | (extractor value:l) asLowercase]. |
3221 | 6255 |
] ifFalse:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6256 |
fetcher := extractor. |
3221 | 6257 |
]. |
6258 |
||
6259 |
lineWise ifTrue:[ |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6260 |
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
|
6261 |
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
|
6262 |
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
|
6263 |
(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
|
6264 |
self textChanged. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6265 |
^ self. |
3221 | 6266 |
]. |
6267 |
||
6268 |
s := self selectionAsString. |
|
6269 |
words := s asCollectionOfWords. |
|
6270 |
words := words sort:[:w1 :w2 | (fetcher value:w1) < (fetcher value:w2)]. |
|
6271 |
s := words asStringCollection asStringWith:Character space. |
|
6272 |
self replace:s. |
|
6273 |
self textChanged. |
|
6274 |
! |
|
6275 |
||
6276 |
sortSelection:how ignoreCase:ignoreCase |
|
6277 |
"sort the selected lines" |
|
6278 |
||
6279 |
|start end| |
|
6280 |
||
6281 |
selectionStartLine isNil ifTrue:[^ self]. |
|
6282 |
||
6283 |
start := selectionStartLine. |
|
6284 |
end := selectionEndLine. |
|
6285 |
(selectionEndCol == 0) ifTrue:[ |
|
3786 | 6286 |
end := end - 1 |
3221 | 6287 |
]. |
6288 |
||
6289 |
self |
|
3786 | 6290 |
undoableDo:[ self sort:how ignoreCase:ignoreCase fromLine:start toLine:end ] |
6291 |
info:'Sort' |
|
3221 | 6292 |
! |
6293 |
||
2624
22d352e56c27
preps for special characters
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6294 |
specialCharacters |
2915 | 6295 |
CharacterSetView |
3160 | 6296 |
openAsInputFor:self |
6297 |
label:'Special Character Input' |
|
6298 |
clickLabel:'Click to Insert Character'. |
|
2866 | 6299 |
! |
6300 |
||
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
6301 |
undoablePaste:someText |
3495 | 6302 |
self undoablePaste:someText info:nil. |
6303 |
||
6304 |
"Modified: / 28-07-2007 / 13:25:46 / cg" |
|
6305 |
! |
|
6306 |
||
6307 |
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
|
6308 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6309 |
undoableDo:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6310 |
self paste:someText. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6311 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6312 |
info:infoOrNil |
3495 | 6313 |
|
6314 |
"Created: / 28-07-2007 / 13:25:30 / cg" |
|
6315 |
! |
|
6316 |
||
6317 |
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
|
6318 |
self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6319 |
undoableDo:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6320 |
self pasteOrReplace:someText. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6321 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6322 |
info:infoOrNil |
3495 | 6323 |
|
6324 |
"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
|
6325 |
! |
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
6326 |
|
4114
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6327 |
undoablePasteReplacingAll:someText info:infoOrNil |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6328 |
self |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6329 |
undoableDo:[ |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6330 |
self selectAll. |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6331 |
self pasteOrReplace:someText. |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6332 |
] |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6333 |
info:infoOrNil |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6334 |
|
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6335 |
"Created: / 28-07-2007 / 13:25:30 / cg" |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6336 |
! |
321416257cc5
added: #undoablePasteReplacingAll:info:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6337 |
|
2724 | 6338 |
withSelfAndTextForPasteDo:aBlock |
6339 |
"common code for paste/replace of the copybuffer" |
|
6340 |
||
6341 |
|sel| |
|
6342 |
||
6343 |
self checkModificationsAllowed ifFalse:[ |
|
3160 | 6344 |
self flash. |
6345 |
^ self |
|
2724 | 6346 |
]. |
6347 |
||
6348 |
sel := self getTextSelectionOrTextSelectionFromHistory. |
|
6349 |
sel notNil ifTrue:[ |
|
3160 | 6350 |
aBlock value:self value:sel. |
2724 | 6351 |
] |
105 | 6352 |
! ! |
6353 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6354 |
!EditTextView methodsFor:'private'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6355 |
|
3880 | 6356 |
beep |
6357 |
UserPreferences current beepInEditor ifTrue:[ |
|
6358 |
super beep |
|
6359 |
] |
|
6360 |
! |
|
6361 |
||
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
6362 |
checkModificationsAllowed |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
6363 |
"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
|
6364 |
evaluate the exceptionBlock if not. |
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
6365 |
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
|
6366 |
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
|
6367 |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
6368 |
self isReadOnly ifTrue: [ |
3160 | 6369 |
exceptionBlock isNil ifTrue:[ |
6370 |
^ false |
|
6371 |
]. |
|
6372 |
||
6373 |
(exceptionBlock value:'Text may not be modified') ~~ true ifTrue:[ |
|
6374 |
^ false |
|
6375 |
] |
|
331
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
6376 |
]. |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
6377 |
^ true |
1300
be8b356b2e59
first attempt in providing an ST80 (or vi)
Claus Gittinger <cg@exept.de>
parents:
1296
diff
changeset
|
6378 |
|
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
6379 |
"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
|
6380 |
! |
c58f0c52d2d7
made modifiedFlag a channels value (allows change notifications to be sent);
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
6381 |
|
2596 | 6382 |
currentSelectionBgColor |
6383 |
typeOfSelection == #paste ifTrue:[ |
|
3160 | 6384 |
^ DefaultAlternativeSelectionBackgroundColor ? selectionBgColor |
2596 | 6385 |
]. |
6386 |
^ super currentSelectionBgColor |
|
6387 |
||
6388 |
" |
|
6389 |
DefaultAlternativeSelectionBackgroundColor := Color yellow blendWith:Color green |
|
6390 |
" |
|
6391 |
! |
|
6392 |
||
6393 |
currentSelectionFgColor |
|
6394 |
typeOfSelection == #paste ifTrue:[ |
|
3160 | 6395 |
^ DefaultAlternativeSelectionForegroundColor ? selectionFgColor |
2596 | 6396 |
]. |
6397 |
^ super currentSelectionFgColor |
|
6398 |
! |
|
6399 |
||
3996 | 6400 |
resetVariablesBeforeNewSearch |
6401 |
||
6402 |
super resetVariablesBeforeNewSearch. |
|
6403 |
||
6404 |
"/ new search invalidates remembered string |
|
4048 | 6405 |
lastStringFromReplaceForNextSearch := nil. |
3996 | 6406 |
! |
6407 |
||
4053 | 6408 |
setLastStringToReplace: aString |
6409 |
||
6410 |
"This method will set the information coming from the last replace into the replacementInfo" |
|
6411 |
||
6412 |
|lastReplaceIgnoredCase| |
|
6413 |
||
4064 | 6414 |
"/ The searchAction is mantained until a cut/replace or a search with a user selection is done |
6415 |
self clearSearchAction. |
|
6416 |
||
4053 | 6417 |
lastReplacementInfo lastStringToReplace: aString. |
6418 |
lastStringFromReplaceForNextSearch := aString. |
|
6419 |
||
6420 |
"If the replace came after a search, the next replace will have the ignored case from that search action" |
|
4107 | 6421 |
lastReplaceIgnoredCase := (typeOfSelection == #search) |
6422 |
ifTrue: [lastSearchIgnoredCase] |
|
6423 |
ifFalse: [nil]. |
|
4053 | 6424 |
lastReplacementInfo lastReplaceIgnoredCase: lastReplaceIgnoredCase. |
6425 |
! |
|
6426 |
||
2647
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
6427 |
st80EditMode |
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
6428 |
^ st80Mode ? (UserPreferences current st80EditMode) |
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
6429 |
! |
23dca8f032c3
changed st80Mode from classVar to userPreferences value
Claus Gittinger <cg@exept.de>
parents:
2627
diff
changeset
|
6430 |
|
2225
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6431 |
suppressEmphasisInSelection |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6432 |
"selection is shown without emphasis" |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6433 |
|
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6434 |
^ true |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6435 |
! |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2213
diff
changeset
|
6436 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6437 |
textChanged |
522 | 6438 |
"my text was modified (internally). |
6439 |
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
|
6440 |
contentsChanged, which is triggered when the size has changed, and |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6441 |
is used to notify scrollers, other views etc.)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6442 |
|
641 | 6443 |
self contentsChanged. |
1015 | 6444 |
self modified:true. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6445 |
contentsWasSaved := false |
641 | 6446 |
|
1015 | 6447 |
"Modified: 14.2.1997 / 16:58:38 / cg" |
2207 | 6448 |
! |
6449 |
||
2617 | 6450 |
textChangedButNoSizeChange |
2207 | 6451 |
"my text was modified (internally). |
6452 |
Sent whenever text has been edited (not to confuse with |
|
6453 |
contentsChanged, which is triggered when the size has changed, and |
|
6454 |
is used to notify scrollers, other views etc.)" |
|
6455 |
||
6456 |
self modified:true. |
|
6457 |
contentsWasSaved := false |
|
6458 |
||
6459 |
"Modified: 14.2.1997 / 16:58:38 / cg" |
|
259
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 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6462 |
!EditTextView methodsFor:'queries'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6463 |
|
1526
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6464 |
currentLine |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6465 |
"the current line (for relative gotos)" |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6466 |
|
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6467 |
^ cursorLine |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6468 |
|
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6469 |
"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
|
6470 |
! |
7676f301bb8f
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
6471 |
|
4064 | 6472 |
hasSearchActionSelection |
6473 |
||
6474 |
^ typeOfSelection == #searchAction |
|
6475 |
! |
|
6476 |
||
1878 | 6477 |
isKeyboardConsumer |
6478 |
"return true, if the receiver is a keyboard consumer; |
|
6479 |
Return true here, redefined from SimpleView." |
|
6480 |
||
3476 | 6481 |
^ self isReadOnly not |
1878 | 6482 |
! |
6483 |
||
997 | 6484 |
specClass |
1390 | 6485 |
"redefined, since the name of my specClass is nonStandard (i.e. not EditTextSpec)" |
6486 |
||
997 | 6487 |
self class == EditTextView ifTrue:[^ TextEditorSpec]. |
1049 | 6488 |
^ super specClass |
6489 |
||
1390 | 6490 |
"Modified: / 31.10.1997 / 19:48:19 / cg" |
997 | 6491 |
! |
6492 |
||
324 | 6493 |
tabMeansNextField |
323
58102e6bc087
added tabMeansNextField instVar & method (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
6494 |
"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
|
6495 |
|
313
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
6496 |
"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
|
6497 |
|
1733
c5139b7402f0
use self isReadonly; readOnly may now be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
6498 |
^ self isReadOnly or:[tabMeansNextField] |
324 | 6499 |
|
6500 |
"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
|
6501 |
! |
7c799cd68343
only replace selection by return, if it was not created by a paste
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
6502 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6503 |
widthOfContents |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6504 |
"return the width of the contents in pixels |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6505 |
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
|
6506 |
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
|
6507 |
line (and possibly see the cursor behind the line)" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6508 |
|
697 | 6509 |
|w dev| |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6510 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6511 |
w := super widthOfContents. |
697 | 6512 |
(dev := device) isNil ifTrue:[ |
3160 | 6513 |
"/ really dont know ... |
6514 |
dev := Screen current |
|
606
682579fa3b62
fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
6515 |
]. |
697 | 6516 |
^ w + (font widthOn:dev) |
6517 |
||
6518 |
"Modified: 28.5.1996 / 19:32:25 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6519 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6520 |
|
1588 | 6521 |
!EditTextView methodsFor:'realization'! |
6522 |
||
6523 |
realize |
|
6524 |
"make the view visible - scroll to make the cursor visible." |
|
6525 |
||
6526 |
super realize. |
|
6527 |
||
6528 |
self makeCursorVisible. |
|
1993 | 6529 |
cursorFgColor := cursorFgColor onDevice:device. |
6530 |
cursorBgColor := cursorBgColor onDevice:device. |
|
1588 | 6531 |
|
6532 |
"Modified: 20.12.1996 / 14:16:05 / cg" |
|
6533 |
"Created: 24.7.1997 / 18:24:12 / cg" |
|
6534 |
! ! |
|
6535 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6536 |
!EditTextView methodsFor:'redrawing'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6537 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6538 |
redrawCursorIfBetweenVisibleLine:startVisLine and:endVisLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6539 |
"redraw the cursor, if it sits in a line range" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6540 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6541 |
cursorShown ifTrue:[ |
3160 | 6542 |
cursorVisibleLine notNil ifTrue:[ |
6543 |
(cursorVisibleLine between:startVisLine and:endVisLine) ifTrue:[ |
|
6544 |
self drawCursorCharacter |
|
6545 |
] |
|
6546 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6547 |
] |
105 | 6548 |
! |
6549 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6550 |
redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6551 |
"redraw the cursor, if it sits in visible line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6552 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6553 |
cursorShown ifTrue:[ |
3160 | 6554 |
(visLine == cursorVisibleLine) ifTrue:[ |
6555 |
self drawCursorCharacter |
|
6556 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6557 |
] |
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 |
redrawFromVisibleLine:startVisLine to:endVisLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6561 |
"redraw a visible line range" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6562 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6563 |
super redrawFromVisibleLine:startVisLine to:endVisLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6564 |
self redrawCursorIfBetweenVisibleLine:startVisLine and:endVisLine |
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 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6567 |
redrawVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6568 |
"redraw a visible line" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6569 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6570 |
super redrawVisibleLine:visLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6571 |
self redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6572 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6573 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6574 |
redrawVisibleLine:visLine col:colNr |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6575 |
"redraw the single character in visibleline at colNr" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6576 |
|
3510
4bd0b20bd05d
cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents:
3495
diff
changeset
|
6577 |
super redrawVisibleLine:visLine col:colNr. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6578 |
cursorShown ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6579 |
(visLine == cursorVisibleLine) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6580 |
(colNr == cursorCol) ifTrue:[ |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6581 |
self drawCursorCharacter. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6582 |
^ self |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6583 |
] |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
6584 |
] |
3510
4bd0b20bd05d
cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents:
3495
diff
changeset
|
6585 |
]. |
4bd0b20bd05d
cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents:
3495
diff
changeset
|
6586 |
|
4bd0b20bd05d
cursor-only redrawing, with vertical-insertion cursor
Claus Gittinger <cg@exept.de>
parents:
3495
diff
changeset
|
6587 |
"Modified: / 05-11-2007 / 17:35:53 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6588 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6589 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6590 |
redrawVisibleLine:visLine from:startCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6591 |
"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
|
6592 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6593 |
super redrawVisibleLine:visLine from:startCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6594 |
self redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6595 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6596 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6597 |
redrawVisibleLine:visLine from:startCol to:endCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6598 |
"redraw a visible line from startCol to endCol" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6599 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6600 |
super redrawVisibleLine:visLine from:startCol to:endCol. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6601 |
self redrawCursorIfInVisibleLine:visLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6602 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6603 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6604 |
!EditTextView methodsFor:'scrolling'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6605 |
|
2331
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6606 |
additionalMarginForHorizontalScroll |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6607 |
"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
|
6608 |
width of the document would allow. |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6609 |
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
|
6610 |
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
|
6611 |
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
|
6612 |
|
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6613 |
^ 10 max:font width |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6614 |
! |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2323
diff
changeset
|
6615 |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6616 |
halfPageDown |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6617 |
"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
|
6618 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6619 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6620 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6621 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6622 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6623 |
super halfPageDown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6624 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6625 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6626 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6627 |
halfPageUp |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6628 |
"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
|
6629 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6630 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6631 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6632 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6633 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6634 |
super halfPageUp. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6635 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6636 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6637 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6638 |
originChanged:delta |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6639 |
"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
|
6640 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6641 |
super originChanged:delta. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6642 |
" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6643 |
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
|
6644 |
" |
2422
aaef7f02402c
added cursorLine/Col holders;
Claus Gittinger <cg@exept.de>
parents:
2417
diff
changeset
|
6645 |
self updateCursorVisibleLine. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6646 |
prevCursorState ifTrue:[ |
3160 | 6647 |
self showCursor |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6648 |
] |
1577
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
6649 |
|
4e487247ad33
dont care for cursor when scrolling
Claus Gittinger <cg@exept.de>
parents:
1568
diff
changeset
|
6650 |
"Modified: / 17.6.1998 / 16:13:24 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6651 |
! |
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 |
originWillChange |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6654 |
"sent before scrolling - have to hide the cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6655 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6656 |
prevCursorState := cursorShown. |
1601 | 6657 |
"/ cursorShown := false. |
1591 | 6658 |
cursorShown ifTrue:[ |
3160 | 6659 |
self hideCursor |
1591 | 6660 |
] |
6661 |
||
1601 | 6662 |
"Modified: / 6.7.1998 / 13:07:23 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6663 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6664 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6665 |
pageDown |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6666 |
"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
|
6667 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6668 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6669 |
|prevCursorLine| |
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 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6672 |
super pageDown. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6673 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6674 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6675 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6676 |
pageUp |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6677 |
"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
|
6678 |
within the real text " |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6679 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6680 |
|prevCursorLine| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6681 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6682 |
prevCursorLine := cursorVisibleLine. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6683 |
super pageUp. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6684 |
self cursorVisibleLine:prevCursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6685 |
! ! |
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 |
!EditTextView methodsFor:'searching'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6688 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6689 |
searchBwd:pattern ifAbsent:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6690 |
"do a backward search" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6691 |
|
2822 | 6692 |
self searchBwd:pattern ignoreCase:false ifAbsent:aBlock |
1339 | 6693 |
! |
6694 |
||
6695 |
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
6696 |
"do a backward search" |
|
6697 |
||
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6698 |
|pos startLine startCol| |
1339 | 6699 |
|
6700 |
cursorLine isNil ifTrue:[^ self]. |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6701 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6702 |
pos := self startPositionForSearchBackward. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6703 |
startLine := pos y. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6704 |
startCol := pos x. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6705 |
|
3580 | 6706 |
self searchBwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock |
6707 |
||
6708 |
"Modified: 9.10.1997 / 13:02:13 / cg" |
|
6709 |
! |
|
6710 |
||
6711 |
searchBwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock |
|
6712 |
"do a backward search" |
|
6713 |
||
6714 |
cursorLine isNil ifTrue:[^ self]. |
|
6715 |
||
3160 | 6716 |
self |
4119 | 6717 |
searchBackwardFor:pattern |
6718 |
ignoreCase:ign |
|
6719 |
startingAtLine:startLine col:startCol |
|
6720 |
ifFound:[:line :col | |
|
6721 |
self cursorMovementAllowed ifTrue:[ |
|
6722 |
self cursorLine:line col:col. |
|
6723 |
]. |
|
6724 |
self showMatch:pattern isMatch:false atLine:line col:col. |
|
1339 | 6725 |
"/ self makeLineVisible:cursorLine |
4119 | 6726 |
typeOfSelection := #search] |
6727 |
ifAbsent:aBlock |
|
1339 | 6728 |
|
6729 |
"Modified: 9.10.1997 / 13:02:13 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6730 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6731 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6732 |
searchForAndSelectMatchingParenthesis |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6733 |
"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
|
6734 |
|
2554 | 6735 |
self searchForAndSelectMatchingParenthesisFromLine:cursorLine col:cursorCol |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6736 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6737 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6738 |
searchForMatchingParenthesis |
3160 | 6739 |
"search for a matching parenthesis starting at cursor position. |
6740 |
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
|
6741 |
backwards if its a closing parenthesis. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6742 |
Positions the cursor if found, peeps if not" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6743 |
|
2822 | 6744 |
self cursorMovementAllowed ifFalse:[^ self]. |
6745 |
||
3160 | 6746 |
self |
6747 |
searchForMatchingParenthesisFromLine:cursorLine col:cursorCol |
|
6748 |
ifFound:[:line :col | self cursorLine:line col:col] |
|
6749 |
ifNotFound:[self showNotFound] |
|
6750 |
onError:[self beep] |
|
1339 | 6751 |
|
6752 |
"Modified: 9.10.1997 / 12:56:30 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6753 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6754 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6755 |
searchFwd:pattern ifAbsent:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6756 |
"do a forward search" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6757 |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6758 |
|pos startLine startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6759 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6760 |
pos := self startPositionForSearchForward. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6761 |
startLine := pos y. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6762 |
startCol := pos x. |
1339 | 6763 |
|
3160 | 6764 |
self |
6765 |
searchFwd:pattern |
|
6766 |
startingAtLine:startLine col:startCol |
|
6767 |
ifAbsent:aBlock |
|
1339 | 6768 |
|
6769 |
"Modified: 9.10.1997 / 12:58:59 / cg" |
|
6770 |
! |
|
6771 |
||
6772 |
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
6773 |
"do a forward search" |
|
6774 |
||
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6775 |
|pos startLine startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6776 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6777 |
pos := self startPositionForSearchForward. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6778 |
startLine := pos y. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6779 |
startCol := pos x. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6780 |
|
3160 | 6781 |
self |
6782 |
searchFwd:pattern |
|
6783 |
ignoreCase:ign |
|
6784 |
startingAtLine:startLine col:startCol |
|
6785 |
ifAbsent:aBlock |
|
1339 | 6786 |
|
6787 |
"Modified: 9.10.1997 / 12:58:59 / cg" |
|
6788 |
"Created: 9.10.1997 / 13:04:10 / cg" |
|
6789 |
! |
|
6790 |
||
3967 | 6791 |
searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock |
1339 | 6792 |
"do a forward search" |
6793 |
||
6794 |
cursorLine isNil ifTrue:[^ self]. |
|
3967 | 6795 |
self |
6796 |
searchForwardFor:pattern |
|
6797 |
ignoreCase:ign |
|
6798 |
match: match |
|
6799 |
startingAtLine:startLine col:startCol |
|
6800 |
ifFound:[:line :col | |
|
6801 |
self cursorMovementAllowed ifTrue:[ |
|
6802 |
self cursorLine:line col:col. |
|
6803 |
]. |
|
4119 | 6804 |
self showMatch:pattern isMatch:match atLine:line col:col. |
1339 | 6805 |
"/ self makeLineVisible:cursorLine |
3967 | 6806 |
typeOfSelection := #search |
6807 |
] |
|
6808 |
ifAbsent:aBlock |
|
1339 | 6809 |
|
6810 |
"Modified: 9.10.1997 / 12:57:47 / cg" |
|
6811 |
"Created: 9.10.1997 / 13:01:12 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6812 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6813 |
|
3967 | 6814 |
searchFwd:pattern ignoreCase:ign startingAtLine:startLine col:startCol ifAbsent:aBlock |
6815 |
"do a forward search" |
|
6816 |
||
6817 |
self searchFwd:pattern ignoreCase:ign match: false startingAtLine:startLine col:startCol ifAbsent:aBlock |
|
6818 |
! |
|
6819 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6820 |
searchFwd:pattern startingAtLine:startLine col:startCol ifAbsent:aBlock |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6821 |
"do a forward search" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6822 |
|
2822 | 6823 |
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
|
6824 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6825 |
|
3982 | 6826 |
searchPatternForSearchBar |
6827 |
||
6828 |
"Returns the next searchPattern from the user selection or from the autoSearch" |
|
6829 |
||
6830 |
|searchPattern| |
|
6831 |
||
4138 | 6832 |
searchPattern := self searchPatternFromUserSelectionOrReplace. |
3982 | 6833 |
searchPattern isNil |
6834 |
ifTrue: [searchPattern := lastSearchPattern] |
|
6835 |
ifFalse: [lastSearchPattern := searchPattern]. |
|
6836 |
^ searchPattern |
|
6837 |
! |
|
6838 |
||
3578 | 6839 |
setSearchPatternWithMatchEscapes: match |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6840 |
"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
|
6841 |
cursor to start of pattern" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6842 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6843 |
|sel| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6844 |
|
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6845 |
"/ |
3967 | 6846 |
"/ 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
|
6847 |
"/ original string (for search after again) |
4121 | 6848 |
"/ for cut or delete actions allow lastReplacement with nil |
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6849 |
"/ |
4048 | 6850 |
(lastStringFromReplaceForNextSearch notNil |
4121 | 6851 |
and:[typeOfSelection ~~ #search]) ifTrue:[ |
4048 | 6852 |
lastStringFromReplaceForNextSearch isString ifTrue:[ |
6853 |
lastSearchPattern := lastStringFromReplaceForNextSearch. |
|
3967 | 6854 |
] ifFalse:[ |
4048 | 6855 |
lastSearchPattern := lastStringFromReplaceForNextSearch asStringWithoutFinalCR. |
3967 | 6856 |
]. |
6857 |
^ self |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6858 |
]. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6859 |
|
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6860 |
"/ |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6861 |
"/ if there is a selection: |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6862 |
"/ 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
|
6863 |
"/ if there was a previous search, only take the selection if |
3967 | 6864 |
"/ 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
|
6865 |
"/ (to allow search-paste to be repeated) |
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6866 |
"/ |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6867 |
sel := self selection. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6868 |
sel notNil ifTrue:[ |
3967 | 6869 |
(lastSearchPattern isNil |
6870 |
or:[typeOfSelection ~~ #paste |
|
6871 |
and:[typeOfSelection ~~ #search]]) ifTrue:[ |
|
6872 |
self cursorLine:selectionStartLine col:selectionStartCol. |
|
6873 |
lastSearchPattern := sel asStringWithoutFinalCR. |
|
6874 |
match ifTrue:[lastSearchPattern := lastSearchPattern withMatchEscapes]. |
|
6875 |
] |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6876 |
] |
559
3ff87e9447c6
keep searchPattern after a paste
Claus Gittinger <cg@exept.de>
parents:
522
diff
changeset
|
6877 |
|
565 | 6878 |
"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
|
6879 |
! |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6880 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6881 |
startPositionForSearchBackward |
2822 | 6882 |
^ self startPositionForSearchBackwardBasedOnCursorOrSelection |
6883 |
! |
|
6884 |
||
6885 |
startPositionForSearchBackwardBasedOnCursorOrSelection |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6886 |
|startLine startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6887 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6888 |
selectionStartLine notNil ifTrue:[ |
3160 | 6889 |
startLine := selectionStartLine. |
6890 |
startCol := selectionStartCol |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6891 |
] ifFalse:[ |
3160 | 6892 |
cursorLine isNil ifTrue:[ |
6893 |
startLine := list size. |
|
6894 |
startCol := self listAt:startLine size. |
|
6895 |
] ifFalse:[ |
|
6896 |
startLine := cursorLine min:list size. |
|
6897 |
startCol := cursorCol |
|
6898 |
] |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6899 |
]. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6900 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6901 |
^ startCol @ cursorLine |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6902 |
! |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6903 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6904 |
startPositionForSearchForward |
2822 | 6905 |
^ self startPositionForSearchForwardBasedOnCursorOrSelection |
6906 |
! |
|
6907 |
||
6908 |
startPositionForSearchForwardBasedOnCursorOrSelection |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6909 |
|startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6910 |
|
3160 | 6911 |
"/ 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
|
6912 |
"/ 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
|
6913 |
startCol := cursorCol. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6914 |
self hasSelection ifFalse:[ |
4064 | 6915 |
(cursorLine == 1 and:[cursorCol == 1]) ifTrue:[ |
6916 |
startCol := 0 |
|
6917 |
]. |
|
6918 |
startCol := startCol min:(self at:cursorLine) size |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6919 |
]. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6920 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2755
diff
changeset
|
6921 |
^ startCol @ cursorLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6922 |
! ! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6923 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6924 |
!EditTextView methodsFor:'selections'! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
6925 |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6926 |
addToSelectionAfter:aBlock |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6927 |
"Pokud existuje selekce, upravi ji |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6928 |
podle aktualni pozice kurzoru a pozice |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6929 |
po provedeni blocku. |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6930 |
Urceno k implementaci Shift-Home a Shift-End |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6931 |
Nejak nevim, jak to presneji popsat :-)" |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6932 |
|
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6933 |
|startLine startCol endLine endCol | |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6934 |
|
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6935 |
self hasSelection ifTrue: [ |
3160 | 6936 |
startLine := selectionStartLine . |
6937 |
startCol := selectionStartCol . |
|
6938 |
endLine := selectionEndLine . |
|
6939 |
endCol := selectionEndCol . |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6940 |
] ifFalse: [ |
3160 | 6941 |
startLine := endLine := cursorLine . |
6942 |
startCol := endCol := cursorCol . |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6943 |
]. |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6944 |
|
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6945 |
"deselectim a provedu presun kurzoru..." |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6946 |
self unselect . |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6947 |
aBlock value . |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6948 |
|
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6949 |
"funguje dost mizerne, jen na jednom radku..." |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6950 |
(startCol - cursorCol) abs <= (endCol - cursorCol) abs |
3160 | 6951 |
ifTrue: [ |
6952 |
startCol := cursorCol. |
|
6953 |
] ifFalse: [ |
|
6954 |
endCol := cursorCol - 1. |
|
6955 |
]. |
|
3023
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6956 |
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
|
6957 |
! |
9a6809da7351
shift BOL/shift EOL now selects;
Claus Gittinger <cg@exept.de>
parents:
3020
diff
changeset
|
6958 |
|
1850 | 6959 |
autoMoveCursorToEndOfSelection |
6960 |
"return true, if the cursor should be automatically moved to the |
|
6961 |
end of a selection. |
|
3963
c315f087d655
comment in: #autoMoveCursorToEndOfSelection
Claus Gittinger <cg@exept.de>
parents:
3945
diff
changeset
|
6962 |
Redefined to return false in terminalViews, where the cursor should |
1850 | 6963 |
not be affected by selecting" |
6964 |
||
6965 |
^ true |
|
6966 |
! |
|
6967 |
||
2606
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
6968 |
changeTypeOfSelectionTo:newType |
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
6969 |
typeOfSelection ~~ newType ifTrue:[ |
3160 | 6970 |
typeOfSelection := newType. |
6971 |
selectionStartLine notNil ifTrue:[ |
|
6972 |
self |
|
6973 |
redrawFromLine:selectionStartLine col:selectionStartCol |
|
6974 |
toLine:selectionEndLine col:selectionEndCol |
|
6975 |
]. |
|
2606
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
6976 |
]. |
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
6977 |
! |
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
6978 |
|
4138 | 6979 |
searchPatternFromUserSelectionOrReplace |
6980 |
||
6981 |
|sel searchPattern| |
|
6982 |
||
6983 |
"/ |
|
6984 |
"/ if the last operation was a replace, set pattern to last |
|
6985 |
"/ original string (for search after again) |
|
6986 |
"/ |
|
6987 |
(lastStringFromReplaceForNextSearch notNil |
|
6988 |
and:[typeOfSelection ~~ #search]) ifTrue:[ |
|
6989 |
lastStringFromReplaceForNextSearch isString ifTrue:[ |
|
6990 |
searchPattern := lastStringFromReplaceForNextSearch. |
|
6991 |
] ifFalse:[ |
|
6992 |
searchPattern := lastStringFromReplaceForNextSearch asStringWithoutFinalCR. |
|
6993 |
]. |
|
6994 |
^ searchPattern |
|
6995 |
]. |
|
6996 |
||
6997 |
"/ |
|
6998 |
"/ if there is a selection: |
|
6999 |
"/ if there was no previous search, take it as search pattern. |
|
7000 |
"/ if there was a previous search, only take the selection if |
|
7001 |
"/ it did not result from a paste. |
|
7002 |
"/ (to allow search-paste to be repeated) |
|
7003 |
"/ |
|
7004 |
sel := self selection. |
|
7005 |
sel notNil ifTrue:[ |
|
7006 |
typeOfSelection ~~ #search ifTrue:[ |
|
7007 |
typeOfSelection ~~ #paste ifTrue:[ |
|
7008 |
self cursorLine:selectionStartLine col:selectionStartCol. |
|
7009 |
searchPattern := sel asStringWithoutFinalCR. |
|
7010 |
] |
|
7011 |
]. |
|
7012 |
]. |
|
7013 |
||
7014 |
^ searchPattern |
|
7015 |
! |
|
7016 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7017 |
selectAll |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7018 |
"select the whole text. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7019 |
redefined to send super selectFrom... since we dont want the |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7020 |
cursor to be moved in this case." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7021 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7022 |
list isNil ifTrue:[ |
3160 | 7023 |
self unselect |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7024 |
] ifFalse:[ |
3160 | 7025 |
super selectFromLine:1 col:1 toLine:(list size + 1) col:0. |
7026 |
typeOfSelection := nil |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7027 |
] |
1082 | 7028 |
|
7029 |
"Modified: 28.2.1997 / 19:14:54 / cg" |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7030 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7031 |
|
4117 | 7032 |
selectAllInitially |
7033 |
"select the whole text. This is called only once during the initialization |
|
7034 |
for editFields which are shown in a table or tree. |
|
7035 |
The selectAll is called via this method to allow for easier redefinition and |
|
7036 |
to distinguish auto-select from user-initiated selects." |
|
7037 |
||
7038 |
self selectAll |
|
7039 |
! |
|
7040 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7041 |
selectCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7042 |
"select cursorline" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7043 |
|
3160 | 7044 |
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
|
7045 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7046 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7047 |
selectCursorLineFromBeginning |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7048 |
"select cursorline up to cursor position" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7049 |
|
823
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
7050 |
cursorCol > 1 ifTrue:[ |
3160 | 7051 |
self selectFromLine:cursorLine col:1 |
7052 |
toLine:cursorLine col:(cursorCol-1) |
|
823
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
7053 |
] |
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
7054 |
|
fc61564f7832
escape selects up to previous character
Claus Gittinger <cg@exept.de>
parents:
785
diff
changeset
|
7055 |
"Modified: 16.8.1996 / 19:14:14 / cg" |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7056 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7057 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7058 |
selectExpandCursorLine |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7059 |
"expand selection by one line or select cursorline" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7060 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7061 |
selectionStartLine isNil ifTrue:[ |
3160 | 7062 |
self selectCursorLine |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7063 |
] ifFalse:[ |
3160 | 7064 |
self selectFromLine:selectionStartLine col:selectionStartCol |
7065 |
toLine:cursorLine+1 col:0. |
|
7066 |
self makeLineVisible:selectionEndLine |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7067 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7068 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7069 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7070 |
selectFromBeginning |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7071 |
"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
|
7072 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7073 |
|col| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7074 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7075 |
list isNil ifTrue:[ |
3160 | 7076 |
self unselect |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7077 |
] ifFalse:[ |
3160 | 7078 |
cursorCol == 0 ifTrue:[ |
7079 |
col := 0 |
|
7080 |
] ifFalse:[ |
|
7081 |
col := cursorCol - 1 |
|
7082 |
]. |
|
7083 |
super selectFromLine:1 col:1 toLine:cursorLine col:col. |
|
7084 |
typeOfSelection := nil |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7085 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7086 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7087 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7088 |
selectFromLine:startLine col:startCol toLine:endLine col:endCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7089 |
"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
|
7090 |
for easier editing. Also typeOfSelection is nilled here." |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7091 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7092 |
super selectFromLine:startLine col:startCol toLine:endLine col:endCol. |
1850 | 7093 |
(selectionEndLine notNil and:[self autoMoveCursorToEndOfSelection]) ifTrue:[ |
3160 | 7094 |
self cursorLine:selectionEndLine col:(selectionEndCol + 1). |
1198 | 7095 |
]. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7096 |
typeOfSelection := nil |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7097 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7098 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7099 |
selectUpToEnd |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7100 |
"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
|
7101 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7102 |
list isNil ifTrue:[ |
3160 | 7103 |
self unselect |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7104 |
] ifFalse:[ |
3160 | 7105 |
super selectFromLine:cursorLine col:cursorCol toLine:(list size + 1) col:0. |
7106 |
typeOfSelection := nil |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7107 |
] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7108 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7109 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7110 |
selectWordUnderCursor |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7111 |
"select the word under the cursor" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7112 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7113 |
self selectWordAtLine:cursorLine col:cursorCol |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7114 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7115 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7116 |
unselect |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7117 |
"forget and unhilight selection - must take care of cursor here" |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7118 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7119 |
|wasOn| |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7120 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7121 |
wasOn := self hideCursor. |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7122 |
super unselect. |
2606
6a3ab90d339f
redraw selectionm, when its seelctionType changes
Claus Gittinger <cg@exept.de>
parents:
2599
diff
changeset
|
7123 |
typeOfSelection := nil. |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7124 |
wasOn ifTrue:[self showCursor] |
105 | 7125 |
! ! |
7126 |
||
7127 |
!EditTextView methodsFor:'undo & again'! |
|
7128 |
||
2952 | 7129 |
addUndo:action |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7130 |
^ undoSupport addUndo:action. |
2952 | 7131 |
! |
7132 |
||
105 | 7133 |
again |
7134 |
"repeat the last action (which was a cut or replace). |
|
7135 |
If current selection is not last string, search forward to |
|
3160 | 7136 |
next occurrence of it before repeating the last operation." |
105 | 7137 |
|
4048 | 7138 |
|s l c sel savedSelectStyle startColForSearch |
4051 | 7139 |
lastStringToReplace lastReplaceIgnoredCase lastReplaceWasMatch| |
4048 | 7140 |
|
7141 |
lastStringToReplace := lastReplacementInfo lastStringToReplace. |
|
4010 | 7142 |
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
|
7143 |
^ false |
2579
74d3798f4200
do not remove separators from replacement string
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
7144 |
]. |
4048 | 7145 |
lastReplaceIgnoredCase := lastReplacementInfo lastReplaceIgnoredCase. |
7146 |
lastReplaceWasMatch := lastReplacementInfo lastReplaceWasMatch. |
|
2579
74d3798f4200
do not remove separators from replacement string
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
7147 |
|
3127
29767bf8a215
better info of replace action (compound-undo-action has info, too)
Claus Gittinger <cg@exept.de>
parents:
3115
diff
changeset
|
7148 |
self undoableDo:[ |
4010 | 7149 |
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
|
7150 |
"remove final cr" |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7151 |
(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
|
7152 |
"/ s := s withoutSpaces. "XXX - replacing text with spaces ..." |
4010 | 7153 |
|
4053 | 7154 |
"set lastStringToReplace as the next search string |
7155 |
and set lastReplaceIgnoredCase as the next search ignored case flag" |
|
4048 | 7156 |
lastStringFromReplaceForNextSearch := s. |
4053 | 7157 |
lastSearchIgnoredCase := lastReplaceIgnoredCase. |
4010 | 7158 |
|
3816
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7159 |
savedSelectStyle := selectStyle. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7160 |
selectStyle := nil. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7161 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7162 |
sel := self selection. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7163 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7164 |
"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
|
7165 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7166 |
(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
|
7167 |
l := selectionStartLine "cursorLine". |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7168 |
c := selectionStartCol "cursorCol". |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7169 |
self deleteSelection. |
4051 | 7170 |
lastReplacementInfo lastReplacement notNil ifTrue:[ |
7171 |
self insertLines:lastReplacementInfo lastReplacement asStringCollection withCR:false. |
|
3816
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7172 |
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
|
7173 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7174 |
selectStyle := savedSelectStyle. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7175 |
^ true |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7176 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7177 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7178 |
sel isEmptyOrNil ifTrue:[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7179 |
startColForSearch := cursorCol - 1 |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7180 |
] ifFalse:[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7181 |
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
|
7182 |
]. |
4048 | 7183 |
self |
7184 |
searchForwardFor:s |
|
7185 |
ignoreCase: lastReplaceIgnoredCase |
|
7186 |
match: lastReplaceWasMatch |
|
7187 |
startingAtLine:cursorLine col:startColForSearch |
|
3816
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7188 |
ifFound: |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7189 |
[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7190 |
:line :col | |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7191 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7192 |
|repl| |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7193 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7194 |
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
|
7195 |
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
|
7196 |
self makeLineVisible:line. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7197 |
|
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7198 |
self deleteSelection. |
4051 | 7199 |
lastReplacementInfo lastReplacement notNil ifTrue:[ |
7200 |
lastReplacementInfo lastReplacement isString ifFalse:[ |
|
7201 |
repl := lastReplacementInfo lastReplacement asString "withoutSpaces" |
|
3816
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7202 |
] ifTrue:[ |
4051 | 7203 |
repl := lastReplacementInfo lastReplacement "withoutSpaces". |
3816
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7204 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7205 |
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
|
7206 |
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
|
7207 |
undoSupport actionInfo:'replace'. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7208 |
]. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7209 |
selectStyle := savedSelectStyle. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7210 |
^ true |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7211 |
] |
4048 | 7212 |
ifAbsent: |
3816
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7213 |
[ |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7214 |
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
|
7215 |
self showNotFound. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7216 |
selectStyle := savedSelectStyle. |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7217 |
^ false |
3915f7b67262
again, when the next replacement start immediately after the selection fixed
Claus Gittinger <cg@exept.de>
parents:
3813
diff
changeset
|
7218 |
]. |
3127
29767bf8a215
better info of replace action (compound-undo-action has info, too)
Claus Gittinger <cg@exept.de>
parents:
3115
diff
changeset
|
7219 |
]. |
2730
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
7220 |
|
61a2f1981ac6
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2725
diff
changeset
|
7221 |
^ true. |
501 | 7222 |
|
840
b0071cea13fd
fixed Again when spaces are replaced
Claus Gittinger <cg@exept.de>
parents:
828
diff
changeset
|
7223 |
"Modified: 9.10.1996 / 16:14:11 / cg" |
105 | 7224 |
! |
7225 |
||
2952 | 7226 |
hasRedoAction |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7227 |
^ undoSupport hasRedoAction. |
2952 | 7228 |
! |
7229 |
||
7230 |
hasUndoAction |
|
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7231 |
^ undoSupport hasUndoAction. |
2952 | 7232 |
! |
7233 |
||
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7234 |
multipleAgain |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7235 |
"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
|
7236 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7237 |
[self again] whileTrue:[] |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7238 |
! |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7239 |
|
2952 | 7240 |
nonUndoableDo:aBlock |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7241 |
undoSupport nonUndoableDo:aBlock. |
2952 | 7242 |
! |
7243 |
||
7244 |
redo |
|
3780 | 7245 |
"undo the last undo" |
7246 |
||
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7247 |
undoSupport hasRedoAction ifFalse:[ |
3780 | 7248 |
self beep |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7249 |
] ifTrue:[ |
3780 | 7250 |
undoSupport redo. |
2952 | 7251 |
] |
7252 |
! |
|
7253 |
||
121 | 7254 |
undo |
3780 | 7255 |
"undo the last edit operation" |
7256 |
||
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7257 |
undoSupport hasUndoAction ifFalse:[ |
3780 | 7258 |
self beep |
2989
5dcc2912bcb6
undo/redo extracted to separate component for better reuse
Claus Gittinger <cg@exept.de>
parents:
2984
diff
changeset
|
7259 |
] ifTrue:[ |
3780 | 7260 |
undoSupport undo. |
121 | 7261 |
] |
2952 | 7262 |
! |
7263 |
||
7264 |
undoableDo:aBlock |
|
3495 | 7265 |
self undoableDo:aBlock info:nil. |
7266 |
||
7267 |
"Modified: / 28-07-2007 / 13:20:14 / cg" |
|
3130 | 7268 |
! |
7269 |
||
7270 |
undoableDo:aBlock info:aString |
|
3154
42bf7ebd54c8
refadctored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
7271 |
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
|
7272 |
"/ 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
|
7273 |
aBlock value. |
3154
42bf7ebd54c8
refadctored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
7274 |
] ifTrue:[ |
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7275 |
undoSupport undoableDo:aBlock info:aString. |
3495 | 7276 |
]. |
7277 |
||
7278 |
"Modified: / 28-07-2007 / 13:21:00 / cg" |
|
2952 | 7279 |
! ! |
7280 |
||
7281 |
!EditTextView::EditAction class methodsFor:'instance creation'! |
|
7282 |
||
7283 |
line1:arg1 col1:arg2 line2:arg3 col2:arg4 |
|
7284 |
^ self new line1:arg1 col1:arg2 line2:arg3 col2:arg4 |
|
7285 |
! |
|
7286 |
||
3115 | 7287 |
line1:arg1 col1:arg2 line2:arg3 col2:arg4 info:info |
3160 | 7288 |
^ (self new line1:arg1 col1:arg2 line2:arg3 col2:arg4) info:info |
3115 | 7289 |
! |
7290 |
||
2952 | 7291 |
line:arg1 col:arg2 character:arg3 |
7292 |
^ self new line:arg1 col:arg2 character:arg3 |
|
7293 |
! |
|
7294 |
||
3115 | 7295 |
line:arg1 col:arg2 character:arg3 info:info |
3160 | 7296 |
^ (self new line:arg1 col:arg2 character:arg3) info:info |
3115 | 7297 |
! |
7298 |
||
3235 | 7299 |
line:arg1 col:arg2 characters:arg3 info:info |
7300 |
^ (self new line:arg1 col:arg2 characters:arg3) info:info |
|
7301 |
! |
|
7302 |
||
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7303 |
line:arg1 col:arg2 info:arg3 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7304 |
^ self new line:arg1 col:arg2 info:arg3 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7305 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7306 |
|
2952 | 7307 |
line:arg1 col:arg2 string:arg3 |
7308 |
^ self new line:arg1 col:arg2 string:arg3 |
|
3115 | 7309 |
! |
7310 |
||
7311 |
line:arg1 col:arg2 string:arg3 info:info |
|
7312 |
^ (self new line:arg1 col:arg2 string:arg3) info:info |
|
3130 | 7313 |
! |
7314 |
||
7315 |
line:arg1 string:arg3 info:info |
|
7316 |
^ (self new line:arg1 string:arg3) info:info |
|
3131 | 7317 |
! |
7318 |
||
7319 |
text:arg info:info |
|
7320 |
^ (self new text:arg) info:info |
|
3115 | 7321 |
! ! |
7322 |
||
7323 |
!EditTextView::EditAction methodsFor:'accessing'! |
|
7324 |
||
7325 |
info |
|
7326 |
^ userFriendlyInfo |
|
7327 |
! |
|
7328 |
||
7329 |
info:aString |
|
7330 |
userFriendlyInfo := aString |
|
2952 | 7331 |
! ! |
7332 |
||
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7333 |
!EditTextView::EditAction methodsFor:'combining'! |
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 |
canCombineWithPreviousPasteStringAction: aPasteStringAction |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7336 |
^ false. |
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:16:25 / 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 |
|
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7341 |
!EditTextView::EditAction methodsFor:'queries'! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7342 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7343 |
canCombineWithNext:nextAction |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7344 |
^ false |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7345 |
! ! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7346 |
|
2952 | 7347 |
!EditTextView::DeleteRange methodsFor:'accessing'! |
7348 |
||
3160 | 7349 |
line1:line1Arg col1:col1Arg line2:line2Arg col2:col2Arg |
2952 | 7350 |
"set instance variables (automatically generated)" |
7351 |
||
7352 |
self assert:(line1Arg notNil). |
|
7353 |
self assert:(col1Arg notNil). |
|
7354 |
self assert:(line2Arg notNil). |
|
7355 |
self assert:(col2Arg notNil). |
|
7356 |
||
7357 |
line1 := line1Arg. |
|
7358 |
col1 := col1Arg. |
|
7359 |
line2 := line2Arg. |
|
7360 |
col2 := col2Arg. |
|
7361 |
! ! |
|
7362 |
||
7363 |
!EditTextView::DeleteRange methodsFor:'execution'! |
|
7364 |
||
3160 | 7365 |
executeIn:editor |
2952 | 7366 |
editor unselect. |
3160 | 7367 |
editor |
7368 |
deleteFromLine:line1 |
|
7369 |
col:col1 |
|
7370 |
toLine:line2 |
|
7371 |
col:col2. |
|
2952 | 7372 |
editor cursorLine:line1 col:col1. |
7373 |
! ! |
|
7374 |
||
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7375 |
!EditTextView::DeleteCharacters methodsFor:'accessing'! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7376 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7377 |
col1 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7378 |
^ col1 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7379 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7380 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7381 |
col2 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7382 |
^ col2 |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7383 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7384 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7385 |
line |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7386 |
^ line |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7387 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7388 |
|
3160 | 7389 |
line:lineArg col1:col1Arg col2:col2Arg |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7390 |
"set instance variables (automatically generated)" |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7391 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7392 |
self assert:(lineArg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7393 |
self assert:(col1Arg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7394 |
self assert:(col2Arg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7395 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7396 |
line := lineArg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7397 |
col1 := col1Arg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7398 |
col2 := col2Arg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7399 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7400 |
|
3160 | 7401 |
line:lineArg col:colArg info:infoArg |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7402 |
self assert:(lineArg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7403 |
self assert:(colArg notNil). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7404 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7405 |
line := lineArg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7406 |
col1 := col2 := colArg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7407 |
self info:infoArg. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7408 |
! ! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7409 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7410 |
!EditTextView::DeleteCharacters methodsFor:'combining'! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7411 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7412 |
canCombineWithNext:anotherAction |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7413 |
^ anotherAction perform:#canCombineWithPreviousDeleteCharactersAction: with:self ifNotUnderstood:false |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7414 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7415 |
|
3160 | 7416 |
canCombineWithPreviousDeleteCharactersAction:previousDeleteAction |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7417 |
"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
|
7418 |
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
|
7419 |
(i.e. single-character typing)" |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7420 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7421 |
previousDeleteAction line == line ifTrue:[ |
3160 | 7422 |
previousDeleteAction col2 == (col1-1) ifTrue:[ |
7423 |
^ true |
|
7424 |
]. |
|
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7425 |
]. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7426 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7427 |
^ false |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7428 |
! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7429 |
|
3160 | 7430 |
combineWithNext:nextDeleteAction |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7431 |
self assert:(line == nextDeleteAction line). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7432 |
self assert:(col2 == (nextDeleteAction col1 - 1)). |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7433 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7434 |
col2 := nextDeleteAction col2. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7435 |
userFriendlyInfo := 'insert ' , (col2 - col1 + 1) printString |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7436 |
! ! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7437 |
|
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7438 |
!EditTextView::DeleteCharacters methodsFor:'execution'! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7439 |
|
3160 | 7440 |
executeIn:editor |
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7441 |
editor unselect. |
3160 | 7442 |
editor |
7443 |
deleteFromLine:line |
|
7444 |
col:col1 |
|
7445 |
toLine:line |
|
7446 |
col:col2. |
|
3156
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7447 |
editor cursorLine:line col:col1. |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7448 |
! ! |
25ef39958fd8
undo - combine multiple-single keystrokes
Claus Gittinger <cg@exept.de>
parents:
3154
diff
changeset
|
7449 |
|
3235 | 7450 |
!EditTextView::EditMode class methodsFor:'constants'! |
7451 |
||
7452 |
insertAndSelectMode |
|
7453 |
^ InsertAndSelectMode |
|
7454 |
! |
|
7455 |
||
7456 |
insertMode |
|
7457 |
^ InsertMode |
|
7458 |
! |
|
7459 |
||
7460 |
overwriteMode |
|
7461 |
^ OverwriteMode |
|
7462 |
! ! |
|
7463 |
||
7464 |
!EditTextView::EditMode class methodsFor:'queries'! |
|
7465 |
||
7466 |
isInsertAndSelectMode |
|
7467 |
^ false |
|
7468 |
! |
|
7469 |
||
7470 |
isInsertMode |
|
7471 |
^ false |
|
7472 |
! |
|
7473 |
||
7474 |
symbolicName |
|
7475 |
self subclassResponsibility |
|
7476 |
! ! |
|
7477 |
||
7478 |
!EditTextView::EditMode::InsertAndSelectMode class methodsFor:'info'! |
|
7479 |
||
7480 |
infoPrintString |
|
7481 |
^ 'IS' |
|
7482 |
! ! |
|
7483 |
||
7484 |
!EditTextView::EditMode::InsertAndSelectMode class methodsFor:'queries'! |
|
7485 |
||
7486 |
isInsertAndSelectMode |
|
7487 |
^ true |
|
7488 |
! |
|
7489 |
||
7490 |
isInsertMode |
|
7491 |
^ true |
|
7492 |
! ! |
|
7493 |
||
7494 |
!EditTextView::EditMode::InsertMode class methodsFor:'info'! |
|
7495 |
||
7496 |
infoPrintString |
|
7497 |
^ 'I' |
|
7498 |
! ! |
|
7499 |
||
7500 |
!EditTextView::EditMode::InsertMode class methodsFor:'queries'! |
|
7501 |
||
7502 |
isInsertMode |
|
7503 |
^ true |
|
7504 |
! ! |
|
7505 |
||
7506 |
!EditTextView::EditMode::OverwriteMode class methodsFor:'info'! |
|
7507 |
||
7508 |
infoPrintString |
|
7509 |
^ 'O' |
|
7510 |
! ! |
|
7511 |
||
4048 | 7512 |
!EditTextView::LastReplacementInfo methodsFor:'accessing'! |
7513 |
||
7514 |
lastReplaceIgnoredCase |
|
7515 |
^ lastReplaceIgnoredCase ? false |
|
7516 |
! |
|
7517 |
||
7518 |
lastReplaceIgnoredCase:something |
|
7519 |
lastReplaceIgnoredCase := something. |
|
7520 |
! |
|
7521 |
||
7522 |
lastReplaceWasMatch |
|
7523 |
^ lastReplaceWasMatch ? false |
|
7524 |
! |
|
7525 |
||
7526 |
lastReplaceWasMatch:something |
|
7527 |
lastReplaceWasMatch := something. |
|
7528 |
! |
|
7529 |
||
7530 |
lastReplacement |
|
7531 |
^ lastReplacement |
|
7532 |
! |
|
7533 |
||
7534 |
lastReplacement:something |
|
4053 | 7535 |
"/Transcript showCR: 'lastReplacement:', something printString. |
4048 | 7536 |
lastReplacement := something. |
7537 |
! |
|
7538 |
||
7539 |
lastStringToReplace |
|
7540 |
^ lastStringToReplace |
|
7541 |
! |
|
7542 |
||
7543 |
lastStringToReplace:something |
|
7544 |
lastStringToReplace := something. |
|
7545 |
! ! |
|
7546 |
||
2952 | 7547 |
!EditTextView::PasteString methodsFor:'accessing'! |
7548 |
||
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7549 |
col |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7550 |
^ col |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7551 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7552 |
"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
|
7553 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7554 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7555 |
col2 |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7556 |
^ col + string size - 1 |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7557 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7558 |
"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
|
7559 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7560 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7561 |
line |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7562 |
^ line |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7563 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7564 |
"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
|
7565 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7566 |
|
3160 | 7567 |
line:lineArg col:colArg string:stringArg |
2952 | 7568 |
self assert:(lineArg notNil). |
7569 |
self assert:(colArg notNil). |
|
7570 |
self assert:(stringArg notNil). |
|
7571 |
||
7572 |
line := lineArg. |
|
7573 |
col := colArg. |
|
7574 |
string := stringArg. |
|
7575 |
! |
|
7576 |
||
7577 |
line:lineArg col:colArg string:stringArg selected:selectedArg |
|
7578 |
self assert:(lineArg notNil). |
|
7579 |
self assert:(colArg notNil). |
|
7580 |
self assert:(stringArg notNil). |
|
7581 |
||
7582 |
line := lineArg. |
|
7583 |
col := colArg. |
|
7584 |
string := stringArg. |
|
7585 |
selected := selectedArg. |
|
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7586 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7587 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7588 |
string |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7589 |
^ string |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7590 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7591 |
"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
|
7592 |
! ! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7593 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7594 |
!EditTextView::PasteString methodsFor:'combining'! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7595 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7596 |
canCombineWithNext:anotherAction |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7597 |
^ anotherAction canCombineWithPreviousPasteStringAction:self |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7598 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7599 |
"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
|
7600 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7601 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7602 |
canCombineWithPreviousPasteStringAction: previousPasteAction |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7603 |
"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
|
7604 |
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
|
7605 |
(i.e. single-character deletes)" |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7606 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7607 |
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
|
7608 |
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
|
7609 |
^ true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7610 |
]. |
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7611 |
]. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7612 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7613 |
^ false |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7614 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7615 |
"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
|
7616 |
! |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7617 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7618 |
combineWithNext:nextPasteAction |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7619 |
|s1 s2| |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7620 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7621 |
self assert:(line == nextPasteAction line). |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7622 |
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
|
7623 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7624 |
s1 := nextPasteAction string. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7625 |
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
|
7626 |
s2 := string. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7627 |
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
|
7628 |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7629 |
string := s1, s2. |
3400
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7630 |
col := nextPasteAction col. |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7631 |
userFriendlyInfo := 'delete ' , string size printString |
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7632 |
|
c3fd4330f9ea
undo: join multiple delete-characters into a single undo
Claus Gittinger <cg@exept.de>
parents:
3326
diff
changeset
|
7633 |
"Created: / 25-09-2006 / 12:24:10 / cg" |
2952 | 7634 |
! ! |
7635 |
||
7636 |
!EditTextView::PasteString methodsFor:'execution'! |
|
7637 |
||
3160 | 7638 |
executeIn:editor |
2952 | 7639 |
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
|
7640 |
editor paste:string. |
2952 | 7641 |
selected ~~ true ifTrue:[ |
3160 | 7642 |
editor unselect |
2952 | 7643 |
]. |
7644 |
! ! |
|
7645 |
||
7646 |
!EditTextView::ReplaceCharacter methodsFor:'accessing'! |
|
7647 |
||
3235 | 7648 |
col |
7649 |
^ col |
|
7650 |
! |
|
7651 |
||
7652 |
col1 |
|
7653 |
^ col |
|
7654 |
! |
|
7655 |
||
7656 |
col2 |
|
7657 |
^ col |
|
7658 |
! |
|
7659 |
||
7660 |
line |
|
7661 |
^ line |
|
7662 |
! |
|
7663 |
||
3160 | 7664 |
line:lineArg col:colArg character:characterArg |
2952 | 7665 |
line := lineArg. |
7666 |
col := colArg. |
|
7667 |
character := characterArg. |
|
7668 |
! ! |
|
7669 |
||
7670 |
!EditTextView::ReplaceCharacter methodsFor:'execution'! |
|
7671 |
||
3160 | 7672 |
executeIn:editor |
7673 |
editor |
|
7674 |
replace:character |
|
7675 |
atLine:line |
|
7676 |
col:col. |
|
2952 | 7677 |
editor cursorLine:line col:col. |
105 | 7678 |
! ! |
7679 |
||
3235 | 7680 |
!EditTextView::ReplaceCharacters methodsFor:'accessing'! |
7681 |
||
7682 |
characters |
|
7683 |
^ characters |
|
7684 |
! |
|
7685 |
||
7686 |
col1 |
|
7687 |
^ col1 |
|
7688 |
! |
|
7689 |
||
7690 |
col2 |
|
7691 |
^ col2 |
|
7692 |
! |
|
7693 |
||
7694 |
line |
|
7695 |
^ line |
|
7696 |
! |
|
7697 |
||
7698 |
line:lineArg col:colArg character:characterArg |
|
7699 |
line := lineArg. |
|
7700 |
col1 := col2 := colArg. |
|
7701 |
characters := characterArg asString. |
|
7702 |
! |
|
7703 |
||
7704 |
line:lineArg col:colArg characters:charactersArg |
|
7705 |
line := lineArg. |
|
7706 |
col1 := colArg. |
|
7707 |
characters := charactersArg asString. |
|
7708 |
col2 := col1 + charactersArg size - 1 |
|
7709 |
! ! |
|
7710 |
||
7711 |
!EditTextView::ReplaceCharacters methodsFor:'combining'! |
|
7712 |
||
7713 |
canCombineWithNext:anotherAction |
|
7714 |
^ anotherAction perform:#canCombineWithPreviousReplaceCharactersAction: with:self ifNotUnderstood:false |
|
7715 |
! |
|
7716 |
||
7717 |
canCombineWithPreviousReplaceCharactersAction:previousReplaceAction |
|
7718 |
"I will combine only if we both are single character deletes, |
|
7719 |
and my col-to-delete is the next after anotherDeleteActions col-to-delete. |
|
7720 |
(i.e. single-character typing)" |
|
7721 |
||
7722 |
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
|
7723 |
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
|
7724 |
^ true |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7725 |
]. |
3235 | 7726 |
]. |
7727 |
||
7728 |
^ false |
|
7729 |
! |
|
7730 |
||
7731 |
combineWithNext:nextReplaceAction |
|
7732 |
self assert:(line == nextReplaceAction line). |
|
7733 |
self assert:(self col2 == (nextReplaceAction col1 - 1)). |
|
7734 |
||
7735 |
col2 := nextReplaceAction col2. |
|
7736 |
userFriendlyInfo := 'replace ' , (col2 - col1 + 1) printString. |
|
7737 |
characters := characters , nextReplaceAction characters. |
|
7738 |
! ! |
|
7739 |
||
7740 |
!EditTextView::ReplaceCharacters methodsFor:'execution'! |
|
7741 |
||
7742 |
executeIn:editor |
|
7743 |
editor |
|
3683
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7744 |
replaceString:characters |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7745 |
atLine:line |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7746 |
col:col1. |
3235 | 7747 |
editor cursorLine:line col:col1. |
7748 |
! ! |
|
7749 |
||
3131 | 7750 |
!EditTextView::ReplaceContents methodsFor:'accessing'! |
7751 |
||
7752 |
text:something |
|
7753 |
text := something. |
|
7754 |
! ! |
|
7755 |
||
7756 |
!EditTextView::ReplaceContents methodsFor:'execution'! |
|
7757 |
||
3160 | 7758 |
executeIn:editor |
3131 | 7759 |
editor contents:text |
7760 |
! ! |
|
7761 |
||
3130 | 7762 |
!EditTextView::ReplaceLine methodsFor:'accessing'! |
7763 |
||
3160 | 7764 |
line:lineArg string:stringArg |
3130 | 7765 |
line := lineArg. |
7766 |
text := stringArg. |
|
7767 |
! ! |
|
7768 |
||
7769 |
!EditTextView::ReplaceLine methodsFor:'execution'! |
|
7770 |
||
3160 | 7771 |
executeIn:editor |
3130 | 7772 |
editor list at:line put:text. |
7773 |
editor invalidateLine:line |
|
7774 |
! ! |
|
7775 |
||
3402 | 7776 |
!EditTextView::ReplaceLines methodsFor:'accessing'! |
7777 |
||
7778 |
line:lineArg lines:lineCollectionArg |
|
7779 |
line := lineArg. |
|
7780 |
text := lineCollectionArg. |
|
7781 |
||
7782 |
"Created: / 09-10-2006 / 10:35:22 / cg" |
|
7783 |
! ! |
|
7784 |
||
7785 |
!EditTextView::ReplaceLines methodsFor:'execution'! |
|
7786 |
||
7787 |
executeIn:editor |
|
7788 |
|lnr| |
|
7789 |
||
7790 |
lnr := line. |
|
7791 |
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
|
7792 |
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
|
7793 |
editor invalidateLine:lnr. |
5891af82a177
middleButtonMenu and keyCommands no longer held in instvars but in moreAttributes.
Claus Gittinger <cg@exept.de>
parents:
3650
diff
changeset
|
7794 |
lnr := lnr + 1. |
3402 | 7795 |
]. |
7796 |
||
7797 |
"Modified: / 09-10-2006 / 10:39:16 / cg" |
|
7798 |
! ! |
|
7799 |
||
865 | 7800 |
!EditTextView class methodsFor:'documentation'! |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7801 |
|
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
214
diff
changeset
|
7802 |
version |
4242 | 7803 |
^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.504 2011-04-18 19:35:58 cg Exp $' |
3945 | 7804 |
! |
7805 |
||
7806 |
version_CVS |
|
4242 | 7807 |
^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.504 2011-04-18 19:35:58 cg Exp $' |
0 | 7808 |
! ! |