FIRE-11373: AUtoreplace doesn't work in nearby chat bar
parent
8db2012dea
commit
04fce8550a
|
|
@ -157,7 +157,8 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
|
|||
mHighlightColor(p.highlight_color()),
|
||||
mPreeditBgColor(p.preedit_bg_color()),
|
||||
mGLFont(p.font),
|
||||
mContextMenuHandle()
|
||||
mContextMenuHandle(),
|
||||
mAutoreplaceCallback()
|
||||
{
|
||||
llassert( mMaxLengthBytes > 0 );
|
||||
|
||||
|
|
@ -980,6 +981,25 @@ void LLLineEditor::addChar(const llwchar uni_char)
|
|||
LLUI::reportBadKeystroke();
|
||||
}
|
||||
|
||||
//<FS:TS> FIRE-11373: Autoreplace doesn't work in nearby chat bar
|
||||
if (!mReadOnly && mAutoreplaceCallback != NULL)
|
||||
{
|
||||
// autoreplace the text, if necessary
|
||||
S32 replacement_start;
|
||||
S32 replacement_length;
|
||||
LLWString replacement_string;
|
||||
S32 new_cursor_pos = getCursor();
|
||||
mAutoreplaceCallback(replacement_start, replacement_length, replacement_string, new_cursor_pos, getWText());
|
||||
|
||||
if (replacement_length > 0 || !replacement_string.empty())
|
||||
{
|
||||
mText.erase(replacement_start, replacement_length);
|
||||
mText.insert(replacement_start, replacement_string);
|
||||
setCursor(new_cursor_pos);
|
||||
}
|
||||
}
|
||||
//</FS:TS> FIRE-11373
|
||||
|
||||
getWindow()->hideCursorUntilMouseMove();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -189,6 +189,12 @@ public:
|
|||
virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text );
|
||||
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
|
||||
|
||||
//<FS:TS> FIRE-11373: Autoreplace doesn't work in nearby chat bar
|
||||
typedef boost::function<void(S32&, S32&, LLWString&, S32&, const LLWString&)> autoreplace_callback_t;
|
||||
autoreplace_callback_t mAutoreplaceCallback;
|
||||
void setAutoreplaceCallback (autoreplace_callback_t cb) { mAutoreplaceCallback = cb; }
|
||||
//</FS:TS> FIRE-11373
|
||||
|
||||
void setLabel(const LLStringExplicit &new_label) { mLabel = new_label; }
|
||||
const std::string& getLabel() { return mLabel.getString(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -109,9 +109,8 @@ static LLChatTypeTrigger sChatTypeTriggers[] = {
|
|||
FSNearbyChatControl::FSNearbyChatControl(const FSNearbyChatControl::Params& p) :
|
||||
LLLineEditor(p)
|
||||
{
|
||||
/// FIXME: Commenting out for now, will either rehook up autoreplace to LLLineEditor or
|
||||
/// move to CHUI style expanding text editors <FS:CR>
|
||||
//setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2));
|
||||
//<FS:TS> FIRE-11373: Autoreplace doesn't work in nearby chat bar
|
||||
setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5));
|
||||
setKeystrokeCallback(onKeystroke,this);
|
||||
FSNearbyChat::instance().registerChatBar(this);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue