Skip to content

Commit de03f1a

Browse files
alex-hhhrfindler
authored andcommitted
Update editor<%> docs to clarify that undo needs to be enabled (#49)
1 parent 5e433c8 commit de03f1a

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

gui-doc/scribblings/gui/editor-intf.scrbl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ Adds an undoer procedure to the editor's undo stack. If an undo is
3030
redoing) changes to an editor, and when this undoer is the first item
3131
on the undo (or redo) stack.
3232

33+
Editor instances are created with no undo stack, so no undo operations
34+
will be recorded unless @method[editor<%> set-max-undo-history] is
35+
used to change the size of the undo stack.
36+
3337
The system automatically installs undo records to undo built-in editor
3438
operations, such as inserts, deletes, and font changes. Install an
3539
undoer only when it is necessary to maintain state or handle

gui-doc/scribblings/gui/editor-overview.scrbl

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,30 @@ A brief example illustrates how editors work. To start, an editor
6161
]
6262

6363
At this point, the editor is fully functional: the user can type text
64-
into the editor, but no cut-and-paste operations are available. We
65-
can support all of the standard operations on an editor via the
66-
menu bar:
64+
into the editor, but no cut-and-paste or undo operations are
65+
available. We can support all of the standard operations on an editor
66+
via the menu bar:
6767

6868
@racketblock[
6969
(define mb (new menu-bar% [parent f]))
7070
(define m-edit (new menu% [label "Edit"] [parent mb]))
7171
(define m-font (new menu% [label "Font"] [parent mb]))
7272
(append-editor-operation-menu-items m-edit #f)
7373
(append-editor-font-menu-items m-font)
74+
(send t #,(:: editor<%> set-max-undo-history) 100)
7475
]
7576

76-
Now, the standard cut and paste operations work, and the user can even
77-
set font styles. The user can also insert an embedded editor by
78-
selecting @onscreen{Insert Text} from the @onscreen{Edit} menu; after
79-
selecting the menu item, a box appears in the editor with the caret
80-
inside. Typing with the caret in the box stretches the box as text is
81-
added, and font operations apply wherever the caret is active. Text
82-
on the outside of the box is rearranged as the box changes
83-
sizes. Note that the box itself can be copied and pasted.
77+
Now, the standard cut-and-paste operations work and so does undo, and
78+
the user can even set font styles. The editor is created with no undo
79+
history stack, @method[editor<%> set-max-undo-history] is used to set
80+
a non-zero stack, so undo operations can be recorded. The user can
81+
also insert an embedded editor by selecting @onscreen{Insert Text}
82+
from the @onscreen{Edit} menu; after selecting the menu item, a box
83+
appears in the editor with the caret inside. Typing with the caret in
84+
the box stretches the box as text is added, and font operations apply
85+
wherever the caret is active. Text on the outside of the box is
86+
rearranged as the box changes sizes. Note that the box itself can be
87+
copied and pasted.
8488

8589
The content of an editor is made up of @defterm{@tech{snips}}. An
8690
embedded editor is a single snip from the embedding editor's

0 commit comments

Comments
 (0)