Fix off-by-one error

This would cause the last char before the hostname to sometimes stay
bold and not be properly reset to a regular font.

Fixes #10982.
This commit is contained in:
Adrien Destugues
2014-06-26 14:34:07 +02:00
parent eef22dfb75
commit 29db2f7f69
+2 -1
View File
@@ -372,12 +372,13 @@ URLInputGroup::URLTextView::InsertText(const char* inText, int32 inLength,
int32 baseUrlEnd = text.FindFirst("/", baseUrlStart); int32 baseUrlEnd = text.FindFirst("/", baseUrlStart);
if (baseUrlEnd < 0) if (baseUrlEnd < 0)
baseUrlEnd = TextLength(); baseUrlEnd = TextLength();
BFont font; BFont font;
GetFont(&font); GetFont(&font);
const rgb_color black = (rgb_color) { 0, 0, 0, 255 }; const rgb_color black = (rgb_color) { 0, 0, 0, 255 };
const rgb_color gray = (rgb_color) { 60, 60, 60, 255 }; const rgb_color gray = (rgb_color) { 60, 60, 60, 255 };
if (baseUrlStart > 0) if (baseUrlStart > 0)
SetFontAndColor(0, baseUrlStart - 1, &font, B_FONT_ALL, &gray); SetFontAndColor(0, baseUrlStart, &font, B_FONT_ALL, &gray);
if (baseUrlEnd > baseUrlStart) { if (baseUrlEnd > baseUrlStart) {
font.SetFace(B_BOLD_FACE); font.SetFace(B_BOLD_FACE);
SetFontAndColor(baseUrlStart, baseUrlEnd, &font, B_FONT_ALL, &black); SetFontAndColor(baseUrlStart, baseUrlEnd, &font, B_FONT_ALL, &black);