Merge pull request #3930 from Ansariel/develop-chatentry-improvement
Restore currently entered text in chat entry textbox after going through history with Ctrl-PgUp/PgDownmaster
commit
2fb0abbffb
|
|
@ -45,7 +45,8 @@ LLChatEntry::LLChatEntry(const Params& p)
|
|||
mExpandLinesCount(p.expand_lines_count),
|
||||
mPrevLinesCount(0),
|
||||
mSingleLineMode(false),
|
||||
mPrevExpandedLineCount(S32_MAX)
|
||||
mPrevExpandedLineCount(S32_MAX),
|
||||
mCurrentInput("")
|
||||
{
|
||||
// Initialize current history line iterator
|
||||
mCurrentHistoryLine = mLineHistory.begin();
|
||||
|
|
@ -189,6 +190,7 @@ bool LLChatEntry::handleSpecialKey(const KEY key, const MASK mask)
|
|||
{
|
||||
needsReflow();
|
||||
}
|
||||
mCurrentInput = "";
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
|
|
@ -196,6 +198,11 @@ bool LLChatEntry::handleSpecialKey(const KEY key, const MASK mask)
|
|||
{
|
||||
if (!mLineHistory.empty() && mCurrentHistoryLine > mLineHistory.begin())
|
||||
{
|
||||
if (mCurrentHistoryLine == mLineHistory.end())
|
||||
{
|
||||
mCurrentInput = getText();
|
||||
}
|
||||
|
||||
setText(*(--mCurrentHistoryLine));
|
||||
endOfDoc();
|
||||
}
|
||||
|
|
@ -210,16 +217,15 @@ bool LLChatEntry::handleSpecialKey(const KEY key, const MASK mask)
|
|||
case KEY_DOWN:
|
||||
if (mHasHistory && MASK_CONTROL == mask)
|
||||
{
|
||||
if (!mLineHistory.empty() && mCurrentHistoryLine < (mLineHistory.end() - 1) )
|
||||
if (!mLineHistory.empty() && mCurrentHistoryLine < (mLineHistory.end() - 1))
|
||||
{
|
||||
setText(*(++mCurrentHistoryLine));
|
||||
endOfDoc();
|
||||
}
|
||||
else if (!mLineHistory.empty() && mCurrentHistoryLine == (mLineHistory.end() - 1) )
|
||||
else if (!mLineHistory.empty() && mCurrentHistoryLine == (mLineHistory.end() - 1))
|
||||
{
|
||||
mCurrentHistoryLine++;
|
||||
std::string empty("");
|
||||
setText(empty);
|
||||
setText(mCurrentInput);
|
||||
needsReflow();
|
||||
endOfDoc();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ private:
|
|||
S32 mExpandLinesCount;
|
||||
S32 mPrevLinesCount;
|
||||
S32 mPrevExpandedLineCount;
|
||||
|
||||
std::string mCurrentInput;
|
||||
};
|
||||
|
||||
#endif /* LLCHATENTRY_H_ */
|
||||
|
|
|
|||
Loading…
Reference in New Issue