diff --git a/src/dlangui/core/editable.d b/src/dlangui/core/editable.d index 7c310ea8..50474c7a 100644 --- a/src/dlangui/core/editable.d +++ b/src/dlangui/core/editable.d @@ -89,7 +89,9 @@ enum TokenCategory : ubyte { /// invalid identifier token - error occured while parsing identifier Error_InvalidIdentifier = (15 << TOKEN_CATEGORY_SHIFT) | 4, /// invalid comment token - error occured while parsing comment - Error_InvalidComment = (15 << TOKEN_CATEGORY_SHIFT) | 4, + Error_InvalidComment = (15 << TOKEN_CATEGORY_SHIFT) | 7, + /// invalid comment token - error occured while parsing comment + Error_InvalidOp = (15 << TOKEN_CATEGORY_SHIFT) | 8, } /// extracts token category, clearing subcategory @@ -184,6 +186,10 @@ struct TextPosition { @property string toString() { return to!string(line) ~ ":" ~ to!string(pos); } + /// adds deltaPos to position and returns result + TextPosition offset(int deltaPos) { + return TextPosition(line, pos + deltaPos); + } } /// text content range diff --git a/src/dlangui/widgets/editors.d b/src/dlangui/widgets/editors.d index fd51235c..b3969fa7 100644 --- a/src/dlangui/widgets/editors.d +++ b/src/dlangui/widgets/editors.d @@ -1629,7 +1629,7 @@ class EditBox : EditWidgetBase { new Action(EditorActions.ZoomOut, KeyCode.SUB, KeyFlag.Control), ]); } - protected uint _matchingBracketHightlightColor = 0xFFF0E0; + protected uint _matchingBracketHightlightColor = 0x60FFE0B0; protected int _firstVisibleLine; @@ -2119,8 +2119,7 @@ class EditBox : EditWidgetBase { rc.right = _clientRect.left + endrc.right; if (!rc.empty) { // draw selection rect for matching bracket - Log.d("highlight bracket 1: ", rc); - buf.fillRect(rc, 0xFFDD80); + buf.fillRect(rc, color); } } @@ -2146,13 +2145,11 @@ class EditBox : EditWidgetBase { } if (_matchingBraces.start.line == lineIndex) { - TextRange r = TextRange(_matchingBraces.start, _matchingBraces.start); - r.end.pos++; + TextRange r = TextRange(_matchingBraces.start, _matchingBraces.start.offset(1)); highlightLineRange(buf, lineRect, _matchingBracketHightlightColor, r); } if (_matchingBraces.end.line == lineIndex) { - TextRange r = TextRange(_matchingBraces.end, _matchingBraces.end); - r.end.pos++; + TextRange r = TextRange(_matchingBraces.end, _matchingBraces.end.offset(1)); highlightLineRange(buf, lineRect, _matchingBracketHightlightColor, r); }