| text% : class? | ||
superclass: object% | ||
|
A text% object is a standard text editor. A text editor is displayed on the screen through an editor-canvas% object or some other display.
| |||||||||||||||||||||
| line-spacing : (and/c real? (not/c negative?)) = 1.0 | |||||||||||||||||||||
| tab-stops : (listof real?) | |||||||||||||||||||||
| auto-wrap : any/c = #f |
The line-spacing argument sets the additional amount of space (in DC units) inserted between each line in the editor when the editor is displayed. This spacing is included in the reported height of each line.
See set-tabs for information about tabstops.
If auto-wrap is true, then auto-wrapping is enabled via auto-wrap.
A new keymap% object is created for the new editor. See also get-keymap and set-keymap.
A new style-list% object is created for the new editor. See also get-style-list and set-style-list.
| (send a-text after-change-style start len) → void? |
| start : exact-nonnegative-integer? |
| len : exact-nonnegative-integer? |
Refine this method with augment.
Specification: Called after the style is changed for a given range (and after the display is refreshed; use on-change-style and begin-edit-sequence to avoid extra refreshes when after-change-style modifies the editor).
See also can-change-style? and on-edit-sequence.
No internals locks are set when this method is called.
Default implementation: Does nothing.
| (send a-text after-delete start len) → void? |
| start : exact-nonnegative-integer? |
| len : exact-nonnegative-integer? |
Refine this method with augment.
Specification: Called after a given range is deleted from the editor (and after the display is refreshed; use on-delete and begin-edit-sequence to avoid extra refreshes when after-delete modifies the editor).
The start argument specifies the starting position of the deleted range. The len argument specifies number of deleted items (so start+len is the ending position of the deleted range).
See also can-delete? and on-edit-sequence.
No internals locks are set when this method is called.
Default implementation: Does nothing.
| (send a-text after-insert start len) → void? |
| start : exact-nonnegative-integer? |
| len : exact-nonnegative-integer? |
Refine this method with augment.
Specification: Called after items are inserted into the editor (and after the display is refreshed; use on-insert and begin-edit-sequence to avoid extra refreshes when after-insert modifies the editor).
The start argument specifies the position of the insert. The len argument specifies the total length (in positions) of the inserted items.
See also can-insert? and on-edit-sequence.
No internals locks are set when this method is called.
Default implementation: Does nothing.
| (send a-text after-merge-snips pos) → void? |
| pos : exact-nonnegative-integer? |
Refine this method with augment.
Specification: Called after adjacent snips in the editor are combined into one.
The pos argument specifies the position within the editor where the snips were merged (i.e., one old snip was just before pos, one old was just after pos, and the new snip spans pos).
See also merge-with.
Default implementation: Does nothing.
| (send a-text after-set-position) → void? |
Refine this method with augment.
Specification: Called after the start and end position have been moved (but not when the position is moved due to inserts or deletes).
See also on-edit-sequence.
Default implementation: Does nothing.
| (send a-text after-set-size-constraint) → void? |
Refine this method with augment.
Specification: Called after the editor’s maximum or minimum height or width is changed (and after the display is refreshed; use on-set-size-constraint and begin-edit-sequence to avoid extra refreshes when after-set-size-constraint modifies the editor).
(This callback method is provided because setting an editor’s maximum width may cause lines to be re-flowed with soft carriage returns.)
See also can-set-size-constraint? and on-edit-sequence.
Default implementation: Does nothing.
| (send a-text after-split-snip pos) → void? |
| pos : exact-nonnegative-integer? |
Refine this method with augment.
Specification: Called after a snip in the editor is split into two, either through a call to split-snip or during some other action, such as inserting.
The pos argument specifies the position within the editor where a snip was split.
Default implementation: Does nothing.
| (send a-text call-clickback start end) → void? |
| start : exact-nonnegative-integer? |
| end : exact-nonnegative-integer? |
Simulates a user click that invokes a clickback, if the given range of positions is within a clickback’s region. See also Clickbacks.
| (send a-text can-change-style? start len) → boolean? |
| start : exact-nonnegative-integer? |
| len : exact-nonnegative-integer? |
Refine this method with augment.
Specification: Called before the style is changed in a given range of the editor. If the return value is #f, then the style change will be aborted.
The editor is internally locked for writing during a call to this method (see also Internal Editor Locks). Use after-change-style to modify the editor, if necessary.
See also on-change-style, after-change-style, and on-edit-sequence.
Default implementation: Returns #t.
| (send a-text can-delete? start len) → boolean? |
| start : exact-nonnegative-integer? |
| len : exact-nonnegative-integer? |
Refine this method with augment.
Specification: Called before a range is deleted from the editor. If the return value is #f, then the delete will be aborted.
The start argument specifies the starting position of the range to delete. The len argument specifies number of items to delete (so start+len is the ending position of the range to delete).
The editor is internally locked for writing during a call to this method (see also Internal Editor Locks). Use after-delete to modify the editor, if necessary.
See also on-delete, after-delete, and on-edit-sequence.
Default implementation: Returns #t.
| (send a-text can-insert? start len) → boolean? |
| start : exact-nonnegative-integer? |
| len : exact-nonnegative-integer? |
Refine this method with augment.
Specification: Called before items are inserted into the editor. If the return value is #f, then the insert will be aborted.
The start argument specifies the position of the potential insert. The len argument specifies the total length (in positions) of the items to be inserted.
The editor is internally locked for writing during a call to this method (see also Internal Editor Locks). Use after-insert to modify the editor, if necessary.
See also on-insert, after-insert, and on-edit-sequence.
Default implementation: Returns #t.
| (send a-text can-set-size-constraint?) → boolean? |
Refine this method with augment.
Specification: Called before the editor’s maximum or minimum height or width is changed. If the return value is #f, then the change will be aborted.
(This callback method is provided because setting an editor’s maximum width may cause lines to be re-flowed with soft carriage returns.)
See also on-set-size-constraint, after-set-size-constraint, and on-edit-sequence.
Default implementation: Returns #t.
| (send a-text caret-hidden?) → boolean? |
Returns #t if the caret is hidden for this editor or #f otherwise.
See also hide-caret.
| ||||||||||||||||||||||||||||
| delta : (or/c (is-a?/c style-delta%) false/c) | ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| end : (or/c exact-nonnegative-integer? (one/of 'end)) = 'end | ||||||||||||||||||||||||||||
| counts-as-mod? : any/c = #t | ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| style : (or/c (is-a?/c style<%>) false/c) | ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
| end : (or/c exact-nonnegative-integer? (one/of 'end)) = 'end | ||||||||||||||||||||||||||||
| counts-as-mod? : any/c = #t |
Extends change-style in editor<%>.
Changes the style for a region in the editor by applying a style delta or installing a specific style. If start is 'start and end is 'end, then the currently selected items are changed. Otherwise, if end is 'end, then the style is changed from start until the end of the selection. If counts-as-mod? is #f, then set-modified is not called after applying the style change.
When style is provided: The editor’s style list must contain style, otherwise the style is not changed. See also convert in style-list%.
| (send a-text copy extend? time [start end]) → void? | ||||||||||||
| extend? : any/c | ||||||||||||
| time : (and/c exact? integer?) | ||||||||||||
| ||||||||||||
| end : (or/c exact-nonnegative-integer? (one/of 'end)) = 'end |
Copies specified range of text into the clipboard. If extend? is not #f, the old clipboard contents are appended. If start is 'start or end is 'end, then the current selection start/end is used.
See Cut and Paste Time Stamps for a discussion of the time argument. If time is outside the platform-specific range of times, an exn:fail:contract exception is raised.
| (send a-text copy-self-to dest) → void? |
| dest : (or/c (is-a?/c text%) (is-a?/c pasteboard%)) |
Overrides copy-self-to in editor<%>.
In addition to the default copy-self-to in editor<%> work, this editor’s file format, wordbreak function, wordbreak map, click-between-threshold, caret visibility state, overwrite mode state, and autowrap bitmap are installed into dest.
| (send a-text cut extend? time [start end]) → void? | ||||||||||||
| extend? : any/c | ||||||||||||
| time : (and/c exact? integer?) | ||||||||||||
| ||||||||||||
| end : (or/c exact-nonnegative-integer? (one/of 'end)) = 'end |
Copies and then deletes the specified range. If extend? is not #f, the old clipboard contents are appended. If start is 'start or end is 'end, then the current selection start/end is used.
See Cut and Paste Time Stamps for a discussion of the time argument. If time is outside the platform-specific range of times, an exn:fail:contract exception is raised.
| (send a-text delete start [end scroll-ok?]) → void? |
| start : (or/c exact-nonnegative-integer? (one/of 'start)) |
| end : (or/c exact-nonnegative-integer? (one/of 'back)) = 'back |