EdText.dcl 999 Bytes
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1
2
3
4
5
6
/*
 * EdText.dcl: operations on text areas (extends EdLineText)
 */

definition module EdText

7

Diederik van Arkel's avatar
Diederik van Arkel committed
8
import StdMaybe
9
from EdSelection import :: Selection, :: Position, :: ColumnNr, :: LineNr
Diederik van Arkel's avatar
Diederik van Arkel committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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.