TEditInputOps.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Edited by Paxton on December 31, 1982 2:16 pm
Michael Plass, March 18, 1985 4:23:38 pm PST
Doug Wyatt, April 14, 1985 5:12:31 pm PST
DIRECTORY
Rope USING [ROPE],
TextEdit USING [CapChange],
TextLooks USING [Look, Looks],
TextNode USING [Location, Ref, RefTextNode],
TEditDocument USING [Selection, SelectionGrain, SelectionId],
TEditLocks USING [Access];
TEditInputOps: CEDAR DEFINITIONS
= BEGIN OPEN TEditDocument;
ROPE: TYPE ~ Rope.ROPE;
CallWithLocks:
PROC [
proc:
PROC [root: TextNode.Ref, tSel: Selection],
access: TEditLocks.Access ← write];
CallWithBothLocked:
PROC [
proc:
PROC [sourceRoot, destRoot: TextNode.Ref, tSel, srcSel, targetSel: Selection],
targetSel, srcSel: Selection, sourceAccess: TEditLocks.Access];
InsertChar:
PROC [char:
CHAR];
Inserts a character in the document at the primary selection and repaints
InsertRope:
PROC [rope:
ROPE];
like InsertChar, but for entire rope
InsertLineBreak:
PROC;
insert a CR and then copies blanks from front of previous line
BufferedInsertChar:
PROC [char:
CHAR];
Exactly as InsertChar, but returns immediately, forking a repaint process.
This is intended for use with user type-in. See TEditBufferedInputImpl
BufferedInsertText:
PROC [text:
ROPE];
Exactly as InsertChar, but returns immediately, forking a repaint process.
This is intended for use with user type-in. See TEditBufferedInputImpl
WaitForInsertToFinish:
PROC;
returns after buffered input has completed
BackSpace:
PROC [count:
INT ← 1];
Deletes the character preceding the insertion point and repaints the document
BackWord:
PROC [count:
INT ← 1];
Deletes the word preceding the insertion point and repaints the document
DeleteNextChar:
PROC [count:
INT ← 1];
Deletes the character after the insertion point and repaints the document
DeleteNextWord:
PROC [count:
INT ← 1];
Deletes the word after the insertion point and repaints the document
GoToNextChar: PROC [count: INT ← 1];
GoToPreviousChar: PROC [count: INT ← 1];
GoToNextWord: PROC [count: INT ← 1];
GoToPreviousWord: PROC [count: INT ← 1];
GoToNextNode: PROC [count: INT ← 1];
GoToPreviousNode:
PROC [count:
INT ← 1];
commands for moving caret
FindPrevWord:
PROC [node: TextNode.RefTextNode, offset:
INT]
RETURNS [nChars: CARDINAL];
FindNextWord:
PROC [node: TextNode.RefTextNode, start:
INT]
RETURNS [nChars: CARDINAL];
MakeControlCharacter: PROC;
UnMakeControlCharacter: PROC;
MakeOctalCharacter: PROC;
UnMakeOctalCharacter: PROC;
DoPendingDelete: PROC;
Delete:
PROC [saveForPaste:
BOOL ←
TRUE];
Deletes the primary selection
Paste:
PROC;
insert the last deletion at current insertion point
SaveForPaste:
PROC;
save the selection for future Paste
SaveSpanForPaste:
PROC [
startLoc, endLoc: TextNode.Location, grain: TEditDocument.SelectionGrain];
like SaveForPaste, but saves the given span rather than the selection
Break:
PROC;
break node at current insertion point
Join:
PROC;
copies text of current insertion point node to end of previous node
then deletes node and makes point selection at place where joined them
Nest:
PROC;
move the selection to a deeper nesting level in the tree
UnNest:
PROC;
move the selection to a shallower nesting level in the tree
Move:
PROC [target: SelectionId ← primary];
Move the contents of the other selection to the target selection
CheckReadonly: PROC [targetSel: Selection] RETURNS [BOOL];
Copy:
PROC [target: SelectionId ← primary];
Copy the contents of the other selection to the target selection
CopyLooks:
PROC [target: SelectionId ← primary];
Copy the looks of the other selection to the target selection
CopyFormat:
PROC [target: SelectionId ← primary];
Copy the format of the other selection to the target selection
Transpose:
PROC [target: SelectionId ← primary];
Transpose the contents of the primary and secondary selections
TransposeLooks:
PROC [target: SelectionId ← primary];
Transpose the looks of the primary and secondary selections
TransposeFormat:
PROC [target: SelectionId ← primary];
Transpose the formats of the primary and secondary selections
InsertBrackets:
PROC [left, right:
CHAR];
insert left char at start of selection, right char after selection
SelectMatchingBrackets:
PROC [left, right:
CHAR];
extend selection until includes matching left and right brackets
DoSelectMatchingBrackets:
PROC [left, right:
CHAR]
RETURNS [found:
BOOL];
extend selection until includes matching left and right brackets
NextViewer:
PROC [forward:
BOOL];
move selection to next viewer in left-right, top-bottom order
DoNextViewer: PROC [forward: BOOL] RETURNS [found: BOOL];
FindPlaceholders: PROC [next: BOOL];
DoFindPlaceholders: PROC [next, gotoend: BOOL,
startBoundaryNode, endBoundaryNode: TextNode.Ref ← NIL,
startBoundaryOffset: INT ← 0, endBoundaryOffset: INT ← LAST[INT]
] RETURNS [found, wenttoend: BOOL];
InsertTime:
PROC;
insert the current date and time
Capitalise:
PROC [flavor: TextEdit.CapChange];
Perform the capitalisation operation on the target selection
ModifyOp:
TYPE = {add, remove};
ModifyLook:
PROC [look: TextLooks.Look, op: ModifyOp];
change the looks of a selection
ModifyCaretLook:
PROC [look: TextLooks.Look, op: ModifyOp];
change the looks of a selection caret
ChangeLooks:
PROC [add, remove: TextLooks.Looks];
wholesale change of the selection looks
ChangeCaretLooks:
PROC [add, remove: TextLooks.Looks];
wholesale change of the caret looks
SetStyle:
PROC;
sets style of caret node to word before caret
SetStyleName:
PROC [name:
ROPE, node: TextNode.Ref ←
NIL];
sets style of caret node to given name
if node is nil, sets style for caret node
ReloadStyle:
PROC;
reloads style of caret node
ReloadStyleName:
PROC [name:
ROPE];
reloads named style
SetFormat:
PROC;
sets format of caret node to word before caret
GetFormat:
PROC;
inserts format of caret node
SetFormatName:
PROC [name:
ROPE, node: TextNode.Ref ←
NIL];
sets format of caret node to given name
if node is nil, sets format for caret node
SetCommentProp: PROC [flag: BOOL];
RegisterAbbrevFailedProc:
PROC [proc:
PROC
RETURNS [
BOOL]];
called if ExpandAbbreviation finds an unknown key
call with NIL to unregister
only one proc registered at a time
ExpandAbbreviation:
PROC;
expand abbreviation at insertion point
LoadAbbreviations:
PROC [dictName:
ROPE];
abbreviatiions files are loaded automatically
can call this to force reloading after have changed contents
EditFailed: PROC [msg: ROPE ← NIL];
END.