diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index cfab6b7fc89af33e616c5719236944dbecf64e81..ff8bf3031900bd5b646b4f2bfb9b68f1291b307c 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -499,6 +499,13 @@ void LLLineEditor::setCursorToEnd() deselect(); } +void LLLineEditor::resetScrollPosition() +{ + mScrollHPos = 0; + // make sure cursor says in visible range + setCursor(getCursor()); +} + BOOL LLLineEditor::canDeselect() const { return hasSelection(); diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 287837a15c1db6326e2096807b1b4eb88cead74b..f775d53e63d7bde62b66b8a530b5ceed949696a9 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -208,6 +208,9 @@ class LLLineEditor void setCursor( S32 pos ); void setCursorToEnd(); + // set scroll to earliest position it can reasonable set + void resetScrollPosition(); + // Selects characters 'start' to 'end'. void setSelection(S32 start, S32 end); virtual void getSelectionRange(S32 *position, S32 *length) const; diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index f6831c6d5ec52624829e23fd47223354bb958158..ce3fc29d32721a4b147a7d67548b9dc0280f908d 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -290,6 +290,7 @@ void LLSpinCtrl::forceSetValue(const LLSD& value ) LLF32UICtrl::setValue(value); updateEditor(); + mEditor->resetScrollPosition(); } } @@ -355,7 +356,9 @@ void LLSpinCtrl::onEditorCommit( const LLSD& data ) if( success ) { - updateEditor(); + // We commited and clamped value + // try to display as much as possible + mEditor->resetScrollPosition(); } else { @@ -475,6 +478,7 @@ BOOL LLSpinCtrl::handleKeyHere(KEY key, MASK mask) // text editors don't support revert normally (due to user confusion) // but not allowing revert on a spinner seems dangerous updateEditor(); + mEditor->resetScrollPosition(); mEditor->setFocus(FALSE); return TRUE; }