EditLine

single line editor

Constructors

this
this()

empty parameter list constructor - for usage by factory

this
this(string ID, dstring initialContent)

create with ID parameter

Members

Functions

applyPasswordChar
dstring applyPasswordChar(dstring s)
Undocumented in source. Be warned that the author may not have intended to support it.
clientToTextPos
TextPosition clientToTextPos(Point pt)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLineBackground
void drawLineBackground(DrawBuf buf, Rect lineRect, Rect visibleRect)

override to custom highlight of line background

ensureCaretVisible
void ensureCaretVisible(bool center)
Undocumented in source. Be warned that the author may not have intended to support it.
handleAction
bool handleAction(Action a)
Undocumented in source. Be warned that the author may not have intended to support it.
layout
void layout(Rect rc)

Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).

measure
void measure(int parentWidth, int parentHeight)

measure

measureTextToSetWidgetSize
Point measureTextToSetWidgetSize()
Undocumented in source. Be warned that the author may not have intended to support it.
measureVisibleText
Point measureVisibleText()
Undocumented in source. Be warned that the author may not have intended to support it.
onDraw
void onDraw(DrawBuf buf)

draw content

onKeyEvent
bool onKeyEvent(KeyEvent event)

handle keys

onMouseEvent
bool onMouseEvent(MouseEvent event)

process mouse event; return true if event is processed by widget.

setDefaultPopupMenu
EditLine setDefaultPopupMenu()

sets default popup menu with copy/paste/cut/undo/redo

textPosToClient
Rect textPosToClient(TextPosition p)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

passwordChar
dchar passwordChar [@property getter]

password character - 0 for normal editor, some character, e.g. '*' to hide text by replacing all characters with this char

