TextRequest, replaceAll, et al

Types

data TextRequest a = ReplaceText Int Int [a] | HighlightText [Int] | PickText Int
replaceAll :: [a] -> TextRequest a
replaceAllFrom :: Int -> [a] -> TextRequest a
deleteText :: Int -> Int -> TextRequest a
insertText :: Int -> [a] -> TextRequest a
appendText :: [a] -> TextRequest a
changeText :: Int -> [a] -> TextRequest a
replaceText :: Int -> Int -> [a] -> TextRequest a
highlightText :: [Int] -> TextRequest a
pickText :: Int -> TextRequest a
doTextRequest :: [a] -> TextRequest a -> [a]

Description

TextRequest is the type of messages accepted by textF, pickListF et al. These fudgets display lines of strings (called text), which can be changed by TextRequest messages.

replaceAll text replaces all the text with a new text. Each element in the list text corresponds to one displayed line.

replaceAllFrom from text replaces all lines from from with text. The first line is numbered 0.

deleteText from count deletes count lines starting at from.

insertText at text inserts text before line at.

appendText text appends text after the last line of the old text.

changeText at text replaces the same number of lines at line at as there are lines in text with text. If at is so close to the end that there isn't enough lines to replace, the rest of text is appended.

replaceText from to text replaces the lines between and including from and to with text.

highlightText lines will highlight all lines included in lines, and dehighlight the rest.

pickText at is used to simulate that the user has clicked on line at.

doTextRequest text request returns the result of performing request on text.

See Also

textF.

Bugs

TextRequest should be an abstract type.