aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/lltexteditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/lltexteditor.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp
index f49b2db..552a9c9 100644
--- a/linden/indra/llui/lltexteditor.cpp
+++ b/linden/indra/llui/lltexteditor.cpp
@@ -354,6 +354,8 @@ LLTextEditor::LLTextEditor(
354 354
355 appendText(default_text, FALSE, FALSE); 355 appendText(default_text, FALSE, FALSE);
356 356
357 resetDirty(); // Update saved text state
358
357 mParseHTML=FALSE; 359 mParseHTML=FALSE;
358 mHTML=""; 360 mHTML="";
359} 361}
@@ -529,6 +531,8 @@ void LLTextEditor::setText(const LLString &utf8str)
529 531
530 updateLineStartList(); 532 updateLineStartList();
531 updateScrollFromCursor(); 533 updateScrollFromCursor();
534
535 resetDirty();
532} 536}
533 537
534void LLTextEditor::setWText(const LLWString &wtext) 538void LLTextEditor::setWText(const LLWString &wtext)
@@ -545,6 +549,8 @@ void LLTextEditor::setWText(const LLWString &wtext)
545 549
546 updateLineStartList(); 550 updateLineStartList();
547 updateScrollFromCursor(); 551 updateScrollFromCursor();
552
553 resetDirty();
548} 554}
549 555
550void LLTextEditor::setValue(const LLSD& value) 556void LLTextEditor::setValue(const LLSD& value)
@@ -3447,6 +3453,7 @@ void LLTextEditor::appendText(const LLString &new_text, bool allow_undo, bool pr
3447 BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax()); 3453 BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax());
3448 S32 selection_start = mSelectionStart; 3454 S32 selection_start = mSelectionStart;
3449 S32 selection_end = mSelectionEnd; 3455 S32 selection_end = mSelectionEnd;
3456 BOOL was_selecting = mIsSelecting;
3450 S32 cursor_pos = mCursorPos; 3457 S32 cursor_pos = mCursorPos;
3451 S32 old_length = getLength(); 3458 S32 old_length = getLength();
3452 BOOL cursor_was_at_end = (mCursorPos == old_length); 3459 BOOL cursor_was_at_end = (mCursorPos == old_length);
@@ -3479,17 +3486,23 @@ void LLTextEditor::appendText(const LLString &new_text, bool allow_undo, bool pr
3479 updateLineStartList(old_length); 3486 updateLineStartList(old_length);
3480 3487
3481 // Set the cursor and scroll position 3488 // Set the cursor and scroll position
3482 // Maintain the scroll position unless the scroll was at the end of the doc 3489 // Maintain the scroll position unless the scroll was at the end of the doc (in which
3483 // (in which case, move it to the new end of the doc) 3490 // case, move it to the new end of the doc) or unless the user was doing actively selecting
3484 if( was_scrolled_to_bottom ) 3491 if( was_scrolled_to_bottom && !was_selecting )
3485 { 3492 {
3493 if( selection_start != selection_end )
3494 {
3495 // maintain an existing non-active selection
3496 mSelectionStart = selection_start;
3497 mSelectionEnd = selection_end;
3498 }
3486 endOfDoc(); 3499 endOfDoc();
3487 } 3500 }
3488 else if( selection_start != selection_end ) 3501 else if( selection_start != selection_end )
3489 { 3502 {
3490 mSelectionStart = selection_start; 3503 mSelectionStart = selection_start;
3491
3492 mSelectionEnd = selection_end; 3504 mSelectionEnd = selection_end;
3505 mIsSelecting = was_selecting;
3493 setCursorPos(cursor_pos); 3506 setCursorPos(cursor_pos);
3494 } 3507 }
3495 else if( cursor_was_at_end ) 3508 else if( cursor_was_at_end )
@@ -3626,6 +3639,11 @@ BOOL LLTextEditor::tryToRevertToPristineState()
3626 return isPristine(); // TRUE => success 3639 return isPristine(); // TRUE => success
3627} 3640}
3628 3641
3642// virtual Return TRUE if changes have been made
3643BOOL LLTextEditor::isDirty() const
3644{
3645 return( mLastCmd != NULL || (mPristineCmd && (mPristineCmd != mLastCmd)) );
3646}
3629 3647
3630 3648
3631void LLTextEditor::updateTextRect() 3649void LLTextEditor::updateTextRect()