passwordChar
dchar passwordChar [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
textToSetWidgetSize
dstring textToSetWidgetSize [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
textToSetWidgetSize
dstring textToSetWidgetSize [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_measuredText
dstring _measuredText;
Undocumented in source.
_measuredTextSize
Point _measuredTextSize;
Undocumented in source.
_measuredTextToSetWidgetSize
Point _measuredTextToSetWidgetSize;
Undocumented in source.
_measuredTextToSetWidgetSizeWidths
int[] _measuredTextToSetWidgetSizeWidths;
Undocumented in source.
_measuredTextWidths
int[] _measuredTextWidths;
Undocumented in source.
_passwordChar
dchar _passwordChar;
Undocumented in source.
_textToSetWidgetSize
dstring _textToSetWidgetSize;
Undocumented in source.
editorAction
Signal!EditorActionHandler editorAction;
Undocumented in source.
enterKey
Signal!EnterKeyHandler enterKey;

handle Enter key press inside line editor

Inherited Members

From EditWidgetBase

_content
EditableContent _content;
Undocumented in source.
_lineHeight
int _lineHeight;
Undocumented in source.
_scrollPos
Point _scrollPos;
Undocumented in source.
_fixedFont
bool _fixedFont;
Undocumented in source.
_spaceWidth
int _spaceWidth;
Undocumented in source.
_leftPaneWidth
int _leftPaneWidth;
Undocumented in source.
_minFontSize
int _minFontSize;
Undocumented in source.
_maxFontSize
int _maxFontSize;
Undocumented in source.
_wantTabs
bool _wantTabs;
Undocumented in source.
_showLineNumbers
bool _showLineNumbers;
Undocumented in source.
_showModificationMarks
bool _showModificationMarks;
Undocumented in source.
_showIcons
bool _showIcons;
Undocumented in source.
_showFolding
bool _showFolding;
Undocumented in source.
_lineNumbersWidth
int _lineNumbersWidth;
Undocumented in source.
_modificationMarksWidth
int _modificationMarksWidth;
Undocumented in source.
_iconsWidth
int _iconsWidth;
Undocumented in source.
_foldingWidth
int _foldingWidth;
Undocumented in source.
_selectAllWhenFocusedWithTab
bool _selectAllWhenFocusedWithTab;
Undocumented in source.
_deselectAllWhenUnfocused
bool _deselectAllWhenUnfocused;
Undocumented in source.
_replaceMode
bool _replaceMode;
Undocumented in source.
_selectionColorFocused
uint _selectionColorFocused;
Undocumented in source.
_selectionColorNormal
uint _selectionColorNormal;
Undocumented in source.
_searchHighlightColorCurrent
uint _searchHighlightColorCurrent;
Undocumented in source.
_searchHighlightColorOther
uint _searchHighlightColorOther;
Undocumented in source.
_leftPaneBackgroundColor
uint _leftPaneBackgroundColor;
Undocumented in source.
_leftPaneBackgroundColor2
uint _leftPaneBackgroundColor2;
Undocumented in source.
_leftPaneBackgroundColor3
uint _leftPaneBackgroundColor3;
Undocumented in source.
_leftPaneLineNumberColor
uint _leftPaneLineNumberColor;
Undocumented in source.
_leftPaneLineNumberColorEdited
uint _leftPaneLineNumberColorEdited;
Undocumented in source.
_leftPaneLineNumberColorSaved
uint _leftPaneLineNumberColorSaved;
Undocumented in source.
_leftPaneLineNumberColorCurrentLine
uint _leftPaneLineNumberColorCurrentLine;
Undocumented in source.
_leftPaneLineNumberBackgroundColorCurrentLine
uint _leftPaneLineNumberBackgroundColorCurrentLine;
Undocumented in source.
_leftPaneLineNumberBackgroundColor
uint _leftPaneLineNumberBackgroundColor;
Undocumented in source.
_colorIconBreakpoint
uint _colorIconBreakpoint;
Undocumented in source.
_colorIconBookmark
uint _colorIconBookmark;
Undocumented in source.
_colorIconError
uint _colorIconError;
Undocumented in source.
_caretColor
uint _caretColor;
Undocumented in source.
_caretColorReplace
uint _caretColorReplace;
Undocumented in source.
_matchingBracketHightlightColor
uint _matchingBracketHightlightColor;
Undocumented in source.
_iconsPaneWidth
uint _iconsPaneWidth;
Undocumented in source.
_foldingPaneWidth
uint _foldingPaneWidth;
Undocumented in source.
_modificationMarksPaneWidth
uint _modificationMarksPaneWidth;
Undocumented in source.
_contentChanged
bool _contentChanged;

when true, call measureVisibileText on next layout

_copyCurrentLineWhenNoSelection
bool _copyCurrentLineWhenNoSelection;
Undocumented in source.
copyCurrentLineWhenNoSelection
bool copyCurrentLineWhenNoSelection [@property getter]

when true allows copy / cut whole current line if there is no selection

copyCurrentLineWhenNoSelection
bool copyCurrentLineWhenNoSelection [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
_showTabPositionMarks
bool _showTabPositionMarks;
Undocumented in source.
showTabPositionMarks
bool showTabPositionMarks [@property getter]

when true shows mark on tab positions in beginning of line

showTabPositionMarks
bool showTabPositionMarks [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
modifiedStateChange
Signal!ModifiedStateListener modifiedStateChange;

Modified state change listener (e.g. content has been saved, or first time modified after save)

contentChange
Signal!EditableContentChangeListener contentChange;

Signal to emit when editor content is changed

editorStateChange
Signal!EditorStateListener editorStateChange;

Signal to emit when editor cursor position or Insert/Replace mode is changed.

setFocus
Widget setFocus(FocusReason reason)

sets focus to this widget or suitable focusable child, returns previously focused widget

handleEditorStateChange
void handleEditorStateChange()

updates editorStateChange with recent position

handleClientRectLayout
void handleClientRectLayout(Rect rc)

override to support modification of client rect after change, e.g. apply offset

lineCount
int lineCount()

override for multiline editors

wordWrapRefresh
void wordWrapRefresh()

Override for EditBox

previousXScrollPos
int previousXScrollPos;

To hold _scrollpos.x toggling between normal and word wrap mode

_wordWrap
bool _wordWrap;
Undocumented in source.
wordWrap
bool wordWrap [@property getter]

true if word wrap mode is set

wordWrap
bool wordWrap [@property setter]

true if word wrap mode is set

splitChars
dchar[] splitChars;

Characters at which content is split for word wrap mode

wrapLine
dstring[] wrapLine(dstring str, int lineNumber)

Divides up a string for word wrapping, sets info in _span

explode
dstring[] explode(dstring str, dchar[] splitChars)

Divide (and conquer) text into words

_span
LineSpan[] _span;

information about line span into several lines - in word wrap mode

_spanCache
LineSpan[] _spanCache;
Undocumented in source.
findWrapPoint
int findWrapPoint(dstring text)

Finds good visual wrapping point for string

measureWrappedText
int measureWrappedText(dstring text)

Calls measureText for word wrap

wrapsUpTo
int wrapsUpTo(int line)

Returns number of visible wraps up to a line (not including the first wrapLines themselves)

getSpan
LineSpan getSpan(int lineNumber)

Returns LineSpan for line based on actual line number

findWrapLine
int findWrapLine(TextPosition textPos)

Based on a TextPosition, finds which wrapLine it is on for its current line

lineSpanIterate
void lineSpanIterate(void delegate(LineSpan curSpan) iterator)

Simple way of iterating through _span

updateLeftPaneWidth
void updateLeftPaneWidth()

override to add custom items on left panel

drawLeftPaneFolding
void drawLeftPaneFolding(DrawBuf buf, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLeftPaneIcon
void drawLeftPaneIcon(DrawBuf buf, Rect rc, LineIcon icon)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLeftPaneIcons
void drawLeftPaneIcons(DrawBuf buf, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLeftPaneModificationMarks
void drawLeftPaneModificationMarks(DrawBuf buf, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLeftPaneLineNumbers
void drawLeftPaneLineNumbers(DrawBuf buf, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
onLeftPaneMouseClick
bool onLeftPaneMouseClick(MouseEvent event)
Undocumented in source. Be warned that the author may not have intended to support it.
handleLeftPaneFoldingMouseClick
bool handleLeftPaneFoldingMouseClick(MouseEvent event, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
handleLeftPaneModificationMarksMouseClick
bool handleLeftPaneModificationMarksMouseClick(MouseEvent event, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
handleLeftPaneLineNumbersMouseClick
bool handleLeftPaneLineNumbersMouseClick(MouseEvent event, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
getLeftPaneIconsPopupMenu
MenuItem getLeftPaneIconsPopupMenu(int line)
Undocumented in source. Be warned that the author may not have intended to support it.
handleLeftPaneIconsMouseClick
bool handleLeftPaneIconsMouseClick(MouseEvent event, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
handleLeftPaneMouseClick
bool handleLeftPaneMouseClick(MouseEvent event, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLeftPane
void drawLeftPane(DrawBuf buf, Rect rc, int line)
Undocumented in source. Be warned that the author may not have intended to support it.
onMenuItemAction
bool onMenuItemAction(Action action)
canShowPopupMenu
bool canShowPopupMenu(int x, int y)

returns true if widget can show popup (e.g. by mouse right click at point x,y)

canFocus
bool canFocus [@property getter]

returns true if widget is focusable and visible and enabled

isActionEnabled
bool isActionEnabled(Action action)

override to change popup menu items state

showPopupMenu
void showPopupMenu(int x, int y)

shows popup at (x,y)

onPopupMenuItem
void onPopupMenuItem(MenuItem item)
Undocumented in source. Be warned that the author may not have intended to support it.
getCursorType
uint getCursorType(int x, int y)

returns mouse cursor type for widget

wantTabs
bool wantTabs [@property getter]
bool wantTabs [@property setter]

when true, Tab / Shift+Tab presses are processed internally in widget (e.g. insert tab character) instead of focus change navigation.

showIcons
bool showIcons [@property getter]

when true, show icons like bookmarks or breakpoints at the left

showIcons
bool showIcons [@property setter]

when true, show icons like bookmarks or breakpoints at the left

showFolding
bool showFolding [@property getter]

when true, show folding controls at the left

showFolding
bool showFolding [@property setter]

when true, show folding controls at the left

showModificationMarks
bool showModificationMarks [@property getter]

when true, show modification marks for lines (whether line is unchanged/modified/modified_saved)

showModificationMarks
bool showModificationMarks [@property setter]

when true, show modification marks for lines (whether line is unchanged/modified/modified_saved)

showLineNumbers
bool showLineNumbers [@property getter]

when true, line numbers are shown

showLineNumbers
bool showLineNumbers [@property setter]

when true, line numbers are shown

readOnly
bool readOnly [@property getter]

readonly flag (when true, user cannot change content of editor)

readOnly
bool readOnly [@property setter]

sets readonly flag

replaceMode
bool replaceMode [@property getter]

replace mode flag (when true, entered character replaces character under cursor)

replaceMode
bool replaceMode [@property setter]

sets replace mode flag

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

tabSize
int tabSize [@property getter]

returns tab size (in number of spaces)

tabSize
int tabSize [@property setter]

sets tab size (in number of spaces)

supportsSmartIndents
bool supportsSmartIndents [@property getter]

true if smart indents are supported

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

content
EditableContent content [@property getter]

editor content object

_ownContent
bool _ownContent;

when _ownContent is false, _content should not be destroyed in editor destructor

content
EditableContent content [@property setter]

set content object

~this
~this()

free resources

updateMaxLineWidth
void updateMaxLineWidth()
Undocumented in source. Be warned that the author may not have intended to support it.
processSmartIndent
void processSmartIndent(EditOperation operation)
Undocumented in source. Be warned that the author may not have intended to support it.
onContentChange
void onContentChange(EditableContent content, EditOperation operation, TextRange rangeBefore, TextRange rangeAfter, Object source)
Undocumented in source. Be warned that the author may not have intended to support it.
_lastReportedModifiedState
bool _lastReportedModifiedState;
Undocumented in source.
text
dstring text [@property getter]

get widget text

text
dstring text [@property setter]

set text

text
UIString text [@property setter]

set text

_caretPos
TextPosition _caretPos;
Undocumented in source.
_selectionRange
TextRange _selectionRange;
Undocumented in source.
textPosToClient
Rect textPosToClient(TextPosition p)
Undocumented in source.
clientToTextPos
TextPosition clientToTextPos(Point pt)
Undocumented in source.
ensureCaretVisible
void ensureCaretVisible(bool center)
Undocumented in source.
measureVisibleText
Point measureVisibleText()
Undocumented in source.
_caretBlingingInterval
int _caretBlingingInterval;
Undocumented in source.
_caretTimerId
ulong _caretTimerId;
Undocumented in source.
_caretBlinkingPhase
bool _caretBlinkingPhase;
Undocumented in source.
_lastBlinkStartTs
long _lastBlinkStartTs;
Undocumented in source.
_caretBlinks
bool _caretBlinks;
Undocumented in source.
showCaretBlinking
bool showCaretBlinking [@property setter]

when true, enables caret blinking, otherwise it's always visible

showCaretBlinking
bool showCaretBlinking [@property getter]

when true, enables caret blinking, otherwise it's always visible

startCaretBlinking
void startCaretBlinking()
Undocumented in source. Be warned that the author may not have intended to support it.
stopCaretBlinking
void stopCaretBlinking()
Undocumented in source. Be warned that the author may not have intended to support it.
onTimer
bool onTimer(ulong id)

handle timer; return true to repeat timer event after next interval, false cancel timer

handleFocusChange
void handleFocusChange(bool focused, bool receivedFocusFromKeyboard)

override to handle focus changes

caretHeightOffset
int caretHeightOffset;
Undocumented in source.
caretRect
Rect caretRect()

returns cursor rectangle

onThemeChanged
void onThemeChanged()

handle theme change: e.g. reload some themed resources

drawCaret
void drawCaret(DrawBuf buf)

draws caret

updateFontProps
void updateFontProps()
Undocumented in source. Be warned that the author may not have intended to support it.
correctCaretPos
void correctCaretPos()

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

calcLineWidth
int calcLineWidth(dstring s)
Undocumented in source. Be warned that the author may not have intended to support it.
updateSelectionAfterCursorMovement
void updateSelectionAfterCursorMovement(TextPosition oldCaretPos, bool selecting)
Undocumented in source. Be warned that the author may not have intended to support it.
_textToHighlight
dstring _textToHighlight;
Undocumented in source.
_textToHighlightOptions
uint _textToHighlightOptions;
Undocumented in source.
textToHighlight
dstring textToHighlight [@property getter]

text pattern to highlight - e.g. for search

setTextToHighlight
void setTextToHighlight(dstring pattern, uint textToHighlightOptions)

set text to highlight -- e.g. for search

wordWrapMouseOffset
TextPosition wordWrapMouseOffset(int x, int y)

Used instead of using clientToTextPos for mouse input when in word wrap mode

selectWordByMouse
void selectWordByMouse(int x, int y)
Undocumented in source. Be warned that the author may not have intended to support it.
selectLineByMouse
void selectLineByMouse(int x, int y, bool onSameLineOnly)
Undocumented in source. Be warned that the author may not have intended to support it.
updateCaretPositionByMouse
void updateCaretPositionByMouse(int x, int y, bool selecting)
Undocumented in source. Be warned that the author may not have intended to support it.
spacesForTab
dstring spacesForTab(int currentPos)

generate string of spaces, to reach next tab position

multipleLinesSelected
bool multipleLinesSelected()

returns true if one or more lines selected fully

_camelCasePartsAsWords
bool _camelCasePartsAsWords;
Undocumented in source.
replaceSelectionText
void replaceSelectionText(dstring newText)
Undocumented in source. Be warned that the author may not have intended to support it.
removeSelectionTextIfSelected
bool removeSelectionTextIfSelected()
Undocumented in source. Be warned that the author may not have intended to support it.
getSelectedText
dstring getSelectedText()

returns current selection text (joined with LF when span over multiple lines)

getRangeText
dstring getRangeText(TextRange range)

returns text for specified range (joined with LF when span over multiple lines)

currentLineRange
TextRange currentLineRange [@property getter]

returns range for line with cursor

clearSelection
void clearSelection()

clears selection (don't change text, just unselect)

removeRangeText
bool removeRangeText(TextRange range)
Undocumented in source. Be warned that the author may not have intended to support it.
selectionRange
TextRange selectionRange [@property getter]

returns current selection range

selectionRange
TextRange selectionRange [@property setter]

sets current selection range

handleActionStateRequest
bool handleActionStateRequest(Action a)

override to handle specific actions state (e.g. change enabled state for supported actions)

handleAction
bool handleAction(Action a)
Undocumented in source. Be warned that the author may not have intended to support it.
selectAll
void selectAll()

Select whole text

spaceBefore
TextRange spaceBefore(TextPosition pos)
Undocumented in source. Be warned that the author may not have intended to support it.
indentLine
dstring indentLine(dstring src, bool back, TextPosition* cursorPos)

change line indent

indentRange
void indentRange(bool back)

indent / unindent range

findKeyAction
Action findKeyAction(uint keyCode, uint flags)

map key to action

isAZaz
bool isAZaz(dchar ch)
Undocumented in source. Be warned that the author may not have intended to support it.
onKeyEvent
bool onKeyEvent(KeyEvent event)

handle keys

onControlClick
void onControlClick()

Handle Ctrl + Left mouse click on text

_hoverTextPosition
TextPosition _hoverTextPosition;
Undocumented in source.
_hoverMousePosition
Point _hoverMousePosition;
Undocumented in source.
_hoverTimer
ulong _hoverTimer;
Undocumented in source.
_hoverTimeoutMillis
long _hoverTimeoutMillis;
Undocumented in source.
onHoverTimeout
void onHoverTimeout(Point pt, TextPosition pos)

override to handle mouse hover timeout in text

onHover
void onHover(Point pos)
Undocumented in source. Be warned that the author may not have intended to support it.
cancelHoverTimer
void cancelHoverTimer()
Undocumented in source. Be warned that the author may not have intended to support it.
onMouseEvent
bool onMouseEvent(MouseEvent event)

process mouse event; return true if event is processed by widget.

caretPos
TextPosition caretPos [@property getter]

returns caret position

setCaretPos
void setCaretPos(int line, int column, bool makeVisible, bool center)

change caret position and ensure it is visible

Meta