// <FS:Ansariel> Fix linefeed pasting
//virtual
void LLChatEntry::paste()
{
	LLTextEditor::paste();

	if (mSingleLineMode)
	{
		S32 cursor_pos = getCursorPos();
		LLWString content = getWText();
		LLWStringUtil::replaceChar(content, '\n', llwchar(182));
		setWText(content);
		setCursorPos(cursor_pos);
	}
}
void LLViewerTextEditor::setEmbeddedText(const std::string& instr)
{
	LLWString wtext = utf8str_to_wstring(instr);
	for (S32 i=0; i<(S32)wtext.size(); i++)
	{
		llwchar wch = wtext[i];
		if( wch >= FIRST_EMBEDDED_CHAR && wch <= LAST_EMBEDDED_CHAR )
		{
			S32 index = wch - FIRST_EMBEDDED_CHAR;
			wtext[i] = mEmbeddedItemList->getEmbeddedCharFromIndex(index);
		}
	}
	setWText(wtext);
}
void LLViewerTextEditor::setASCIIEmbeddedText(const std::string& instr)
{
	LLWString wtext;
	const U8* buffer = (U8*)(instr.c_str());
	while (*buffer)
	{
		llwchar wch;
		U8 c = *buffer++;
		if (c >= 0x80)
		{
			S32 index = (S32)(c - 0x80);
			wch = mEmbeddedItemList->getEmbeddedCharFromIndex(index);
		}
		else
		{
			wch = (llwchar)c;
		}
		wtext.push_back(wch);
	}
	setWText(wtext);
}
Beispiel #4
0
/*
 * ProcessWindow - process window commands.
 */
vi_rc ProcessWindow( int tkn, const char *data )
{
    vi_rc       rc;

    rc = ERR_NO_ERR;
    switch( tkn ) {
    /*
     * commands follow
     */
    case PCL_T_COMMANDWINDOW: wInfo = &cmdlinew_info; break;
    case PCL_T_STATUSWINDOW: wInfo = &statusw_info; break;
    case PCL_T_COUNTWINDOW: wInfo = &repcntw_info; break;
    case PCL_T_EDITWINDOW: wInfo = &editw_info; break;
    case PCL_T_EXTRAINFOWINDOW: wInfo = &extraw_info; break;
    case PCL_T_FILECWINDOW: wInfo = &filecw_info; break;
    case PCL_T_LINENUMBERWINDOW: wInfo = &linenumw_info; break;
    case PCL_T_DIRWINDOW: wInfo = &dirw_info; break;
    case PCL_T_FILEWINDOW: wInfo = &filelistw_info; break;
    case PCL_T_SETWINDOW: wInfo = &setw_info; break;
    case PCL_T_SETVALWINDOW: wInfo = &setvalw_info; break;
    case PCL_T_MESSAGEWINDOW: wInfo = &messagew_info; break;
    case PCL_T_MENUWINDOW: wInfo = &menuw_info; break;
    case PCL_T_MENUBARWINDOW: wInfo = &menubarw_info; break;
    case PCL_T_DEFAULTWINDOW: wInfo = &defaultw_info; break;
    case PCL_T_ACTIVEMENUWINDOW: wInfo = &activemenu_info; break;
    case PCL_T_GREYEDMENUWINDOW: wInfo = &greyedmenu_info; break;
    case PCL_T_ACTIVEGREYEDMENUWINDOW: wInfo = &activegreyedmenu_info; break;

    case PCL_T_ENDWINDOW:
        if( wInfo == &defaultw_info ) {
            cmdlinew_info = defaultw_info;
            statusw_info = defaultw_info;
            repcntw_info = defaultw_info;
            editw_info = defaultw_info;
            extraw_info = defaultw_info;
            filecw_info = defaultw_info;
            linenumw_info = defaultw_info;
            dirw_info = defaultw_info;
            filelistw_info = defaultw_info;
            setw_info = defaultw_info;
            setvalw_info = defaultw_info;
            messagew_info = defaultw_info;
            menuw_info = defaultw_info;
            menubarw_info = defaultw_info;
            greyedmenu_info = defaultw_info;
            activegreyedmenu_info = defaultw_info;
            activemenu_info = defaultw_info;
        } else if( wInfo == &messagew_info ) {
            rc = NewMessageWindow();
        } else if( wInfo == &statusw_info ) {
            rc = NewStatusWindow();
        } else if( wInfo == &menubarw_info ) {
            rc = InitMenu();
        } else if ( wInfo == &editw_info ) {
            ResetAllWindows();
        }
        wInfo = NULL;
        break;
    case PCL_T_BORDER:
        rc = setWBorder( data );
        break;
    case PCL_T_HILIGHT:
        rc = setWHilite( data );
        break;
    case PCL_T_TEXT:
        rc = setWText( data );
        break;
    case PCL_T_WHITESPACE:
        rc = setSyntaxStyle( SE_WHITESPACE, data );
        break;
    case PCL_T_SELECTION:
        rc = setSyntaxStyle( SE_SELECTION, data );
        break;
    case PCL_T_EOFTEXT:
        rc = setSyntaxStyle( SE_EOFTEXT, data );
        break;
    case PCL_T_KEYWORD:
        rc = setSyntaxStyle( SE_KEYWORD, data );
        break;
    case PCL_T_OCTAL:
        rc = setSyntaxStyle( SE_OCTAL, data );
        break;
    case PCL_T_HEX:
        rc = setSyntaxStyle( SE_HEX, data );
        break;
    case PCL_T_INTEGER:
        rc = setSyntaxStyle( SE_INTEGER, data );
        break;
    case PCL_T_CHAR:
        rc = setSyntaxStyle( SE_CHAR, data );
        break;
    case PCL_T_PREPROCESSOR:
        rc = setSyntaxStyle( SE_PREPROCESSOR, data );
        break;
    case PCL_T_SYMBOL:
        rc = setSyntaxStyle( SE_SYMBOL, data );
        break;
    case PCL_T_INVALIDTEXT:
        rc = setSyntaxStyle( SE_INVALIDTEXT, data );
        break;
    case PCL_T_IDENTIFIER:
        rc = setSyntaxStyle( SE_IDENTIFIER, data );
        break;
    case PCL_T_JUMPLABEL:
        rc = setSyntaxStyle( SE_JUMPLABEL, data );
        break;
    case PCL_T_COMMENT:
        rc = setSyntaxStyle( SE_COMMENT, data );
        break;
    case PCL_T_STRING:
        rc = setSyntaxStyle( SE_STRING, data );
        break;
    case PCL_T_VARIABLE:
        rc = setSyntaxStyle( SE_VARIABLE, data );
        break;
    case PCL_T_REGEXP:
        rc = setSyntaxStyle( SE_REGEXP, data );
        break;
    case PCL_T_FLOAT:
        rc = setSyntaxStyle( SE_FLOAT, data );
        break;
    case PCL_T_DIMENSION:
        rc = setWDimension( data );
        break;
    default:
        rc = -1;
        break;
    }
    return( rc );

} /* ProcessWindow */