Class EditableContent

editable plain text (singleline/multiline)

Inherits from

  • Object (base class)

Constructors

Name Description
this

Fields

Name Type Description
contentChanged Signal!(dlangui.core.editable.EditableContentListener) listeners for edit operations
marksChanged Signal!(dlangui.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 text
lineIcons [get] LineIcons
lines [get] const(dstring[])
modified [get] bool
multiline [get] bool returns true if miltyline content is supported
readOnly [set] bool
readOnly [get] 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 [set] EditableContent replace whole text with another content
text [get] dstring returns all lines concatenated delimited by '\n'
useSpacesForTabs [set] EditableContent set new Tab key behavior flag: when true, spaces will be inserted instead of tabs
useSpacesForTabs [get] bool when true, spaces will be inserted instead of tabs

Methods

Name Description
appendLines append one or more lines at end
clear clear content
clearEditMarks
clearUndo clear undo/redp history
correctPosition when position is out of content bounds, fix it to nearest valid position
correctRange when range positions is out of content bounds, fix it to nearest valid position
editMark returns access to line edit mark by line index (0 based)
fillSpace returns spaces/tabs for filling from the beginning of line to specified position
findMatchedBraces
firstNonSpace returns position before first non-space character of line, returns 0 position if no non-space chars
fullLinesRange corrent range to cover full lines
handleContentChange
isAlNum
isAlpha
isBracket
isLowerAlpha
isPunct
isWordBound
lastNonSpace returns position after last non-space character of line, returns 0 position if no non-space chars on line
line returns line text by index, "" if index is out of bounds
lineBegin returns text position for begin of line lineIndex (if lineIndex > number of lines, returns end of last line)
lineEnd returns text position for end of line lineIndex
lineIsEmpty return true if line with index lineIndex is empty (has length 0 or consists only of spaces and tabs)
lineLength returns text position for end of line lineIndex
lineRange returns text range for whole line lineIndex
lineTokenProps returns line token properties one item per character (index is 0 based line number)
load load content form input stream
load load content from file
maxLineLength returns maximum length of line
measureLine measures line non-space start and end positions
moveByWord change text position to nearest word bound (direction < 0 - back, > 0 - forward)
nextCharPos returns previous character position
nextTab 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 returns character at position lineIndex, pos
opIndex
opIndex returns character at position lineIndex, pos
performOperation edit content
prevCharPos returns previous character position
rangeMarks return edit marks for specified range
rangeText return text for specified range
redo redoes last undone change
save save to output stream in specified format
save save to output stream in current format
save save to file in specified format
save save to file in current format
tokenProp returns token properties character position
undo undoes last change
wordBounds get word bounds by position
clearTokenProps set props arrays size equal to text line sizes, bit fill with unknown token
insertLines inserts count empty lines at specified position
markChangedLines
removeLines removes removedCount lines starting from start
replaceRange inserts or removes lines, removes text in range
updateTokenProps

Aliases

Name Description
isAlphaForWordSelection
isDigit
isUpperAlpha

Authors

Vadim Lopatin, coolreader.org@gmail.com

Copyright

Vadim Lopatin, 2014

License

Boost License 1.0