1Tk::Text::SuperText(3)User Contributed Perl DocumentationTk::Text::SuperText(3)
2
3
4
6 Tk::Text::SuperText - An improved text widget for Perl/Tk
7
9 $super_text = $paren->SuperText(?options?);
10
12 -background -highlightbackground -insertontime -selectborderwidth
13 -borderwidth -highlightcolor -insertwidth -selectforeground
14 -cursor -highlightthickness -padx -setgrid
15 -exportselection -insertbackground -pady -takefocus
16 -font -insertborderwidth -relief -xscrollcommand
17 -foreground -insertofftime -selectbackground -yscrollcommand
18 -ansicolor
19
20 See Tk::options for details of the standard options.
21
22 -height -spacing1 -spacing2 -spacing3
23 -state -tabs -width -wrap
24
25 See Tk::Text for details of theis options.
26
28 Name: indentMode
29 Class: IndentMode
30 Switch: -indentmode
31 Specifies how to indent when a new line is inserted in the text.
32 The possible modes are none for no indent at all or auto for
33 positioning the insertion cursor right below the first non-white
34 space character of the previous line.
35
36 Name: undoDepth
37 Class: UndoDepth
38 Switch: -undodepth
39 Sets the maximum depth for the undo buffer:a number specifies the
40 numbers of insert or delete operations that can be stored in the
41 buffer before the oldest one is poped out and forgotten; 0 stops
42 the undo feature, undef sets unlimited depth.
43
44 Name: redoDepth
45 Class: RedoDepth
46 Switch: -redodepth
47 Sets the maximum depth for the redo buffer:a number specifies the
48 numbers of undo operations that can be stored in the buffer before
49 the oldest one is poped out and forgotten; 0 stops the redo
50 feature, undef sets unlimited depth.
51
52 Name: showMatching
53 Class: ShowMatching
54 Switch: -showmatching
55 With a value of 1 activates the matching parentheses feature.0
56 deactivates it.
57
58 Name: matchHighlightTime
59 Class: MatchHighlightTime
60 Switch: -matchhighlighttime
61 Sets the number of milliseconds the match highlight stays visible;
62 with a value of 0 the highlight stays on till next match.
63
64 Name: matchForeground
65 Class: MatchForeground
66 Switch: -matchforeground
67 Set the foreground color for the char hilighted by the match-
68 parentheses command.
69
70 Name: matchBackground
71 Class: MatchBackground
72 Switch: -matchbackground
73 Set the background color for the char hilighted by the match-
74 parentheses command.
75
76 Name: matchingCouples
77 Class: MatchingCouples
78 Switch: -matchingcouples
79 Sets the chars that are searched for a matching counterpart. The
80 format is a simple string with matching chars coupled in left-right
81 order; here's an example: {}[]()"" . For double couples ("") the
82 match is done only on the forwarding chars.
83
84 Name: insertMode
85 Class: InsertMode
86 Switch: -insertmode
87 Sets the default insert mode: insert or overwrite .
88
89 Name: ansiColor
90 Class: AnsiColor
91 Switch: -ansicolor
92 Enables or disables use of Tk::TextANSIColor module. This option
93 was implemented by Jim Turner (THANKS for the support!)
94
96 Tk::Text::SuperText implements many new features over the standard
97 Tk::Text widget while supporting all its standard features. It's used
98 simply as the Tk::Text widget. New Features:
99
100 • Unlimited undo/redo.
101
102 So you can undo and redo whatever you deleted/inserted whenever you
103 want. To reset the undo and redo buffers call this method:
104 $w->resetUndo;
105
106 • Rectangular selections.
107
108 Rectangular text zones can be selected, copied, deleted, shifted
109 with the mouse or with the keyboard.
110
111 • Selection right/left char and tab shift.
112
113 Text selections can be shifted left/right of one or more chars or
114 a tabs.
115
116 • Normal and 'inline' selection paste.
117
118 The 'normal' paste is the normal text paste you know:
119
120 Paste Buffer:
121 line x
122
123 line y
124
125 Text Buffer:
126 line 1
127
128 line2
129
130 Normal paste at line 1:
131 line x
132
133 line y
134
135 line 1
136
137 line 2
138
139 The 'inline' paste works like this:
140 Inline paste at line 1:
141 line x line 1
142
143 line y line 2
144
145 • Parentheses matching.
146
147 To help you inspect nested parentheses, brackets, and other
148 characters, SuperText has both an automatic parenthesis matching
149 mode, and a find matching command. Automatic parenthesis matching
150 is activated when you type or when you move the insertion cursor
151 after a parenthesis. It momentarily highlights the matching
152 character if that character is visible in the window. To find a
153 matching character anywhere in the file, position the cursor after
154 the it, and call the find matching command.
155
156 • Auto-indenting.
157
158 When you press the Return or Enter key, spaces and tabs are
159 inserted to line up the insert point under the start of the
160 previous line.
161
162 • Control codes insertion.
163
164 You can directly insert a non-printable control character in the
165 text.
166
167 • Commands are managed via virtual events.
168
169 Every SuperText command is bound to a virtual event, so to call it
170 or to bind it to a key sequence use the Tk::event functions. I
171 used this format for key bind so there's no direct key-to-command
172 bind, and this gives me more flexibility; however, you can use
173 normal binds.
174
175 Example:
176 $w->eventAdd('Tk::Text::SuperText','<<SelectAll>>','<Control-a>');
177
178 To set default event bindings use this method: $w->bindDefault;
179
180 • Default key bindings are redefined (not really a feature :).
181
182 Every virtual event has an associated public method with the same
183 name of the event but with the first char in lower case (e.g.:
184 <<MouseSelect>> event has a corresponding $super_text->mouseSelect
185 method).
186
187 Virtual Event/Command Default Key Binding
188
189 MouseSetInsert <Button1>
190 MouseSelect <B1-Motion>
191 MouseSelectWord <Double-1>
192 MouseSelectLine <Triple-1>
193 MouseSelectAdd <Shift-1>
194 MouseSelectAddWord <Double-Shift-1>
195 MouseSelectAddLine <Triple-Shift-1>
196 MouseSelectAutoScan <B1-Leave>
197 MouseSelectAutoScanStop <B1-Enter>,<ButtonRelease-1>
198 MouseMoveInsert <Alt-1>
199 MouseRectSelection <Control-B1-Motion>
200 MouseMovePageTo <2>
201 MouseMovePage <B2-Motion>
202 MousePasteSelection <ButtonRelease-2>
203
204 MoveLeft <Left>
205 SelectLeft <Shift-Left>
206 SelectRectLeft <Shift-Alt-Left>
207 MoveLeftWord <Control-Left>
208 SelectLeftWord <Shift-Control-Left>
209 MoveRight <Right>
210 SelectRight <Shift-Right>
211 SelectRectRight <Shift-Alt-Right>
212 MoveRightWord <Control-Right>
213 SelectRightWord <Shift-Control-Right>
214 MoveUp <Up>
215 SelectUp <Shift-Up>
216 SelectRectUp <Shift-Alt-Up>
217 MoveUpParagraph <Control-Up>
218 SelectUpParagraph <Shift-Control-Up>
219 MoveDown <Down>
220 SelectDown <Shift-Down>
221 SelectRectDown <Shift-Alt-Down>
222 MoveDownParagraph <Control-Down>
223 SelectDownParagraph <Shift-Control-Down>
224 MoveLineStart <Home>
225 SelectToLineStart <Shift-Home>
226 MoveTextStart <Control-Home>
227 SelectToTextStart <Shift-Control-Home>
228 MoveLineEnd <End>
229 SelectToLineEnd <Shift-End>
230 MoveTextEnd <Control-End>
231 SelectToTextEnd <Shift-Control-End>
232 MovePageUp <Prior>
233 SelectToPageUp <Shift-Prior>
234 MovePageLeft <Control-Prior>
235 MovePageDown <Next>
236 SelectToPageDown <Shift-Next>
237 MovePageRight <Control-Next>
238 SetSelectionMark <Control-space>,<Select>
239 SelectToMark <Shift-Control-space>,<Shift-Select>
240
241 SelectAll <Control-a>
242 SelectionShiftLeft <Control-comma>
243 SelectionShiftLeftTab <Control-Alt-comma>
244 SelectionShiftRight <Control-period>
245 SelectionShiftRightTab <Control-Alt-period>
246
247 Ins <Insert>
248 Enter <Return>
249 AutoIndentEnter <Control-Return>
250 NoAutoindentEnter <Shift-Return>
251 Del <Delete>
252 BackSpace <BackSpace>
253 DeleteToWordStart <Shift-BackSpace>
254 DeleteToWordEnd <Shift-Delete>
255 DeleteToLineStart <Alt-BackSpace>
256 DeleteToLineEnd <Alt-Delete>
257 DeleteWord <Control-BackSpace>
258 DeleteLine <Control-Delete>
259
260 InsertControlCode <Control-Escape>
261
262 FocusNext <Control-Tab>
263 FocusPrev <Shift-Control-Tab>
264
265 FlashMatchingChar <Control-b>
266 RemoveMatch <Control-B>
267 FindMatchingChar <Control-j>
268 JumpToMatchingChar <Control-J>
269
270 Escape <Escape>
271
272 Tab <Tab>
273
274 LeftTab <Shift-Tab>
275
276 Copy <Control-c>
277
278 Cut <Control-x>
279
280 Paste <Control-v>
281
282 InlinePaste <Control-V>
283
284 Undo <Control-z>
285
286 Redo <Control-Z>
287
288 Destroy <Destroy>
289
290 MenuSelect <Alt-KeyPress>
291
292 • Public methods.
293
294 $widget->mouseSetInsert
295
296 $widget->museSelect
297
298 $widget->mouseSelectWord
299
300 $widget->mouseSelectLine
301
302 $widget->mouseSelectAdd
303
304 $widget->mouseSelectAddWord
305
306 $widget->mouseSelectAddLine
307
308 $widget->mouseSelectAutoScan
309
310 $widget->mouseSelectAutoScanStop
311
312 $widget->mouseMoveInsert
313
314 $widget->mouseRectSelection
315
316 $widget->mouseMovePageTo
317
318 $widget->mouseMovePage
319
320 $widget->mousePasteSelection
321
322 $widget->moveLeft
323
324 $widget->selectLeft
325
326 $widget->selectRectLeft
327
328 $widget->moveLeftWord
329
330 $widget->selectLeftWord
331
332 $widget->moveRight
333
334 $widget->selectRight
335
336 $widget->selectRectRight
337
338 $widget->moveRightWord
339
340 $widget->selectRightWord
341
342 $widget->moveUp
343
344 $widget->selectUp
345
346 $widget->selectRectUp
347
348 $widget->moveUpParagraph
349
350 $widget->selectUpParagraph
351
352 $widget->moveDown
353
354 $widget->selectDown
355
356 $widget->selectRectDown
357
358 $widget->moveDownParagraph
359
360 $widget->selectDownParagraph
361
362 $widget->moveLineStart
363
364 $widget->selectToLineStart
365
366 $widget->moveTextStart
367
368 $widget->selectToTextStart
369
370 $widget->moveLineEnd
371
372 $widget->selectToLineEnd
373
374 $widget->moveTextEnd
375
376 $widget->selectToTextEnd
377
378 $widget->movePageUp
379
380 $widget->selectToPageUp
381
382 $widget->movePageLeft
383
384 $widget->movePageDown
385
386 $widget->selectToPageDown
387
388 $widget->movePageRight
389
390 $widget->setSelectionMark
391
392 $widget->selectToMark
393
394 $widget->selectAll
395
396 $widget->selectionShiftLeft
397
398 $widget->selectionShiftLeftTab
399
400 $widget->selectionShiftRight
401
402 $widget->selectionShiftRightTab
403
404 $widget->ins
405
406 $widget->enter
407
408 $widget->autoIndentEnter
409
410 $widget-> noAutoindentEnter
411
412 $widget->del
413
414 $widget->backSpace
415
416 $widget->deleteToWordStart
417
418 $widget->deleteToWordEnd
419
420 $widget->deleteToLineStart
421
422 $widget->deleteToLineEnd
423
424 $widget->deleteWord
425
426 $widget->deleteLine
427
428 $widget->insertControlCode
429
430 $widget->focusNext
431
432 $widget->focusPrev
433
434 $widget->flashMatchingChar
435
436 $widget->removeMatch
437
438 $widget->findMatchingChar
439
440 $widget->jumpToMatchingChar
441
442 $widget->escape
443
444 $widget->tab
445
446 $widget->leftTab
447
448 $widget->copy
449
450 $widget->cut
451
452 $widget->paste
453
454 $widget->inlinePaste
455
456 $widget->undo
457
458 $widget->redo
459
460 $widget->destroy
461
462 $widget->menuSelect
463
465 Current maintainer is Alexander Becker, asb@cpan.org.
466
467 Originally written by Alessandro Iob.
468
470 This program is free software; you can redistribute it and/or modify it
471 under the same terms as Perl itself.
472
474 Tk::Text Tk::ROText Tk::TextUndo
475
477 text, widget
478
479
480
481perl v5.36.0 2023-01-20 Tk::Text::SuperText(3)