Revert changes to BTextInput's text-rect calculation.

This reverts commit 11dee0444f.
This reverts commit 1641a0516d.
This reverts commit 484f64f315.

These changes break various edge-cases in BTextInput (e.g. typing off the end
of a long string, using the arrow keys to navigate while out-of-bounds),
and nobody has found any fixes for them in the nearly-a-year since they've
been instanted, so they are now being reverted.

Reopens #12608, #13796.
This commit is contained in:
Augustin Cavalier 2018-07-18 19:30:20 -04:00
parent b3a7d91b2e
commit 3c42c902d9

View File

@ -116,7 +116,6 @@ _BTextInput_::KeyDown(const char* bytes, int32 numBytes)
default:
BTextView::KeyDown(bytes, numBytes);
AlignTextRect();
break;
}
}
@ -175,7 +174,7 @@ _BTextInput_::AlignTextRect()
float vInset = max_c(1,
floorf((textRect.Height() - LineHeight(0)) / 2.0));
float hInset = 2;
float textFontWidth = TextRect().Width();
float textFontWidth = TextRect().right;
switch (Alignment()) {
case B_ALIGN_LEFT:
@ -183,12 +182,12 @@ _BTextInput_::AlignTextRect()
break;
case B_ALIGN_RIGHT:
hInset = textRect.Width() - textFontWidth;
hInset = textRect.right - textFontWidth;
hInset -= be_control_look->DefaultLabelSpacing();
break;
case B_ALIGN_CENTER:
hInset = (textRect.Width() - textFontWidth) / 2.0;
hInset = (textRect.right - textFontWidth) / 2.0;
break;
default: