forked from teamnwah/openmw-tes3coop
Stream error handling, and other minor changes.
This commit is contained in:
parent
e7a3f059aa
commit
4ca7b26609
1 changed files with 12 additions and 9 deletions
|
@ -198,28 +198,31 @@ void CSVWorld::ScriptSubView::useHint (const std::string& hint)
|
||||||
if (hint.empty())
|
if (hint.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
size_t line = 0, column = 0;
|
unsigned line = 0, column = 0;
|
||||||
std::istringstream stream (hint.c_str()+2);
|
char c;
|
||||||
|
std::istringstream stream (hint.c_str()+1);
|
||||||
switch(hint[0]){
|
switch(hint[0]){
|
||||||
case 'R':
|
case 'R':
|
||||||
case 'r':
|
case 'r':
|
||||||
{
|
{
|
||||||
QModelIndex index = mModel->getModelIndex (getUniversalId().getId(), mColumn);
|
QModelIndex index = mModel->getModelIndex (getUniversalId().getId(), mColumn);
|
||||||
QString source = mModel->data (index).toString();
|
QString source = mModel->data (index).toString();
|
||||||
size_t pos;
|
unsigned pos, dummy;
|
||||||
stream >> pos >> pos;
|
if (!(stream >> c >> dummy >> pos) )
|
||||||
|
return;
|
||||||
|
|
||||||
for (size_t i = 0; i <= pos; ++i){
|
for (unsigned i = 0; i <= pos; ++i){
|
||||||
if (source[(unsigned) i] == '\n'){
|
if (source[i] == '\n'){
|
||||||
++line;
|
++line;
|
||||||
column = i;
|
column = i+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
column = pos - column - (line > 0 ? 1 : 0);
|
column = pos - column;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'l':
|
case 'l':
|
||||||
stream >> line >> column;
|
if (!(stream >> c >> line >> column))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextCursor cursor = mEditor->textCursor();
|
QTextCursor cursor = mEditor->textCursor();
|
||||||
|
|
Loading…
Reference in a new issue