diff --git a/src/backends/R/rexpression.cpp b/src/backends/R/rexpression.cpp --- a/src/backends/R/rexpression.cpp +++ b/src/backends/R/rexpression.cpp @@ -147,9 +147,16 @@ } else { - setResult(new Cantor::TextResult(i18n("cannot open file %1: Unknown MimeType", file))); - setErrorMessage(i18n("cannot open file %1: Unknown MimeType", file)); - setStatus(Cantor::Expression::Error); + // File has unsupported mime type, but we suspect, that it is text, so will open the file in Cantor script editor + // Even if it don't text, the script editor can deals with it. + setResult(new Cantor::TextResult(QLatin1String(""))); + setStatus(Cantor::Expression::Done); + const QString& editor = QStandardPaths::findExecutable(QLatin1String("cantor_scripteditor")); + int code = QProcess::execute(editor, QStringList(file)); + if (code == -2) + qDebug() << "failed to open the file " << file << " with the script editor '" << editor << "'"; + else if (code == -1) + qDebug() << "Cantor script editor crashed"; } } } diff --git a/src/backends/R/rserver/rserver.cpp b/src/backends/R/rserver/rserver.cpp --- a/src/backends/R/rserver/rserver.cpp +++ b/src/backends/R/rserver/rserver.cpp @@ -358,7 +358,9 @@ { qDebug()<<"printing result..."; SEXP count=PROTECT(R_tryEval(lang2(install("length"),result),NULL,&errorOccurred)); // TODO: error checks - if (*INTEGER(count)==1) + if (*INTEGER(count)==0) + qDebug() << "no result, so show nothing"; + else if (*INTEGER(count)==1) Rf_PrintValue(result); else {