EditableContent

editable plain text (singleline/multiline)

class EditableContent {}

Constructors

this
this(bool multiline)
Undocumented in source.

Members

Aliases

isAlphaForWordSelection
alias isAlphaForWordSelection = isAlNum
Undocumented in source.
isDigit
alias isDigit = std.uni.isNumber
Undocumented in source.
isUpperAlpha
alias isUpperAlpha = std.uni.isUpper
Undocumented in source.

Functions

appendLines
void appendLines(dstring[] lines)

append one or more lines at end

clear
void clear()

clear content

clearEditMarks
void clearEditMarks()
Undocumented in source. Be warned that the author may not have intended to support it.
clearTokenProps
void clearTokenProps(int startLine, int endLine)

set props arrays size equal to text line sizes, bit fill with unknown token

clearUndo
void clearUndo()

clear undo/redp history

correctPosition
void correctPosition(TextPosition position)

when position is out of content bounds, fix it to nearest valid position

correctRange
void correctRange(TextRange range)

when range positions is out of content bounds, fix it to nearest valid position

editMark
EditStateMark editMark(int index)

returns access to line edit mark by line index (0 based)

fillSpace
dstring fillSpace(int pos)

returns spaces/tabs for filling from the beginning of line to specified position

findMatchedBraces
bool findMatchedBraces(TextPosition p, TextRange range)
Undocumented in source. Be warned that the author may not have intended to support it.
firstNonSpace
TextPosition firstNonSpace(int lineIndex)

returns position before first non-space character of line, returns 0 position if no non-space chars

fullLinesRange
TextRange fullLinesRange(TextRange r)

corrent range to cover full lines

getLineWhiteSpace
LineWhiteSpace getLineWhiteSpace(int lineIndex)
Undocumented in source. Be warned that the author may not have intended to support it.
handleContentChange
void handleContentChange(EditOperation op, TextRange rangeBefore, TextRange rangeAfter, Object source)
Undocumented in source. Be warned that the author may not have intended to support it.
insertLines
void insertLines(int start, int count)

inserts count empty lines at specified position

lastNonSpace
TextPosition lastNonSpace(int lineIndex)

returns position after last non-space character of line, returns 0 position if no non-space chars on line

line
dstring line(int index)

returns line text by index, "" if index is out of bounds

lineBegin
TextPosition lineBegin(int lineIndex)

returns text position for begin of line lineIndex (if lineIndex > number of lines, returns end of last line)

lineEnd
TextPosition lineEnd(int lineIndex)

returns text position for end of line lineIndex

lineIsEmpty
bool lineIsEmpty(int lineIndex)

return true if line with index lineIndex is empty (has length 0 or consists only of spaces and tabs)

lineLength
int lineLength(int lineIndex)

returns text position for end of line lineIndex

lineRange
TextRange lineRange(int lineIndex)

returns text range for whole line lineIndex

lineTokenProps
TokenPropString lineTokenProps(int index)

returns line token properties one item per character (index is 0 based line number)

load
bool load(InputStream f, string fname)

load content form input stream

load
bool load(string filename)

load content from file

markChangedLines
void markChangedLines(int startLine, int endLine)
Undocumented in source. Be warned that the author may not have intended to support it.
maxLineLength
int maxLineLength()

returns maximum length of line

measureLine
TextLineMeasure measureLine(int lineIndex)

measures line non-space start and end positions

moveByWord
TextPosition moveByWord(TextPosition p, int direction, bool camelCasePartsAsWords)

change text position to nearest word bound (direction < 0 - back, > 0 - forward)

nextCharPos
TextPosition nextCharPos(TextPosition p)

returns previous character position

nextTab
int nextTab(int pos)

find nearest next tab position

notifyContentReplaced
void notifyContentReplaced()

call listener to say that whole content is replaced e.g. by loading from file

notifyContentSaved
void notifyContentSaved()

call listener to say that content is saved

