@@ -61,26 +61,30 @@ A brief example illustrates how editors work. To start, an editor
6161]
6262
6363At 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
8589The 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