mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 03:40:14 +00:00
Merge remote-tracking branch 'artemutin/scriptSearchRedirect'
This commit is contained in:
commit
3b39572274
@ -198,26 +198,41 @@ void CSVWorld::ScriptSubView::useHint (const std::string& hint)
|
|||||||
if (hint.empty())
|
if (hint.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (hint[0]=='l')
|
unsigned line = 0, column = 0;
|
||||||
{
|
char c;
|
||||||
std::istringstream stream (hint.c_str()+1);
|
std::istringstream stream (hint.c_str()+1);
|
||||||
|
switch(hint[0]){
|
||||||
char ignore;
|
case 'R':
|
||||||
int line;
|
case 'r':
|
||||||
int column;
|
|
||||||
|
|
||||||
if (stream >> ignore >> line >> column)
|
|
||||||
{
|
{
|
||||||
QTextCursor cursor = mEditor->textCursor();
|
QModelIndex index = mModel->getModelIndex (getUniversalId().getId(), mColumn);
|
||||||
|
QString source = mModel->data (index).toString();
|
||||||
|
unsigned pos, dummy;
|
||||||
|
if (!(stream >> c >> dummy >> pos) )
|
||||||
|
return;
|
||||||
|
|
||||||
cursor.movePosition (QTextCursor::Start);
|
for (unsigned i = 0; i <= pos; ++i){
|
||||||
if (cursor.movePosition (QTextCursor::Down, QTextCursor::MoveAnchor, line))
|
if (source[i] == '\n'){
|
||||||
cursor.movePosition (QTextCursor::Right, QTextCursor::MoveAnchor, column);
|
++line;
|
||||||
|
column = i+1;
|
||||||
mEditor->setFocus();
|
}
|
||||||
mEditor->setTextCursor (cursor);
|
}
|
||||||
|
column = pos - column;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case 'l':
|
||||||
|
if (!(stream >> c >> line >> column))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTextCursor cursor = mEditor->textCursor();
|
||||||
|
|
||||||
|
cursor.movePosition (QTextCursor::Start);
|
||||||
|
if (cursor.movePosition (QTextCursor::Down, QTextCursor::MoveAnchor, line))
|
||||||
|
cursor.movePosition (QTextCursor::Right, QTextCursor::MoveAnchor, column);
|
||||||
|
|
||||||
|
mEditor->setFocus();
|
||||||
|
mEditor->setTextCursor (cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::ScriptSubView::textChanged()
|
void CSVWorld::ScriptSubView::textChanged()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user