Esempio n. 1
0
File: LL.c Progetto: joyjitc/lab
int main()
{
	int ch;
	while(1)
	{
		printf("\n1)Insert\n2)Delete\n3)Display\n4)Sort in ascending order\n5)Sort in descending order\n6)Search for an element\n7)Reverse\n8)Exit\nEnter your choice ::");
		scanf("%d",&ch);
		switch(ch)
		{
			case 1: insert();
                    display();
					break;
			case 2: del();
                    display();
					break;
			case 3: display();
					break;
			case 4: asc();
					display();
					break;
			case 5: des();
					display();
					break;
			case 6: search();
					break;
			case 7: reverse();
					display();
					break;
			case 8: exit(1);

		}
	}
}
Esempio n. 2
0
void ContactListEdit::insertCompletion(const QModelIndex& completionIndex)
{
    if(completionIndex.isValid() == false)
        return;

    TAutoSkipCompletion asc(this);

    QString completion = completionIndex.data(Qt::DisplayRole).toString();

    ilog("insertCompletion got completion text: ${c}", ("c", completion.toStdString()));

    /** \warning QCompleter passes here its index relative to ITS model which is a filtering one model.
        Then this index depends on number of items displayed in completer window. Then index is smaller
        when items are matched more strictly (0 in case just 1 row is matched).
        To get actual index, it must be remapped but there is a lacking support in QCompleter API
        to remap such index directly. Indead of cast is needed.
        \see http://qt-project.org/forums/viewthread/26959 for details
    */
    const QAbstractItemModel* completionModel = completionIndex.model();
    const QAbstractProxyModel* proxyModel = dynamic_cast<const QAbstractProxyModel*>(completionModel);
    assert(proxyModel != nullptr);
    QModelIndex sourceIndex = proxyModel->mapToSource(completionIndex);

    const Contact& contact = _completerModel->getContact(sourceIndex);

    assert(completion.toStdString() == contact.get_display_name());

    ilog("insertCompletion chosen contact: ${c}", ("c", contact.get_display_name()));

    deleteEnteredText();
    addContactEntry(completion, contact, false);
}
//----------------------------------------------------------------------------
void AdaptiveSkeletonClimbing3::Test ()
{
    int N = 6, bound = (1 << N) + 1;
    ImageInt3D image(bound, bound, bound);
    CreateImage(image);

    float* data = new1<float>(image.GetQuantity());
    int i;
    for (i = 0; i < image.GetQuantity(); ++i)
    {
        data[i] = (float)image[i];
    }

    Climb3D asc(N, data);
    float level = 349.5f;
    int depth = -1;

    int numVertices, numTriangles;
    Vector3f* vertices = 0;
    TriangleKey* triangles = 0;
    asc.ExtractContour(level, depth, numVertices, vertices, numTriangles,
        triangles);
    asc.MakeUnique(numVertices, vertices, numTriangles, triangles);
    asc.OrientTriangles(vertices, numTriangles, triangles, false);

    Vector3f* normals = asc.ComputeNormals(numVertices, vertices,
        numTriangles, triangles);

    std::ofstream outFile("vtdata.txt");
    outFile << numVertices << std::endl;
    for (i = 0; i < numVertices; ++i)
    {
        Vector3f& vertex = vertices[i];
        outFile << vertex[0] << " " << vertex[1] << " " << vertex[2]
            << std::endl;
    }
    outFile << std::endl;

    for (i = 0; i < numVertices; ++i)
    {
        Vector3f& normal = normals[i];
        outFile << normal[0] << " " << normal[1] << " " << normal[2]
            << std::endl;
    }
    outFile << std::endl;

    outFile << numTriangles << std::endl;
    for (i = 0; i < numTriangles; ++i)
    {
        TriangleKey& triangle = triangles[i];
        outFile << triangle.V[0] << " " << triangle.V[1] << " "
            << triangle.V[2] << std::endl;
    }

    delete1(normals);
    delete1(triangles);
    delete1(vertices);

    asc.PrintBoxes("boxes.txt");
}
Esempio n. 4
0
int main()
{
    char in[1000];
    int len,i,temp,temp2;
    while(gets(in))
    {
        len=strlen(in);
        if(in[0]>='0' && in[0]<='9')
        {
            for(i=len-1; i>=0;)
            {
                temp=((in[i]-'0')*10)+(in[i-1]-'0');

                if(temp>=65 && temp<=90)
                {
                    printf("%c",temp);
                    i=i-2;
                }
                else if(temp>=97 && temp<=99)
                {
                    printf("%c",temp);
                    i=i-2;
                }
                else if(temp==32 || temp==33 || temp==44 || temp==46)
                {
                    printf("%c",temp);
                    i=i-2;
                }
                else if(temp==58 || temp==59 || temp==63)
                {
                    printf("%c",temp);
                    i=i-2;
                }
                else
                {
                    temp2=((in[i]-'0')*100)+((in[i-1]-'0')*10)+(in[i-2]-'0');
                    printf("%c",temp2);
                    i=i-3;
                }
            }
        }
        else
        {
            for(i=len-1; i>=0; i--)
            {
                asc(in[i]);
            }
        }
        printf("\n");
    }
    return 0;
}
Esempio n. 5
0
void ContactListEdit::SetCollectedContacts(const IMailProcessor::TRecipientPublicKeys& storage)
{
    TAutoSkipCompletion asc(this);

    for(const auto& recipient : storage)
    {
        assert(recipient.valid());
        bool isKnownContact = false;
        bts::addressbook::contact matchingContact;
        QString entryText(Utils::toString(recipient, Utils::TContactTextFormatting::FULL_CONTACT_DETAILS,
                                          &matchingContact, &isKnownContact));
        addContactEntry(entryText, matchingContact, isKnownContact == false);
    }
}
bool ParserOrderByElement::parseImpl(Pos & pos, Pos end, ASTPtr & node, Pos & max_parsed_pos, Expected & expected)
{
	Pos begin = pos;

	ParserWhiteSpaceOrComments ws;
	ParserExpressionWithOptionalAlias elem_p(false);
	ParserString ascending("ASCENDING", true, true);
	ParserString descending("DESCENDING", true, true);
	ParserString asc("ASC", true, true);
	ParserString desc("DESC", true, true);
	ParserString collate("COLLATE", true, true);
	ParserStringLiteral collate_locale_parser;

	ASTPtr expr_elem;
	if (!elem_p.parse(pos, end, expr_elem, max_parsed_pos, expected))
		return false;

	int direction = 1;
	ws.ignore(pos, end);

	if (descending.ignore(pos, end) || desc.ignore(pos, end))
		direction = -1;
	else
		ascending.ignore(pos, end) || asc.ignore(pos, end);

	ws.ignore(pos, end);

	std::shared_ptr<Collator> collator;
	if (collate.ignore(pos, end))
	{
		ws.ignore(pos, end);

		ASTPtr locale_node;
		if (!collate_locale_parser.parse(pos, end, locale_node, max_parsed_pos, expected))
			return false;

		const String & locale = typeid_cast<const ASTLiteral &>(*locale_node).value.safeGet<String>();
		collator = std::make_shared<Collator>(locale);
	}

	node = std::make_shared<ASTOrderByElement>(StringRange(begin, pos), direction, collator);
	node->children.push_back(expr_elem);
	return true;
}
Esempio n. 7
0
cmain(){
	/* 
	 *视为主函数
	 */
	init();
	while(1)
	{
		print("\rroot#");
	    getline(input,20);
	    if(strcmp(input,"date")) date();
	    else if(strcmp(input,"time")) time();
	    else if(substr(input,t_char,0,3) && strcmp(t_char,"asc"))
	    {
			/* 打印字符 ASCII 码 */
		    substr(input,t_char,4,1);
		    asc(t_char[0]);
	    }
		else if(strcmp(input,"cls"))
		{
			/*
			 * 清屏
			 */
			init();
		}
		else if(substr(input,t_char,0,3) && strcmp(t_char,"run"))
		{
			/* 
			 * 运行用户程序
			 */
			runPro();
			init();
		}
		else if(strcmp(input,"help"))
		{
			/* 
			 * 打印帮助信息
			 */
			help();
		}
		else if(strcmp(input,"int21") || strcmp(input,"Int21") || strcmp(input,"int 21"))
		{
			/*
			 * 测试 21 号中断
			 */
			call21h();
			init();
		}
		else if(strcmp(input,"call"))
		{
			/*
			 * 调用 33 34 35 36 号 BIOS
			 */
			callBIOS();
			init();
		}
		else if(strcmp(input,"int33") || strcmp(input,"Int33") || strcmp(input,"int 33"))
		{
			/*
			 * 调用 33 号中断
			 */
			Int33();
			init();
		}
		else if(strcmp(input,"int34") || strcmp(input,"Int34") || strcmp(input,"int 34"))
		{
			/*
			 * 调用 34 号中断
			 */
			Int34();
			init();
		}
		else if(strcmp(input,"int35") || strcmp(input,"Int35") || strcmp(input,"int 35"))
		{
			/*
			 * 调用 35 号中断
			 */
			Int35();
			init();
		}
		else if(strcmp(input,"int36") || strcmp(input,"Int36") || strcmp(input,"int 36"))
		{
			/*
			 * 调用 36 号中断
			 */
			Int36();
			init();
		}
	    else
	    {
			/* 
			 * 错误指令
			 */
			print("Cat't find the Command: ");
		    print(input);
			print("\n\n");
	    }
	}
}
Esempio n. 8
0
void ISOP2P1::solveStokes()
{
	buildStokesSys();
	std::cout << "Stokes system builded." << std::endl;
	int n_dof_v = fem_space_v.n_dof();
	int n_dof_p = fem_space_p.n_dof();
	int n_total_dof = 2 * n_dof_v + n_dof_p;

	/// 构建系数矩阵和右端项.
	/// 这个存放整体的数值解. 没有分割成 u_h[0], u_h[1] 和 p_h.
	Vector<double> x(n_total_dof);
	/// 将数值解合并一个向量便于边界处理.
	for (int i = 0; i < n_dof_v; ++i)
	{
		x(i) = v_h[0](i);
		x(n_dof_v + i) = v_h[1](i);
	}

	for (int i = 0; i < n_dof_p; ++i)
		x(2 * n_dof_v + i) = p_h(i);

	rhs.reinit(n_total_dof);

	/// 边界条件一起处理了. 修改了matrix, rhs和x.
	boundaryValueStokes(x, t);
	std::cout << "Stokes boundary applied." << std::endl;

// 	/// 矩阵求解.
// 	dealii::SolverControl solver_control (400000, l_tol * rhs.l2_norm(), 1);
// 	/// 不完全LU分解.
// 	dealii::SparseILU<double> preconditioner;
// 	preconditioner.initialize(matrix);

// 	/// 求解Stokes方程, MinRes要比GMRES求解器要快很多,
// 	/// 当矩阵规模稍微大点的时候,GMRES会出现不收敛的情况.
// 	SolverMinRes<Vector<double> > minres (solver_control);
// 	SolverGMRES<Vector<double> >::AdditionalData para(1000, false, true);
// 	/// 不用para算不动, 但是均匀网格下可以不用para,算其它的例子也不用para,是不是跟计算区域有关系?
// 	SolverGMRES<Vector<double> > gmres(solver_control, para);

//         // /// 移动网格和时间发展中,这个预处理失效.
// 	//  StokesPreconditioner preconditioner;
// 	 // /// 预处理矩阵.
// 	 // SparseMatrix<double> matrix_vxvx(sp_vxvx);
// 	 // SparseMatrix<double> matrix_vyvy(sp_vyvy);
// 	 // /// 这里从 Stokes 取是因为加了边界条件.
// 	 // for (int i = 0; i < sp_vxvx.n_nonzero_elements(); ++i)
// 	 // 	matrix_vxvx.global_entry(i) = matrix.global_entry(index_vxvx[i]);
// 	 // for (int i = 0; i < sp_vyvy.n_nonzero_elements(); ++i)
// 	 // 	matrix_vyvy.global_entry(i) = matrix.global_entry(index_vyvy[i]);

// 	 // preconditioner.initialize(mat_v_stiff, mat_v_stiff, mat_p_mass);


// 	clock_t t_cost = clock();
//         minres.solve (matrix, x, rhs, PreconditionIdentity());
// //	gmres.solve(matrix, x, rhs, preconditioner);
// 	t_cost = clock() - t_cost;

// 	std::cout << "time cost: " << (((float)t_cost) / CLOCKS_PER_SEC) << std::endl;

// 	/// 将整体数值解分割成速度和压力.
// 	for (int i = 0; i < n_dof_v; ++i)
// 	{
// 		v_h[0](i) = x(i);
// 		v_h[1](i) = x(i + n_dof_v);
// 	}
// 	for (int i = 0; i < n_dof_p; ++i)
// 		p_h(i) =  x(i + 2 * n_dof_v);
//        /// 计算误差, t为时间参数.
// 	computeError(t);
// 	/// debug, 计算惨量的L2 norm。
// 	Vector<double> res(n_total_dof);
// 	matrix.vmult(res, x);
// 	res *= -1;
// 	res += rhs;
// 	std::cout << "res_l2norm =" << res.l2_norm() << std::endl;

	/// 矩阵求解.
	SparseMatrix<double> mat_BTx(sp_pvx);
	SparseMatrix<double> mat_BTy(sp_pvy);
	SparseMatrix<double> mat_Bx(sp_vxp);
	SparseMatrix<double> mat_By(sp_vyp);
	SparseMatrix<double> mat_Ax(sp_vxvx);
	SparseMatrix<double> mat_Ay(sp_vyvy);

	for (int i = 0; i < sp_vxvx.n_nonzero_elements(); ++i)
		mat_Ax.global_entry(i) = matrix.global_entry(index_vxvx[i]);
	for (int i = 0; i < sp_vyvy.n_nonzero_elements(); ++i)
		mat_Ay.global_entry(i) = matrix.global_entry(index_vyvy[i]);
	for (int i = 0; i < sp_pvx.n_nonzero_elements(); ++i)
		mat_BTx.global_entry(i) = matrix.global_entry(index_pvx[i]);
	for (int i = 0; i < sp_pvy.n_nonzero_elements(); ++i)
		mat_BTy.global_entry(i) = matrix.global_entry(index_pvy[i]);
	for (int i = 0; i < sp_vxp.n_nonzero_elements(); ++i)
		mat_Bx.global_entry(i) = matrix.global_entry(index_vxp[i]);
	for (int i = 0; i < sp_vyp.n_nonzero_elements(); ++i)
		mat_By.global_entry(i) = matrix.global_entry(index_vyp[i]);

	/// alp对AMGSolver的初始化影响比较大, 如果取得很小,初始化很快.
        double alp = dt * viscosity;
	AMGSolver solverQ(mat_Ax, 1.0e-12, 3, 100, 0.382, alp);
//	AMGSolver solverQ(mat_Ax);
	InverseMatrix AInv(mat_Ax, solverQ);
	/// 这里没有对速度质量阵进行边界条件处理.
	InverseMatrix QInv(mat_v_mass, solverQ);
	SchurComplement schur_complement(mat_BTx, mat_BTy, mat_Bx, mat_By, mat_v_mass, QInv, QInv);
	AMGSolver solverP(mat_p_mass);
	ApproxSchurComplement asc(mat_p_mass, solverQ);
	
	LSCPreconditioner lsc_preconditioner(mat_BTx, mat_BTy, mat_Bx, mat_By, mat_Ax, mat_Ax, mat_v_mass, schur_complement, asc, QInv,
					     AInv, AInv);
	/// 矩阵求解.
	dealii::SolverControl solver_control (400000, l_Euler_tol * rhs.l2_norm(), 0);
	SolverMinRes<Vector<double> > minres(solver_control);
	
	minres.solve(matrix, x, rhs, lsc_preconditioner);
	/// 将整体数值解分割成速度和压力.
	for (int i = 0; i < n_dof_v; ++i)
	{
		v_h[0](i) = x(i);
		v_h[1](i) = x(i + n_dof_v);
	}
	for (int i = 0; i < n_dof_p; ++i)
		p_h(i) =  x(i + 2 * n_dof_v);
	
	/// 计算误差, t为时间参数.
	computeError(t);


// 	/// 矩阵求解.
// 	SparseMatrix<double> mat_BTx(sp_pvx);
// 	SparseMatrix<double> mat_BTy(sp_pvy);
// 	SparseMatrix<double> mat_Bx(sp_vxp);
// 	SparseMatrix<double> mat_By(sp_vyp);
// 	SparseMatrix<double> mat_Ax(sp_vxvx);
// 	SparseMatrix<double> mat_Ay(sp_vyvy);

// 	for (int i = 0; i < sp_vxvx.n_nonzero_elements(); ++i)
// 		mat_Ax.global_entry(i) = matrix.global_entry(index_vxvx[i]);
// 	for (int i = 0; i < sp_vyvy.n_nonzero_elements(); ++i)
// 		mat_Ay.global_entry(i) = matrix.global_entry(index_vyvy[i]);
// 	for (int i = 0; i < sp_pvx.n_nonzero_elements(); ++i)
// 		mat_BTx.global_entry(i) = matrix.global_entry(index_pvx[i]);
// 	for (int i = 0; i < sp_pvy.n_nonzero_elements(); ++i)
// 		mat_BTy.global_entry(i) = matrix.global_entry(index_pvy[i]);
// 	for (int i = 0; i < sp_vxp.n_nonzero_elements(); ++i)
// 		mat_Bx.global_entry(i) = matrix.global_entry(index_vxp[i]);
// 	for (int i = 0; i < sp_vyp.n_nonzero_elements(); ++i)
// 		mat_By.global_entry(i) = matrix.global_entry(index_vyp[i]);
	
// 	Vector<double> tmp1(n_dof_v);
// 	Vector<double> tmp2(n_dof_v);
// 	Vector<double> rhs_vx(n_dof_v);
// 	Vector<double> rhs_vy(n_dof_v);
// 	Vector<double> rhs_p(n_dof_p);

// 	for (int i = 0; i < n_dof_v; ++i)
// 	{
// 		rhs_vx(i) = rhs(i);
// 		v_h[0](i) = x(i);
// 		rhs_vy(i) = rhs(n_dof_v + i);
// 		v_h[1](i) = x(n_dof_v + i);
// 	}
// 	for (int i = 0; i < n_dof_p; ++i)
// 	{
// 		rhs_p(i) = rhs(2 * n_dof_v + i);
// 		p_h(i) = x(2 * n_dof_v + i);
// 	}

// 	Vector<double> schur_rhs (n_dof_p);
// 	AMGSolver solverQ(mat_Ax);
// 	InverseMatrix M(mat_Ax, solverQ);
// 	M.vmult (tmp1, rhs_vx);
// 	M.vmult (tmp2, rhs_vy);
// 	mat_Bx.vmult(schur_rhs, tmp1);
// 	mat_By.vmult_add(schur_rhs, tmp2);
// 	schur_rhs -= rhs_p;

// 	SchurComplement schur_complement(mat_BTx, mat_BTy, mat_Bx, mat_By, mat_v_mass, M, M, dt);

// 	SolverControl solver_control_cg (n_dof_p * 2,
// 					 1e-12*schur_rhs.l2_norm());
// 	SolverCG<>    cg (solver_control_cg);

// 	AMGSolver AQ(mat_p_mass);
// 	ApproxSchurComplement asc(mat_p_mass, AQ);
// 	cg.solve (schur_complement, p_h, schur_rhs, asc);

// //	cg.solve (schur_complement, p_h, schur_rhs, PreconditionIdentity());
// 	std::cout << solver_control_cg.last_step()
//             		  << " CG Schur complement iterations to obtain convergence."
//             		  << std::endl;

// 	mat_BTx.vmult(tmp1, *dynamic_cast<const Vector<double>* >(&p_h));
// 	mat_BTy.vmult(tmp2, *dynamic_cast<const Vector<double>* >(&p_h));
// 	tmp1 *= -1;
// 	tmp2 *= -1;
// 	tmp1 += rhs_vx;
// 	tmp2 += rhs_vy;

// 	M.vmult(v_h[0], tmp1);
// 	M.vmult(v_h[1], tmp2);
// 	std::cout << "Stokes system solved." << std::endl;
// 	/// 计算误差, t为时间参数.
// 	computeError(t);
// 	/// debug, 计算惨量的L2 norm。
// 	Vector<double> res(n_total_dof);
// 	matrix.vmult(res, x);
// 	res *= -1;
// 	res += rhs;
// 	std::cout << "res_l2norm =" << res.l2_norm() << std::endl;
};
Esempio n. 9
0
//--------------------------------- SHELL core os.c---------
char listen_key(){
//	unsigned short int init_pos = get_pointer_pos();
	flag_len=17;
	char i = gets( key);
	screen_sc_T = 1;
	Print_flag_mark = 1;
	if( strcmp( key, "clear\0")){			// char *,const char *
		clear();
		return i;
	}

	if( strcmp( key, "time\0")){
		time();
		return i;
	}

	if( strcmp( key, "date\0")){
		date();
		return i;
	}

	if( strcmp( key, "python\0")){
		python();
		return i;
	}
	if( strcmp( key, "start\0")){
		screen_init();
		Print_flag_mark = 0;
		Process();
		return i;
	}

	if( strcmp( key, "help\0")){
		//can't refer 2 two times, so...
		init_flag_position();	
		screen_init();
		print_welcome_msg();
		print_message();
		print_flag(); //root@wangqin4377@:   position

		return i;
	}
//---------------------------------mark: man xxx, run xxx,asc xx...

	if( synCheck( key, "asc\0")){
		asc( key);
		return i;
	}

	if( synCheck( key, "man\0")){
		man( key);
		return i;
	}	
	
	if( synCheck( key, "run\0")){
		run( key);
		return i;
	}

	if( synCheck( key, "syscall\0")){
		syscall_test();
		return i;
	}


	if( synCheck( key, "int\0")){
		if( strcmp( key, "int 33h")){
			__asm__(  "int $0x33");
			return i;
		}
		if( strcmp( key, "int 34h")){
			__asm__(  "int $0x34");
			return i;
		}
		if( strcmp( key, "int 35h")){
			__asm__(  "int $0x35");
			return i;
		}
		if( strcmp( key, "int 36h")){
			__asm__(  "int $0x36");
			return i;
		}
	}

	if( key[0] == '\0'){
		return i;
	}
	
	flag_scroll();
	set_pointer_pos();
	print_str("  No such file or Directory", 27);
	screen_sc_T = 2;
	return i;
}
Esempio n. 10
0
void ContactListEdit::onTextChanged()
{
    /** Remember last changed text range in _activeCursor member. Will be used to replace entered text
        whith contact entry.
    */
    QString text = textUnderCursor(&_activeCursor);

    if(_skipCompletion == false && _completer != nullptr && isReadOnly() == false &&
            text.isEmpty() == false)
    {
        TAutoSkipCompletion asc(this);

        std::string textKey = text.toStdString();

        bts::addressbook::wallet_contact matchedContact;

        bool contactFound = false;
        try
        {
            auto aBook = bts::get_profile()->get_addressbook();

            auto contact = aBook->get_contact_by_display_name(textKey);
            contactFound = contact;
            if(contactFound == false)
                contact = aBook->get_contact_by_dac_id(textKey);

            if(contact)
            {
                contactFound = true;
                matchedContact = *contact;
            }
        }
        catch(const fc::exception& e)
        {
            wlog( "${e}", ("e",e.to_detail_string()) );
        }

        bool semanticallyValidKey = false;
        if(contactFound)
        {
            /// Delete previously entered text - will be replaced with image control holding contact info
            deleteEnteredText();
            /// Update PK-like text with displayed form
            text = QString::fromStdString(matchedContact.get_display_name());
            /// If text already points to some found contact, just add it
            addContactEntry(text, matchedContact, false);
        }
        else if(public_key_address::is_valid(textKey, &semanticallyValidKey) && semanticallyValidKey)
        {
            /// Delete previously entered text - will be replaced with image control holding contact info
            deleteEnteredText();

            public_key_address converter(textKey);
            fc::ecc::public_key parsedKey = converter.key;

            if(Utils::matchContact(parsedKey, &matchedContact))
            {
                QString displayText = _completerModel->getDisplayText(Contact(matchedContact));
                addContactEntry(displayText, matchedContact, false);

                QString txt = tr("Known public key has been replaced with matching contact...");
                /// Don't pass here parent widget to avoid switching active window when tooltip appears
                QToolTip::showText(QCursor::pos(), txt, nullptr, QRect(), 3000);
            }
            else
            {
                QString tooltip = tr("Valid, but <b>unknown</b> public key, cannot be matched to any contact "
                                     "present in address book...");
                addContactEntry(text, matchedContact, true, &tooltip);
            }
        }
        else
        {
            QTextCharFormat fmt;
            fmt.setFontWeight(QFont::Bold);
            fmt.setForeground(QColor(Qt::red));
            fmt.setToolTip(tr("Unknown contact - can be <b>ignored</b> while sending message"));
            _activeCursor.mergeCharFormat(fmt);

            showCompleter(text);
        }
    }

    fitHeightToDocument();
}