mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 22:15:32 +00:00
move cursor in scripteditor to position of error
This commit is contained in:
parent
a64b741af2
commit
e6307a5151
3 changed files with 33 additions and 1 deletions
|
@ -28,7 +28,11 @@ void CSMTools::ScriptCheckStage::report (const std::string& message, const Compi
|
|||
<< ", line " << loc.mLine << ", column " << loc.mColumn
|
||||
<< " (" << loc.mLiteral << "): " << message;
|
||||
|
||||
mMessages->push_back (std::make_pair (id, stream.str()));
|
||||
std::ostringstream hintStream;
|
||||
|
||||
hintStream << "l:" << loc.mLine << " " << loc.mColumn;
|
||||
|
||||
mMessages->add (id, stream.str(), hintStream.str());
|
||||
}
|
||||
|
||||
void CSMTools::ScriptCheckStage::report (const std::string& message, Type type)
|
||||
|
|
|
@ -47,6 +47,32 @@ void CSVWorld::ScriptSubView::setEditLock (bool locked)
|
|||
mEditor->setReadOnly (locked);
|
||||
}
|
||||
|
||||
void CSVWorld::ScriptSubView::useHint (const std::string& hint)
|
||||
{
|
||||
if (hint.empty())
|
||||
return;
|
||||
|
||||
if (hint[0]=='l')
|
||||
{
|
||||
std::istringstream stream (hint.c_str()+1);
|
||||
|
||||
char ignore;
|
||||
int line;
|
||||
int column;
|
||||
|
||||
if (stream >> ignore >> line >> column)
|
||||
{
|
||||
QTextCursor cursor = mEditor->textCursor();
|
||||
|
||||
cursor.movePosition (QTextCursor::Start);
|
||||
if (cursor.movePosition (QTextCursor::Down, QTextCursor::MoveAnchor, line))
|
||||
cursor.movePosition (QTextCursor::Right, QTextCursor::MoveAnchor, column);
|
||||
|
||||
mEditor->setTextCursor (cursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSVWorld::ScriptSubView::textChanged()
|
||||
{
|
||||
if (mEditor->isChangeLocked())
|
||||
|
|
|
@ -34,6 +34,8 @@ namespace CSVWorld
|
|||
|
||||
virtual void setEditLock (bool locked);
|
||||
|
||||
virtual void useHint (const std::string& hint);
|
||||
|
||||
public slots:
|
||||
|
||||
void textChanged();
|
||||
|
|
Loading…
Reference in a new issue