Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #670. #672

Open
wants to merge 1 commit into
base: goodbye_cmake
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/polycode/ide/PolycodeIDEApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class PolycodeIDEApp : public EventDispatcher {
void saveConfigFile();
void loadConfigFile();

void openFileInProject(PolycodeProject *project, String filePath);
bool openFileInProject(PolycodeProject *project, String filePath);

void openFile(OSFileEntry file);

Expand Down
23 changes: 12 additions & 11 deletions src/ide/PolycodeIDEApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ void PolycodeIDEApp::openDocs() {
#endif
}

void PolycodeIDEApp::openFileInProject(PolycodeProject *project, String filePath) {
bool PolycodeIDEApp::openFileInProject(PolycodeProject *project, String filePath) {
OSFileEntry fileEntry = OSFileEntry(project->getRootFolder()+"/"+filePath, OSFileEntry::TYPE_FILE);
Polycode::CoreFile *file = Services()->getCore()->openFile(project->getRootFolder()+"/"+filePath,"r");

Expand All @@ -687,9 +687,10 @@ void PolycodeIDEApp::openFileInProject(PolycodeProject *project, String filePath
openFile(fileEntry);
} else {
PolycodeConsole::print("File not available.\n");
return false;
}
}

return true;
}

void PolycodeIDEApp::openFile(OSFileEntry file) {
Expand Down Expand Up @@ -819,16 +820,16 @@ void PolycodeIDEApp::handleEvent(Event *event) {
if(event->getDispatcher() == frame->console->backtraceWindow) {
if(event->getEventType() == "BackTraceEvent" && event->getEventCode() == BackTraceEvent::EVENT_BACKTRACE_SELECTED) {
BackTraceEvent *btEvent = (BackTraceEvent*) event;
openFileInProject(btEvent->project, btEvent->fileName);

PolycodeEditor *editor = editorManager->getCurrentEditor();
if(editor) {
if(editor->getEditorType() == "PolycodeTextEditor") {
PolycodeTextEditor *textEditor = (PolycodeTextEditor*) editor;
textEditor->highlightLine(btEvent->lineNumber);
if (openFileInProject(btEvent->project, btEvent->fileName)) {

PolycodeEditor *editor = editorManager->getCurrentEditor();
if (editor) {
if (editor->getEditorType() == "PolycodeTextEditor") {
PolycodeTextEditor *textEditor = (PolycodeTextEditor*)editor;
textEditor->highlightLine(btEvent->lineNumber);
}
}

}
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/ide/PolycodeTextEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,8 @@ void PolycodeTextEditor::hideFindBar() {
void PolycodeTextEditor::highlightLine(unsigned int lineNumber) {
int lineSize = textInput->getLineText(lineNumber-1).length();
textInput->setSelection(lineNumber-1, lineNumber-1, 0, lineSize);
textInput->showLine(lineNumber, false);
if (lineNumber > 0)
textInput->showLine(lineNumber-1, false);
}

void PolycodeTextEditor::saveFile() {
Expand Down