EdText.dcl 979 Bytes
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1
2
definition module EdText

3
// operations on text areas (extends EdLineText)
4

Diederik van Arkel's avatar
Diederik van Arkel committed
5
import StdMaybe
6
from EdSelection import :: Selection, :: Position, :: ColumnNr, :: LineNr
Diederik van Arkel's avatar
Diederik van Arkel committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import EdLineText

getTextFragment	:: !Selection				!Text -> (!TextFragment, !Text)
removeText		:: !Selection				!Text -> (Maybe Int,		 Text)
insertText		:: !Position !TextFragment	!Text -> (Maybe Int,		 Text)
replaceText		:: !Selection !TextFragment !Text -> !Text
appendText		:: !TextFragment			!Text -> Text

// getSelection:	returns the text fragment that is denoted
//					by the selection argument. The text is also returned, 
//					because in some implementations it may change.
//					E.g. the current implementation 
//					maintains a focus on the text to speed up operations
//					that occur nearby each other (very common in editing).
// removeSelection: removes the part of the text that is indicated 
//					by the selection.
// insertText:		inserts a text fragment in a text at a given position.