diff --git a/qrenderdoc/Windows/PythonShell.cpp b/qrenderdoc/Windows/PythonShell.cpp index 076783436..70cf2e597 100644 --- a/qrenderdoc/Windows/PythonShell.cpp +++ b/qrenderdoc/Windows/PythonShell.cpp @@ -796,7 +796,7 @@ EditorWrapper *PythonShell::curEditor() return NULL; } -void PythonShell::makeEditor(rdcstr filename, rdcstr text) +EditorWrapper *PythonShell::makeEditor(rdcstr filename, rdcstr text) { EditorWrapper *editor = new EditorWrapper(this); editor->setObjectName(lit("scriptEditor")); @@ -1005,6 +1005,8 @@ void PythonShell::makeEditor(rdcstr filename, rdcstr text) sc->setText(text.c_str()); sc->emptyUndoBuffer(); editor->markModified(false); + + return editor; } void PythonShell::updateEditorCloseButton() @@ -1241,7 +1243,13 @@ bool PythonShell::LoadScriptFromFilename(rdcstr filename) void PythonShell::CreateNewScriptEditor(rdcstr name, rdcstr text) { - makeEditor(name, text); + EditorWrapper *ed = makeEditor("", text); + + QFileInfo info(name); + if(info.isAbsolute() && (info.exists() || info.absoluteDir().exists())) + ed->setFilename(name); + else + ed->setTitle(name); ui->saveScript->setEnabled(false); updateNonDebugWarning(); diff --git a/qrenderdoc/Windows/PythonShell.h b/qrenderdoc/Windows/PythonShell.h index 47b18467c..d366f7127 100644 --- a/qrenderdoc/Windows/PythonShell.h +++ b/qrenderdoc/Windows/PythonShell.h @@ -232,7 +232,7 @@ private: void setupTabs(); EditorWrapper *curEditor(); - void makeEditor(rdcstr filename, rdcstr text); + EditorWrapper *makeEditor(rdcstr filename, rdcstr text); void updateEditorCloseButton(); void updateNonDebugWarning();