Merges in Monkey's fixes PR with a resolution for a conflict

This commit is contained in:
Areloch 2015-09-03 22:58:57 -05:00
commit bedc79aacb
22 changed files with 131 additions and 74 deletions

View file

@ -113,7 +113,10 @@ void GuiConsoleTextCtrl::onPreRender()
{
if ( mConsoleExpression.isNotEmpty() )
{
mResult = (const char*)Con::evaluatef( "$guiConsoleTextCtrlTemp = %s;", mConsoleExpression.c_str() );
Con::evaluatef( "$guiConsoleTextCtrlTemp = %s;", mConsoleExpression.c_str() );
//Fixes a bug with the above not always grabbing the console text.
mResult = Con::getVariable("$guiConsoleTextCtrlTemp");
// Of the resulting string we will be printing,
// Find the number of lines and length of each.

View file

@ -168,7 +168,7 @@ DefineEngineMethod( GuiMLTextCtrl, scrollToTag, void, (S32 tagID),,
object->scrollToTag( tagID );
}
DefineEngineMethod( GuiMLTextCtrl, scrollToTop, void, ( S32 param1, S32 param2),,
DefineEngineMethod( GuiMLTextCtrl, scrollToTop, void, (),,
"@brief Scroll to the top of the text.\n\n"
"@tsexample\n"
"// Inform GuiMLTextCtrl object to scroll to its top\n"
@ -631,7 +631,7 @@ bool GuiMLTextCtrl::setCursorPosition(const S32 newPosition)
mCursorPosition = 0;
return true;
}
else if (newPosition >= mTextBuffer.length())
else if (newPosition >= mTextBuffer.length() - 1)
{
mCursorPosition = mTextBuffer.length();
return true;
@ -669,11 +669,11 @@ void GuiMLTextCtrl::getCursorPositionAndColor(Point2I &cursorTop, Point2I &curso
{
S32 x = 0;
S32 y = 0;
S32 height = mProfile->mFont->getHeight();
S32 height = (mProfile && mProfile->mFont) ? mProfile->mFont->getHeight() : 0;
color = mProfile->mCursorColor;
for(Line *walk = mLineList; walk; walk = walk->next)
{
if ((mCursorPosition <= walk->textStart + walk->len) || (walk->next == NULL))
if ((mCursorPosition < walk->textStart + walk->len) || (walk->next == NULL))
{
// it's in the atoms on this line...
y = walk->y;
@ -768,7 +768,7 @@ void GuiMLTextCtrl::onMouseDown(const GuiEvent& event)
mSelectionAnchorDropped = event.mousePoint;
if (mSelectionAnchor < 0)
mSelectionAnchor = 0;
else if (mSelectionAnchor >= mTextBuffer.length())
else if (mSelectionAnchor >= mTextBuffer.length() - 1)
mSelectionAnchor = mTextBuffer.length();
mVertMoveAnchorValid = false;

View file

@ -212,8 +212,7 @@ void GuiTextEditCtrl::execConsoleCallback()
Parent::execConsoleCallback();
// Update the console variable:
if ( mConsoleVariable[0] )
Con::setVariable( mConsoleVariable, mTextBuffer.getPtr8() );
setVariable(mTextBuffer.getPtr8());
}
void GuiTextEditCtrl::updateHistory( StringBuffer *inTxt, bool moveIndex )
@ -374,6 +373,8 @@ S32 GuiTextEditCtrl::calculateCursorPos( const Point2I &globalPos )
void GuiTextEditCtrl::onMouseDown( const GuiEvent &event )
{
if(!isActive())
return;
mDragHit = false;
// If we have a double click, select all text. Otherwise