mirror of https://github.com/buggins/dlangui.git
fix #416 - editor whitespace marks for lines containing whitespace only
This commit is contained in:
parent
3181cbef09
commit
23d4a7406b
|
@ -2875,7 +2875,8 @@ class EditBox : EditWidgetBase {
|
||||||
lastNonSpace = i + 1;
|
lastNonSpace = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (firstNonSpace <= 0 && lastNonSpace >= txt.length && !hasTabs)
|
bool spacesOnly = txt.length > 0 && firstNonSpace < 0;
|
||||||
|
if (firstNonSpace <= 0 && lastNonSpace >= txt.length && !hasTabs && !spacesOnly)
|
||||||
return;
|
return;
|
||||||
uint color = addAlpha(textColor, 0xC0);
|
uint color = addAlpha(textColor, 0xC0);
|
||||||
static int[] textSizeBuffer;
|
static int[] textSizeBuffer;
|
||||||
|
@ -2888,7 +2889,7 @@ class EditBox : EditWidgetBase {
|
||||||
int spaceIndex = 0;
|
int spaceIndex = 0;
|
||||||
for (int i = 0; i < txt.length && i < charsMeasured; i++) {
|
for (int i = 0; i < txt.length && i < charsMeasured; i++) {
|
||||||
dchar ch = txt[i];
|
dchar ch = txt[i];
|
||||||
bool outsideText = (i < firstNonSpace || i >= lastNonSpace);
|
bool outsideText = (i < firstNonSpace || i >= lastNonSpace || spacesOnly);
|
||||||
if ((ch == ' ' && outsideText) || ch == '\t') {
|
if ((ch == ' ' && outsideText) || ch == '\t') {
|
||||||
Rect rc = lineRect;
|
Rect rc = lineRect;
|
||||||
rc.left = lineRect.left + (i > 0 ? textSizeBuffer[i - 1] : 0);
|
rc.left = lineRect.left + (i > 0 ? textSizeBuffer[i - 1] : 0);
|
||||||
|
|
Loading…
Reference in New Issue