mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
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())
|
||||
return;
|
||||
|
||||
size_t line = 0, column = 0;
|
||||
std::istringstream stream (hint.c_str()+2);
|
||||
unsigned line = 0, column = 0;
|
||||
char c;
|
||||
std::istringstream stream (hint.c_str()+1);
|
||||
switch(hint[0]){
|
||||
case 'R':
|
||||
case 'r':
|
||||
{
|
||||
QModelIndex index = mModel->getModelIndex (getUniversalId().getId(), mColumn);
|
||||
QString source = mModel->data (index).toString();
|
||||
size_t pos;
|
||||
stream >> pos >> pos;
|
||||
unsigned pos, dummy;
|
||||
if (!(stream >> c >> dummy >> pos) )
|
||||
return;
|
||||
|
||||
for (size_t i = 0; i <= pos; ++i){
|
||||
if (source[(unsigned) i] == '\n'){
|
||||
for (unsigned i = 0; i <= pos; ++i){
|
||||
if (source[i] == '\n'){
|
||||
++line;
|
||||
column = i;
|
||||
column = i+1;
|
||||
}
|
||||
}
|
||||
column = pos - column - (line > 0 ? 1 : 0);
|
||||
column = pos - column;
|
||||
break;
|
||||
}
|
||||
case 'l':
|
||||
stream >> line >> column;
|
||||
if (!(stream >> c >> line >> column))
|
||||
return;
|
||||
}
|
||||
|
||||
QTextCursor cursor = mEditor->textCursor();
|
||||
|
|
Loading…
Reference in a new issue