diff --git a/src/dlangui/core/editable.d b/src/dlangui/core/editable.d index a8a7942a..a7186f3e 100644 --- a/src/dlangui/core/editable.d +++ b/src/dlangui/core/editable.d @@ -128,8 +128,8 @@ version (Windows) { /// concat strings from array using delimiter dstring concatDStrings(dstring[] lines, dstring delimiter = SYSTEM_DEFAULT_EOL) { dchar[] buf; - foreach(line; lines) { - if (buf.length) + foreach(i, line; lines) { + if(i > 0) buf ~= delimiter; buf ~= line; } @@ -996,12 +996,8 @@ class EditableContent { for (int lineIndex = range.start.line; lineIndex <= range.end.line; lineIndex++) { dstring lineText = line(lineIndex); dstring lineFragment = lineText; - int startchar = 0; - int endchar = cast(int)lineText.length; - if (lineIndex == range.start.line) - startchar = range.start.pos; - if (lineIndex == range.end.line) - endchar = range.end.pos; + int startchar = (lineIndex == range.start.line) ? range.start.pos : 0; + int endchar = (lineIndex == range.end.line) ? range.end.pos : cast(int)lineText.length; if (endchar > lineText.length) endchar = cast(int)lineText.length; if (endchar <= startchar) diff --git a/src/dlangui/widgets/editors.d b/src/dlangui/widgets/editors.d index 843b345e..2823b7f3 100644 --- a/src/dlangui/widgets/editors.d +++ b/src/dlangui/widgets/editors.d @@ -332,7 +332,7 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction // modified, not saved buf.fillRect(rc, 0xFFD040); } else if (m == EditStateMark.saved) { - // modified, not saved + // modified, saved buf.fillRect(rc, 0x20C020); } } @@ -2140,7 +2140,8 @@ class EditBox : EditWidgetBase { int lineIndex = p.line - _firstVisibleLine; res.top = lineIndex * _lineHeight; res.bottom = res.top + _lineHeight; - if (lineIndex >=0 && lineIndex < _visibleLines.length) { + // if visible + if (lineIndex >= 0 && lineIndex < _visibleLines.length) { if (p.pos == 0) res.left = 0; else if (p.pos >= _visibleLinesMeasurement[lineIndex].length)