opIndex
dstring opIndex(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
dchar opIndex(int lineIndex, int pos)

returns character at position lineIndex, pos

opIndex
dchar opIndex(TextPosition p)

returns character at position lineIndex, pos

performOperation
bool performOperation(EditOperation op, Object source)

edit content

prevCharPos
TextPosition prevCharPos(TextPosition p)

returns previous character position

rangeMarks
EditStateMark[] rangeMarks(TextRange range)

return edit marks for specified range

rangeText
dstring[] rangeText(TextRange range)

return text for specified range

redo
bool redo(Object source)

redoes last undone change

removeLines
void removeLines(int start, int removedCount)

removes removedCount lines starting from start

replaceRange
void replaceRange(TextRange before, TextRange after, dstring[] newContent, EditStateMark[] marks)

inserts or removes lines, removes text in range

save
bool save(OutputStream stream, string filename, TextFileFormat format)

save to output stream in specified format

save
bool save(OutputStream stream, string filename)

save to output stream in current format

save
bool save(string filename, TextFileFormat format)

save to file in specified format

save
bool save(string filename)

save to file in current format

tokenProp
TokenProp tokenProp(TextPosition p)

returns token properties character position

undo
bool undo(Object source)

undoes last change

updateTokenProps
void updateTokenProps(int startLine, int endLine)
Undocumented in source. Be warned that the author may not have intended to support it.
wordBounds
TextRange wordBounds(TextPosition pos)

get word bounds by position

Properties

editMarks
EditStateMark[] editMarks [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
endOfFile
TextPosition endOfFile [@property getter]

returns position for end of last line

filename
string filename [@property getter]

file used to load editor content

hasRedo
bool hasRedo [@property getter]

return true if there is at least one operation in redo buffer

hasSyntaxHighlight
bool hasSyntaxHighlight [@property getter]

returns true if content has syntax highlight handler set

hasUndo
bool hasUndo [@property getter]

return true if there is at least one operation in undo buffer

length
int length [@property getter]

returns line count

lineIcons
LineIcons lineIcons [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
lines
const(dstring[]) lines [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
modified
bool modified [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
multiline
bool multiline [@property getter]

returns true if miltyline content is supported

readOnly
bool readOnly [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
readOnly
bool readOnly [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
smartIndents
bool smartIndents [@property getter]

true if smart indents are enabled

smartIndents
bool smartIndents [@property setter]

set smart indents enabled flag

smartIndentsAfterPaste
bool smartIndentsAfterPaste [@property getter]

true if smart indents are enabled

smartIndentsAfterPaste
bool smartIndentsAfterPaste [@property setter]

set smart indents enabled flag

supportsSmartIndents
bool supportsSmartIndents [@property getter]

true if smart indents are supported

syntaxSupport
SyntaxSupport syntaxSupport [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
syntaxSupport
SyntaxSupport syntaxSupport [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
tabSize
int tabSize [@property getter]

returns tab size (in number of spaces)

tabSize
int tabSize [@property setter]

sets tab size (in number of spaces)

text
dstring text [@property getter]

returns all lines concatenated delimited by '\n'

text
dstring text [@property setter]

replace whole text with another content

useSpacesForTabs
bool useSpacesForTabs [@property getter]

when true, spaces will be inserted instead of tabs

useSpacesForTabs
bool useSpacesForTabs [@property setter]

set new Tab key behavior flag: when true, spaces will be inserted instead of tabs

Static functions

isAlNum
bool isAlNum(dchar ch)
Undocumented in source. Be warned that the author may not have intended to support it.
isAlpha
bool isAlpha(dchar ch)
Undocumented in source. Be warned that the author may not have intended to support it.
isBracket
bool isBracket(dchar ch)
Undocumented in source. Be warned that the author may not have intended to support it.
isLowerAlpha
bool isLowerAlpha(dchar ch)
Undocumented in source. Be warned that the author may not have intended to support it.
isPunct
bool isPunct(dchar ch)
Undocumented in source. Be warned that the author may not have intended to support it.
isWordBound
bool isWordBound(dchar thischar, dchar nextchar)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

LineWhiteSpace
struct LineWhiteSpace

to return information about line space positions

Variables

_editMarks
EditStateMark[] _editMarks;

line edit marks

_filename
string _filename;
Undocumented in source.
_format
TextFileFormat _format;
Undocumented in source.
_lineIcons
LineIcons _lineIcons;
Undocumented in source.
_lines
dstring[] _lines;

text content by lines

_multiline
bool _multiline;
Undocumented in source.
_readOnly
bool _readOnly;
Undocumented in source.
_smartIndents
bool _smartIndents;
Undocumented in source.
_smartIndentsAfterPaste
bool _smartIndentsAfterPaste;
Undocumented in source.
_syntaxSupport
SyntaxSupport _syntaxSupport;
Undocumented in source.
_tabSize
int _tabSize;
Undocumented in source.
_tokenProps
TokenPropString[] _tokenProps;

token properties by lines - for syntax highlight

_undoBuffer
UndoBuffer _undoBuffer;
Undocumented in source.
_useSpacesForTabs
bool _useSpacesForTabs;
Undocumented in source.
contentChanged
Signal!EditableContentListener contentChanged;

listeners for edit operations

marksChanged
Signal!EditableContentMarksChangeListener marksChanged;

listeners for mark changes after edit operation

Meta