[QScintilla] findFirst () and mark all line found

ciz at ciz.ch ciz at ciz.ch
Mon Feb 18 12:11:31 GMT 2008



How i can make a loop to find all word xx and mark line select
like SciTE  Version 1.73?


i can use findNext();  or findFirst () event stop each line if word is
found....



void QScite::mark_all_line_search()
{
	qDebug() << "### select all line on found ";
	bool found;
	int prevLine=-1, prevIndex=-1;
	int line=-1, index=-1;
	int cursorLineStart, cursorIndexStart;
	QString lineStr;
	bool showhits = true;
	bool re = searchdlg->regularExpression->isChecked();
	bool cs = searchdlg->caseSensitive->isChecked();
	bool wo = searchdlg->wholeWord->isChecked();
	bool wrap = searchdlg->wrapAround->isChecked();
	bool fore = searchdlg->forward->isChecked();
	const QString wort = searchdlg->searchword->currentText();
	getCursorPosition(&cursorLineStart, &cursorIndexStart);
	qDebug() << "### cursorLineStart " << cursorLineStart;
	qDebug() << "### cursorIndexStart " << cursorIndexStart;
	if (wort.size() < 2) {
	return;
	}
	found =
findFirst(wort,re,cs,wo,wrap,fore,cursorLineStart,cursorIndexStart,showhits);
	while(found){
		getCursorPosition(&line, &index);
		qDebug() << "### --------onloop--------#### ";
		qDebug() << "### txtline " << text(line);
		qDebug() << "### line " << line << " index " << index;
		////SendScintilla(SCI_ENSUREVISIBLEENFORCEPOLICY,line);
		if(prevLine == -1){
			prevLine = line;
			prevIndex = index;
		} else if( line == prevLine && index == prevIndex ) {
			break;
		}
		found = findFirst(wort,re,cs,wo,wrap,fore,line,index,showhits);
	}
	 /////////setCursorPosition(cursorLineStart,cursorIndexStart);
}








More information about the QScintilla mailing list