author | Claus Gittinger <cg@exept.de> |
Mon, 17 Sep 2018 16:09:24 +0200 | |
changeset 1573 | 1ca3df2d6317 |
parent 1451 | 319f45ae429a |
permissions | -rw-r--r-- |
718 | 1 |
"* |
2 |
* Encoding: iso8859-1 |
|
3 |
* |
|
4 |
* $Header$ |
|
5 |
* |
|
6 |
* MIMEType: application/x-smalltalk-source |
|
7 |
* |
|
8 |
* sample keyboardMacros.rc - file |
|
9 |
* |
|
10 |
* this file defines some keyboard macros |
|
11 |
* Feel free to add your own. |
|
12 |
* Here, only the macro-codes are defined; |
|
13 |
* the actual binding of macro to a particular key is done in keyboard.rc. |
|
14 |
* |
|
15 |
* these are my personal preferrences which may not be |
|
16 |
* correct for your environment. |
|
17 |
* |
|
18 |
* WARNING: |
|
19 |
* please keep the expressions below free from manipulating |
|
20 |
* global state. |
|
21 |
* Reason: in multihead applications, this will be consulted for each |
|
22 |
* new display screen. |
|
23 |
*" |
|
1243
1fc6b3f01e48
End chung after initial comment / encoding spec
Stefan Vogel <sv@exept.de>
parents:
1086
diff
changeset
|
24 |
! |
718 | 25 |
|macros| |
26 |
||
27 |
macros := UserPreferences current functionKeySequences. |
|
28 |
||
29 |
"/ |
|
30 |
"/ macro to replace a text selection by unix commands output |
|
31 |
"/ |
|
32 |
macros at:#ReplaceSelectionByUnixCommandsOutput put:' |
|
33 |
"replace selection by corresponding |
|
34 |
unix commands output" |
|
35 |
||
36 |
|sel| |
|
37 |
||
38 |
sel := self selection. |
|
39 |
sel notNil ifTrue:[ |
|
40 |
self replace: |
|
41 |
(PipeStream readingFrom:(sel asString)) |
|
42 |
contents asString |
|
43 |
] |
|
44 |
'. |
|
45 |
||
46 |
"/ |
|
47 |
"/ macro to paste the text generated by a block |
|
48 |
"/ |
|
49 |
"/macros at:#PasteBlockEvaluationsOutput put:' |
|
50 |
"/ "replace selection by blocks output" |
|
51 |
"/ |
|
52 |
"/ |sel s block| |
|
53 |
"/ |
|
54 |
"/ sel := self selectionAsString. |
|
55 |
"/ sel notNil ifTrue:[ |
|
56 |
"/ block := Compiler evaluate:sel asString string. |
|
57 |
"/ s := '''' writeStream. |
|
58 |
"/ block value:s. |
|
59 |
"/ self paste:s contents asString |
|
60 |
"/ ] |
|
61 |
"/'. |
|
62 |
||
63 |
"/ |
|
64 |
"/ macro to toggle tabs |
|
65 |
"/ |
|
1438 | 66 |
"/ no longer needed - there is a function for that, which we can call... |
67 |
macros at:#ToggleTabs put:'self toggleTabSetting'. |
|
68 |
"/macros at:#ToggleTabs put:' |
|
69 |
"/ "toggle between 4-col |
|
70 |
"/ and 8-col tabs" |
|
71 |
"/ |
|
72 |
"/ (tabPositions == self class tab4Positions) |
|
73 |
"/ ifTrue:[self setTab8] |
|
74 |
"/ ifFalse:[self setTab4] |
|
75 |
"/'. |
|
718 | 76 |
|
77 |
"/ |
|
78 |
"/ macro to indent by 4 |
|
79 |
"/ |
|
80 |
||
1438 | 81 |
"/ no longer needed - there is a function for that, which we can call... |
82 |
macros at:#IndentBy4 put:'self indentBy:4'. |
|
83 |
"/macros at:#IndentBy4 put:' |
|
84 |
"/ "indent selected line-range |
|
85 |
"/ by 4 spaces (i.e. to the right)" |
|
86 |
"/ |
|
87 |
"/ |line1 line2| |
|
88 |
"/ |
|
89 |
"/ line1 := self selectionStartLine. |
|
90 |
"/ line2 := self selectionEndLine. |
|
91 |
"/ line1 isNil ifTrue:[ |
|
92 |
"/ line1 := self perform:#cursorLine ifNotUnderstood:nil. |
|
93 |
"/ line1 notNil ifTrue:[ |
|
94 |
"/ line2 := line1+1 |
|
95 |
"/ ] |
|
96 |
"/ ]. |
|
97 |
"/ line1 notNil ifTrue:[ |
|
98 |
"/ self withExecuteCursorDo:[ |
|
99 |
"/ line1 to:line2-1 do:[:lineNr | |
|
100 |
"/ |line| |
|
101 |
"/ |
|
102 |
"/ line := self listAt:lineNr. |
|
103 |
"/ line notNil ifTrue:[ |
|
104 |
"/ line notEmpty ifTrue:[ |
|
105 |
"/ line := '' '' , line. |
|
106 |
"/ self withoutRedrawAt:lineNr put:line. |
|
107 |
"/ line1 = (line2-1) ifTrue:[ |
|
108 |
"/ self cursorRight:4 |
|
109 |
"/ ]. |
|
110 |
"/ ] |
|
111 |
"/ ] |
|
112 |
"/ ]. |
|
113 |
"/ self textChanged. |
|
114 |
"/ line1 to:line2-1 do:[:lineNr | |
|
115 |
"/ self invalidateLine:lineNr. |
|
116 |
"/ ]. |
|
117 |
"/ ]. |
|
118 |
"/ ] |
|
119 |
"/'. |
|
718 | 120 |
|
121 |
"/ |
|
122 |
"/ macro to undent by 4 |
|
123 |
"/ |
|
1438 | 124 |
"/ no longer needed - there is a function for that, which we can call... |
125 |
macros at:#UndentBy4 put:'self undentBy:4'. |
|
126 |
"/macros at:#UndentBy4 put:' |
|
127 |
"/ "undent selected line-range |
|
128 |
"/ by 4 spaces (i.e. to the left)" |
|
129 |
"/ |
|
130 |
"/ |line1 line2| |
|
131 |
"/ |
|
132 |
"/ line1 := self selectionStartLine. |
|
133 |
"/ line2 := self selectionEndLine. |
|
134 |
"/ line1 isNil ifTrue:[ |
|
135 |
"/ line1 := self perform:#cursorLine ifNotUnderstood:nil. |
|
136 |
"/ line1 notNil ifTrue:[ |
|
137 |
"/ line2 := line1+1 |
|
138 |
"/ ] |
|
139 |
"/ ]. |
|
140 |
"/ line1 notNil ifTrue:[ |
|
141 |
"/ self withExecuteCursorDo:[ |
|
142 |
"/ line1 to:line2-1 do:[:lineNr | |
|
143 |
"/ |line| |
|
144 |
"/ |
|
145 |
"/ line := self listAt:lineNr. |
|
146 |
"/ line notNil ifTrue:[ |
|
147 |
"/ line notEmpty ifTrue:[ |
|
148 |
"/ (line startsWith:'' '') ifTrue:[ |
|
149 |
"/ line := line copyFrom:5. |
|
150 |
"/ self withoutRedrawAt:lineNr put:line. |
|
151 |
"/ line1 = (line2-1) ifTrue:[ |
|
152 |
"/ cursorCol > 4 ifTrue:[ self cursorLeft:4 ] |
|
153 |
"/ ]. |
|
154 |
"/ ] |
|
155 |
"/ ] |
|
156 |
"/ ] |
|
157 |
"/ ]. |
|
158 |
"/ self textChanged. |
|
159 |
"/ line1 to:line2-1 do:[:lineNr | |
|
160 |
"/ self invalidateLine:lineNr. |
|
161 |
"/ ]. |
|
162 |
"/ ]. |
|
163 |
"/ ] |
|
164 |
"/'. |
|
718 | 165 |
|
166 |
"/ |
|
167 |
"/ macro to indent by 1 |
|
168 |
"/ |
|
1438 | 169 |
"/ no longer needed - there is a function for that, which we can call... |
170 |
macros at:#IndentBy1 put:'self indentBy:1'. |
|
171 |
"/macros at:#IndentBy1 put:' |
|
172 |
"/ "indent selected line-range |
|
173 |
"/ by 1 space (i.e. to the right)" |
|
174 |
"/ |
|
175 |
"/ |line1 line2| |
|
176 |
"/ |
|
177 |
"/ line1 := self selectionStartLine. |
|
178 |
"/ line2 := self selectionEndLine. |
|
179 |
"/ line1 isNil ifTrue:[ |
|
180 |
"/ line1 := self perform:#cursorLine ifNotUnderstood:nil. |
|
181 |
"/ line1 notNil ifTrue:[ |
|
182 |
"/ line2 := line1+1 |
|
183 |
"/ ] |
|
184 |
"/ ]. |
|
185 |
"/ line1 notNil ifTrue:[ |
|
186 |
"/ self withExecuteCursorDo:[ |
|
187 |
"/ line1 to:line2-1 do:[:lineNr | |
|
188 |
"/ |line| |
|
189 |
"/ |
|
190 |
"/ line := self listAt:lineNr. |
|
191 |
"/ line notNil ifTrue:[ |
|
192 |
"/ line notEmpty ifTrue:[ |
|
193 |
"/ line := '' '' , line. |
|
194 |
"/ self withoutRedrawAt:lineNr put:line. |
|
195 |
"/ line1 = (line2-1) ifTrue:[ |
|
196 |
"/ self cursorRight:1 |
|
197 |
"/ ]. |
|
198 |
"/ ] |
|
199 |
"/ ] |
|
200 |
"/ ]. |
|
201 |
"/ self textChanged. |
|
202 |
"/ line1 to:line2-1 do:[:lineNr | |
|
203 |
"/ self invalidateLine:lineNr. |
|
204 |
"/ ]. |
|
205 |
"/ ] |
|
206 |
"/ ] |
|
207 |
"/'. |
|
718 | 208 |
|
209 |
"/ |
|
210 |
"/ macro to undent by 1 |
|
211 |
"/ |
|
1438 | 212 |
"/ no longer needed - there is a function for that, which we can call... |
213 |
macros at:#UndentBy1 put:'self undentBy:1'. |
|
214 |
"/macros at:#UndentBy1 put:' |
|
215 |
"/ "undent selected line-range |
|
216 |
"/ by 1 space (i.e. to the left)" |
|
217 |
"/ |
|
218 |
"/ |line1 line2| |
|
219 |
"/ |
|
220 |
"/ line1 := self selectionStartLine. |
|
221 |
"/ line2 := self selectionEndLine. |
|
222 |
"/ line1 isNil ifTrue:[ |
|
223 |
"/ line1 := self perform:#cursorLine ifNotUnderstood:nil. |
|
224 |
"/ line1 notNil ifTrue:[ |
|
225 |
"/ line2 := line1+1 |
|
226 |
"/ ] |
|
227 |
"/ ]. |
|
228 |
"/ line1 notNil ifTrue:[ |
|
229 |
"/ self withExecuteCursorDo:[ |
|
230 |
"/ line1 to:line2-1 do:[:lineNr | |
|
231 |
"/ |line| |
|
232 |
"/ |
|
233 |
"/ line := self listAt:lineNr. |
|
234 |
"/ line notNil ifTrue:[ |
|
235 |
"/ line notEmpty ifTrue:[ |
|
236 |
"/ (line startsWith:'' '') ifTrue:[ |
|
237 |
"/ line := line copyFrom:2. |
|
238 |
"/ self withoutRedrawAt:lineNr put:line. |
|
239 |
"/ line1 = (line2-1) ifTrue:[ |
|
240 |
"/ cursorCol > 1 ifTrue:[ self cursorLeft:1 ] |
|
241 |
"/ ]. |
|
242 |
"/ ] |
|
243 |
"/ ] |
|
244 |
"/ ] |
|
245 |
"/ ]. |
|
246 |
"/ self textChanged. |
|
247 |
"/ line1 to:line2-1 do:[:lineNr | |
|
248 |
"/ self invalidateLine:lineNr. |
|
249 |
"/ ]. |
|
250 |
"/ ]. |
|
251 |
"/ ] |
|
252 |
"/'. |
|
718 | 253 |
|
254 |
"/ |
|
255 |
"/ macro to convert selection to lowercase |
|
256 |
"/ |
|
1438 | 257 |
"/ no longer needed - there is a function for that, which we can call... |
258 |
macros at:#ConvertSelectionToLowercase put:'self convertSelectionToLowercase'. |
|
259 |
"/macros at:#ConvertSelectionToLowercase put:' |
|
260 |
"/ "to-lower selected text" |
|
261 |
"/ |
|
262 |
"/ |line1 line2| |
|
263 |
"/ |
|
264 |
"/ line1 := self selectionStartLine. |
|
265 |
"/ line2 := self selectionEndLine. |
|
266 |
"/ line1 isNil ifTrue:[ |
|
267 |
"/ line1 := self perform:#cursorLine ifNotUnderstood:nil. |
|
268 |
"/ line1 notNil ifTrue:[ |
|
269 |
"/ line2 := line1 |
|
270 |
"/ ] |
|
271 |
"/ ]. |
|
272 |
"/ line1 notNil ifTrue:[ |
|
273 |
"/ line1 to:line2 do:[:lineNr | |
|
274 |
"/ |line col1 col2| |
|
275 |
"/ |
|
276 |
"/ line := (self listAt:lineNr) copy. |
|
277 |
"/ line size > 0 ifTrue:[ |
|
278 |
"/ lineNr == line1 ifTrue:[ |
|
279 |
"/ col1 := selectionStartCol. |
|
280 |
"/ ] ifFalse:[ |
|
281 |
"/ col1 := 1. |
|
282 |
"/ ]. |
|
283 |
"/ lineNr == line2 ifTrue:[ |
|
284 |
"/ col2 := selectionEndCol. |
|
285 |
"/ ] ifFalse:[ |
|
286 |
"/ col2 := (self listAt:lineNr) size. |
|
287 |
"/ ]. |
|
288 |
"/ |
|
289 |
"/ col1 to:col2 do:[:col | |
|
290 |
"/ |ch| |
|
291 |
"/ |
|
292 |
"/ ch := line at:col. |
|
293 |
"/ line at:col put:ch asLowercase. |
|
294 |
"/ ]. |
|
295 |
"/ self withoutRedrawAt:lineNr put:line. |
|
296 |
"/ self invalidateLine:lineNr. |
|
297 |
"/ ]. |
|
298 |
"/ ]. |
|
299 |
"/ ] |
|
300 |
"/'. |
|
718 | 301 |
|
302 |
"/ |
|
303 |
"/ macro to convert selection to uppercaseFirst words |
|
304 |
"/ |
|
1438 | 305 |
"/ no longer needed - there is a function for that, which we can call... |
306 |
macros at:#ConvertSelectionToUppercaseFirst put:'self convertSelectionToUppercaseFirst'. |
|
307 |
"/macros at:#ConvertSelectionToUppercaseFirst put:' |
|
308 |
"/ "to-upperFirst selected text" |
|
309 |
"/ |
|
310 |
"/ |line1 line2| |
|
311 |
"/ |
|
312 |
"/ line1 := self selectionStartLine. |
|
313 |
"/ line2 := self selectionEndLine. |
|
314 |
"/ line1 isNil ifTrue:[ |
|
315 |
"/ line1 := self perform:#cursorLine ifNotUnderstood:nil. |
|
316 |
"/ line1 notNil ifTrue:[ |
|
317 |
"/ line2 := line1 |
|
318 |
"/ ] |
|
319 |
"/ ]. |
|
320 |
"/ line1 notNil ifTrue:[ |
|
321 |
"/ line1 to:line2 do:[:lineNr | |
|
322 |
"/ |line col1 col2 state| |
|
323 |
"/ |
|
324 |
"/ line := (self listAt:lineNr) copy. |
|
325 |
"/ line size > 0 ifTrue:[ |
|
326 |
"/ lineNr == line1 ifTrue:[ |
|
327 |
"/ col1 := selectionStartCol. |
|
328 |
"/ ] ifFalse:[ |
|
329 |
"/ col1 := 1. |
|
330 |
"/ ]. |
|
331 |
"/ lineNr == line2 ifTrue:[ |
|
332 |
"/ col2 := selectionEndCol. |
|
333 |
"/ ] ifFalse:[ |
|
334 |
"/ col2 := (self listAt:lineNr) size. |
|
335 |
"/ ]. |
|
336 |
"/ |
|
337 |
"/ state := #first. |
|
338 |
"/ col1 to:col2 do:[:col | |
|
339 |
"/ |ch| |
|
340 |
"/ |
|
341 |
"/ ch := line at:col. |
|
342 |
"/ ch isSeparator ifFalse:[ |
|
343 |
"/ state == #first ifTrue:[ |
|
344 |
"/ line at:col put:ch asUppercase. |
|
345 |
"/ state := #skipRest |
|
346 |
"/ ] |
|
347 |
"/ ] ifTrue:[ |
|
348 |
"/ state := #first |
|
349 |
"/ ] |
|
350 |
"/ ]. |
|
351 |
"/ self withoutRedrawAt:lineNr put:line. |
|
352 |
"/ self invalidateLine:lineNr. |
|
353 |
"/ ]. |
|
354 |
"/ ]. |
|
355 |
"/ ] |
|
356 |
"/'. |
|
718 | 357 |
|
1438 | 358 |
"/ no longer needed - there is a function for that, which we can call... |
359 |
macros at:#ConvertSelectionToUppercase put:'self convertSelectionToUppercase'. |
|
360 |
"/macros at:#ConvertSelectionToUppercase put:' |
|
361 |
"/ "to-upper selected text" |
|
362 |
"/ |
|
363 |
"/ |line1 line2| |
|
364 |
"/ |
|
365 |
"/ line1 := self selectionStartLine. |
|
366 |
"/ line2 := self selectionEndLine. |
|
367 |
"/ line1 isNil ifTrue:[ |
|
368 |
"/ line1 := self perform:#cursorLine ifNotUnderstood:nil. |
|
369 |
"/ line1 notNil ifTrue:[ |
|
370 |
"/ line2 := line1 |
|
371 |
"/ ] |
|
372 |
"/ ]. |
|
373 |
"/ line1 notNil ifTrue:[ |
|
374 |
"/ line1 to:line2 do:[:lineNr | |
|
375 |
"/ |line col1 col2| |
|
376 |
"/ |
|
377 |
"/ line := (self listAt:lineNr) copy. |
|
378 |
"/ line size > 0 ifTrue:[ |
|
379 |
"/ lineNr == line1 ifTrue:[ |
|
380 |
"/ col1 := selectionStartCol. |
|
381 |
"/ ] ifFalse:[ |
|
382 |
"/ col1 := 1. |
|
383 |
"/ ]. |
|
384 |
"/ lineNr == line2 ifTrue:[ |
|
385 |
"/ col2 := selectionEndCol. |
|
386 |
"/ ] ifFalse:[ |
|
387 |
"/ col2 := (self listAt:lineNr) size. |
|
388 |
"/ ]. |
|
389 |
"/ |
|
390 |
"/ col1 to:col2 do:[:col | |
|
391 |
"/ |ch| |
|
392 |
"/ |
|
393 |
"/ ch := line at:col. |
|
394 |
"/ line at:col put:ch asUppercase. |
|
395 |
"/ ]. |
|
396 |
"/ self withoutRedrawAt:lineNr put:line. |
|
397 |
"/ self invalidateLine:lineNr. |
|
398 |
"/ ]. |
|
399 |
"/ ]. |
|
400 |
"/ ] |
|
401 |
"/'. |
|
726 | 402 |
|
1451
319f45ae429a
bug fix - wrong message send for convertSelection (F6)
Claus Gittinger <cg@exept.de>
parents:
1438
diff
changeset
|
403 |
macros at:#ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst put:'self convertSelectionToLowercaseOrUppercaseOrUppercaseFirst'. |
1438 | 404 |
"/macros at:#ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst put:' |
405 |
"/ "toLower/toUppercaseFirst/toUpper selected text" |
|
406 |
"/ |
|
407 |
"/ |line1 line2| |
|
408 |
"/ |
|
409 |
"/ line1 := self selectionStartLine. |
|
410 |
"/ line2 := self selectionEndLine. |
|
411 |
"/ line1 isNil ifTrue:[ |
|
412 |
"/ line1 := self perform:#cursorLine ifNotUnderstood:nil. |
|
413 |
"/ line1 notNil ifTrue:[ |
|
414 |
"/ line2 := line1 |
|
415 |
"/ ] |
|
416 |
"/ ]. |
|
417 |
"/ line1 notNil ifTrue:[ |
|
418 |
"/ line1 to:line2 do:[:lineNr | |
|
419 |
"/ |line col1 col2 isAllLower isLowerFirst isAllUpper isUpperFirst |
|
420 |
"/ makeLowercase makeUppercase makeUppercaseFirst makeLowercaseFirst| |
|
421 |
"/ |
|
422 |
"/ line := (self listAt:lineNr) copy. |
|
423 |
"/ line size > 0 ifTrue:[ |
|
424 |
"/ lineNr == line1 ifTrue:[ |
|
425 |
"/ col1 := selectionStartCol. |
|
426 |
"/ ] ifFalse:[ |
|
427 |
"/ col1 := 1. |
|
428 |
"/ ]. |
|
429 |
"/ lineNr == line2 ifTrue:[ |
|
430 |
"/ col2 := selectionEndCol. |
|
431 |
"/ ] ifFalse:[ |
|
432 |
"/ col2 := (self listAt:lineNr) size. |
|
433 |
"/ ]. |
|
434 |
"/ isAllLower := isAllUpper := isUpperFirst := isLowerFirst := true. |
|
435 |
"/ col1 to:col2 do:[:col | |
|
436 |
"/ |ch| |
|
437 |
"/ |
|
438 |
"/ ch := line at:col. |
|
439 |
"/ ch isUppercase ifTrue:[ |
|
440 |
"/ isAllLower := false. |
|
441 |
"/ col == col1 ifTrue:[ |
|
442 |
"/ isLowerFirst := false. |
|
443 |
"/ ]. |
|
444 |
"/ ] ifFalse:[ |
|
445 |
"/ ch isLowercase ifTrue:[ |
|
446 |
"/ isAllUpper := false. |
|
447 |
"/ col == col1 ifTrue:[ |
|
448 |
"/ isUpperFirst := false. |
|
449 |
"/ ]. |
|
450 |
"/ ] |
|
451 |
"/ ]. |
|
452 |
"/ ]. |
|
453 |
"/ |
|
454 |
"/ makeLowercase := makeUppercase := makeUppercaseFirst := makeLowercaseFirst := false. |
|
455 |
"/ isLowerFirst ifTrue:[ |
|
456 |
"/ makeUppercaseFirst := true. |
|
457 |
"/ ] ifFalse:[ |
|
458 |
"/ "/ must remember where we come from - otherwise, we end up |
|
459 |
"/ "/ in upperFirst - lowerFirst cycle. |
|
460 |
"/ "/ think about a good place to store this state |
|
461 |
"/ false "(isUpperFirst and:[isAllUpper not])" ifTrue:[ |
|
462 |
"/ makeLowercaseFirst := true. |
|
463 |
"/ ] ifFalse:[ |
|
464 |
"/ isAllUpper ifTrue:[ |
|
465 |
"/ makeLowercase := true. |
|
466 |
"/ ] ifFalse:[ |
|
467 |
"/ makeUppercase := true. |
|
468 |
"/ ] |
|
469 |
"/ ] |
|
470 |
"/ ]. |
|
471 |
"/ makeUppercaseFirst ifTrue:[ |
|
472 |
"/ line at:col1 put:(line at:col1) asUppercase. |
|
473 |
"/ ] ifFalse:[ |
|
474 |
"/ makeLowercaseFirst ifTrue:[ |
|
475 |
"/ line at:col1 put:(line at:col1) asLowercase. |
|
476 |
"/ ] ifFalse:[ |
|
477 |
"/ col1 to:col2 do:[:col | |
|
478 |
"/ |ch| |
|
479 |
"/ |
|
480 |
"/ ch := line at:col. |
|
481 |
"/ ch := makeLowercase |
|
482 |
"/ ifTrue:[ ch asLowercase ] |
|
483 |
"/ ifFalse:[ |
|
484 |
"/ makeUppercase |
|
485 |
"/ ifTrue:[ ch asUppercase ] |
|
486 |
"/ ifFalse:[ |
|
487 |
"/ col == col1 |
|
488 |
"/ ifTrue:[ ch asUppercase ] |
|
489 |
"/ ifFalse:[ ch asLowercase ] |
|
490 |
"/ ] |
|
491 |
"/ ]. |
|
492 |
"/ line at:col put:ch. |
|
493 |
"/ ]. |
|
494 |
"/ ]. |
|
495 |
"/ ]. |
|
496 |
"/ self withoutRedrawAt:lineNr put:line. |
|
497 |
"/ self invalidateLine:lineNr. |
|
498 |
"/ ]. |
|
499 |
"/ ]. |
|
500 |
"/ ] |
|
501 |
"/'. |
|
1076
2d6b2399e42c
better F& behavior; start by makeing UpperFirst
Claus Gittinger <cg@exept.de>
parents:
1070
diff
changeset
|
502 |
|
1438 | 503 |
macros at:#ParenthizeSelection put:'self parenthizeSelection'. |
504 |
"/macros at:#ParenthizeSelection put:' |
|
505 |
"/ "place parenthesis around the selected text" |
|
506 |
"/ |
|
507 |
"/ |line1 col1 line2 col2| |
|
508 |
"/ |
|
509 |
"/ line1 := self selectionStartLine. |
|
510 |
"/ col1 := self selectionStartCol. |
|
511 |
"/ line2 := self selectionEndLine. |
|
512 |
"/ col2 := self selectionEndCol. |
|
513 |
"/ (line1 notNil |
|
514 |
"/ and:[ col1 notNil |
|
515 |
"/ and:[ line2 notNil |
|
516 |
"/ and:[ col2 notNil ]]]) |
|
517 |
"/ ifTrue:[ |
|
518 |
"/ self insertString:'')'' atLine:line2 col:col2+1. |
|
519 |
"/ self insertString:''('' atLine:line1 col:col1. |
|
520 |
"/ self selectFromLine:line1 col:col1 toLine:line2 col:col2+2. |
|
521 |
"/ ] ifFalse:[ |
|
522 |
"/ self beep. |
|
523 |
"/ ] |
|
524 |
"/'. |
|
718 | 525 |
|
526 |
macros at:#UnparenthizeSelection put:' |
|
527 |
"remove parenthesis in the selected text" |
|
528 |
||
529 |
|line1 col1 line2 col2| |
|
530 |
||
531 |
line1 := self selectionStartLine. |
|
532 |
col1 := self selectionStartCol. |
|
533 |
line2 := self selectionEndLine. |
|
534 |
col2 := self selectionEndCol. |
|
535 |
(line1 notNil |
|
536 |
and:[ col1 notNil |
|
537 |
and:[ line2 notNil |
|
538 |
and:[ col2 notNil |
|
539 |
and:[ (''({[<'' includes:(self characterAtLine:line1 col:col1)) |
|
540 |
and:[ (''>]})'' includes:(self characterAtLine:line2 col:col2)) ]]]]]) |
|
541 |
ifTrue:[ |
|
542 |
self deleteCharAtLine:line2 col:col2. |
|
543 |
self deleteCharAtLine:line1 col:col1. |
|
544 |
self selectFromLine:line1 col:col1 toLine:line2 col:col2-2. |
|
545 |
] ifFalse:[ |
|
546 |
self beep. |
|
547 |
] |
|
548 |
'. |
|
549 |
||
936 | 550 |
macros at:#SingleQuoteSelection put:' |
551 |
"place single quotes around the selected text" |
|
552 |
||
553 |
|line1 col1 line2 col2| |
|
554 |
||
555 |
line1 := self selectionStartLine. |
|
556 |
col1 := self selectionStartCol. |
|
557 |
line2 := self selectionEndLine. |
|
558 |
col2 := self selectionEndCol. |
|
559 |
(line1 notNil |
|
560 |
and:[ col1 notNil |
|
561 |
and:[ line2 notNil |
|
562 |
and:[ col2 notNil ]]]) |
|
563 |
ifTrue:[ |
|
564 |
self insertString:Character quote asString atLine:line2 col:col2+1. |
|
565 |
self insertString:Character quote asString atLine:line1 col:col1. |
|
566 |
self selectFromLine:line1 col:col1 toLine:line2 col:col2+2. |
|
567 |
] ifFalse:[ |
|
568 |
self beep. |
|
569 |
] |
|
570 |
'. |
|
571 |
||
720 | 572 |
"/macros keys do:[:k | |
573 |
"/ Transcript showCR:k. |
|
574 |
"/]. |
|
718 | 575 |
! |