Class EditableContent
editable plain text (singleline/multiline)
class EditableContent;
Constructors
| Name | Description |
|---|---|
this
(multiline)
|
Fields
| Name | Type | Description |
|---|---|---|
contentChanged
|
Signal!(dcanvas.core.editable.EditableContentListener) | listeners for edit operations |
marksChanged
|
Signal!(dcanvas.core.editable.EditableContentMarksChangeListener) | listeners for mark changes after edit operation |
_editMarks
|
EditStateMark[] | line edit marks |
_filename
|
string | |
_format
|
TextFileFormat | |
_lineIcons
|
LineIcons | |
_lines
|
dstring[] | text content by lines |
_multiline
|
bool | |
_readOnly
|
bool | |
_smartIndents
|
bool | |
_smartIndentsAfterPaste
|
bool | |
_syntaxSupport
|
SyntaxSupport | |
_tabSize
|
int | |
_tokenProps
|
ubyte[][] | token properties by lines - for syntax highlight |
_undoBuffer
|
UndoBuffer | |
_useSpacesForTabs
|
bool |
Properties
| Name | Type | Description |
|---|---|---|
editMarks[get]
|
EditStateMark[] | |
endOfFile[get]
|
TextPosition | returns position for end of last line |
filename[get]
|
string | file used to load editor content |
hasRedo[get]
|
bool | return true if there is at least one operation in redo buffer |
hasSyntaxHighlight[get]
|
bool | returns true if content has syntax highlight handler set |
hasUndo[get]
|
bool | return true if there is at least one operation in undo buffer |
length[get]
|
int | returns line count |
lineIcons[get]
|
LineIcons | |
lines[get]
|
const(dstring[]) | |
modified[get]
|
bool | |
multiline[get]
|
bool | returns true if miltyline content is supported |
readOnly[get]
|
bool | |
readOnly[set]
|
bool | |
smartIndents[get]
|
bool | true if smart indents are enabled |
smartIndents[set]
|
EditableContent | set smart indents enabled flag |
smartIndentsAfterPaste[get]
|
bool | true if smart indents are enabled |
smartIndentsAfterPaste[set]
|
EditableContent | set smart indents enabled flag |
supportsSmartIndents[get]
|
bool | true if smart indents are supported |
syntaxSupport[get]
|
SyntaxSupport | |
syntaxSupport[set]
|
EditableContent | |
tabSize[get]
|
int | returns tab size (in number of spaces) |
tabSize[set]
|
EditableContent | sets tab size (in number of spaces) |
text[get]
|
dstring | returns all lines concatenated delimited by '\n' |
text[set]
|
EditableContent | replace whole text with another content |
useSpacesForTabs[get]
|
bool | when true, spaces will be inserted instead of tabs |
useSpacesForTabs[set]
|
EditableContent | set new Tab key behavior flag: when true, spaces will be inserted instead of tabs |
Methods
| Name | Description |
|---|---|
appendLines
(lines)
|
append one or more lines at end |
clear
()
|
clear content |
clearEditMarks
()
|
|
clearUndo
()
|
clear undo/redp history |
correctPosition
(position)
|
when position is out of content bounds, fix it to nearest valid position |
correctRange
(range)
|
when range positions is out of content bounds, fix it to nearest valid position |
editMark
(index)
|
returns access to line edit mark by line index (0 based) |
fillSpace
(pos)
|
returns spaces/tabs for filling from the beginning of line to specified position |
findMatchedBraces
(p, range)
|
|
firstNonSpace
(lineIndex)
|
returns position before first non-space character of line, returns 0 position if no non-space chars |
fullLinesRange
(r)
|
corrent range to cover full lines |
getLineWhiteSpace
(lineIndex)
|
|
handleContentChange
(op, rangeBefore, rangeAfter, source)
|
|
isAlNum
(ch)
|
|
isAlpha
(ch)
|
|
isBracket
(ch)
|
|
isLowerAlpha
(ch)
|
|
isPunct
(ch)
|
|
isWordBound
(thischar, nextchar)
|
|
lastNonSpace
(lineIndex)
|
returns position after last non-space character of line, returns 0 position if no non-space chars on line |
line
(index)
|
returns line text by index, "" if index is out of bounds |
lineBegin
(lineIndex)
|
returns text position for begin of line lineIndex (if lineIndex > number of lines, returns end of last line) |
lineEnd
(lineIndex)
|
returns text position for end of line lineIndex |
lineIsEmpty
(lineIndex)
|
return true if line with index lineIndex is empty (has length 0 or consists only of spaces and tabs) |
lineLength
(lineIndex)
|
returns text position for end of line lineIndex |
lineRange
(lineIndex)
|
returns text range for whole line lineIndex |
lineTokenProps
(index)
|
returns line token properties one item per character (index is 0 based line number) |
load
(f, fname)
|
load content form input stream |
load
(filename)
|
load content from file |
maxLineLength
()
|
returns maximum length of line |
measureLine
(lineIndex)
|
measures line non-space start and end positions |
moveByWord
(p, direction, camelCasePartsAsWords)
|
change text position to nearest word bound (direction < 0 - back, > 0 - forward) |
nextCharPos
(p)
|
returns previous character position |
nextTab
(pos)
|
find nearest next tab position |
notifyContentReplaced
()
|
call listener to say that whole content is replaced e.g. by loading from file |
notifyContentSaved
()
|
call listener to say that content is saved |
opIndex
(index)
|
|
opIndex
(lineIndex, pos)
|
returns character at position lineIndex, pos |
performOperation
(op, source)
|
edit content |
prevCharPos
(p)
|
returns previous character position |
rangeMarks
(range)
|
return edit marks for specified range |
rangeText
(range)
|
return text for specified range |
redo
(source)
|
redoes last undone change |
save
(stream, filename, format)
|
save to output stream in specified format |
save
(stream, filename)
|
save to output stream in current format |
save
(filename, format)
|
save to file in specified format |
save
(filename)
|
save to file in current format |
tokenProp
(p)
|
returns token properties character position |
undo
(source)
|
undoes last change |
wordBounds
(pos)
|
get word bounds by position |
clearTokenProps
(startLine, endLine)
|
set props arrays size equal to text line sizes, bit fill with unknown token |
insertLines
(start, count)
|
inserts count empty lines at specified position |
markChangedLines
(startLine, endLine)
|
|
removeLines
(start, removedCount)
|
removes removedCount lines starting from start |
replaceRange
(before, after, newContent, marks)
|
inserts or removes lines, removes text in range |
updateTokenProps
(startLine, endLine)
|
Inner structs
| Name | Description |
|---|---|
LineWhiteSpace
|
to return information about line space positions |
Aliases
| Name | Description |
|---|---|
isAlphaForWordSelection
|
|
isDigit
|
|
isUpperAlpha
|
|
~this
|