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

read EDITOR env var before running sensible-editor to make the plugin… #15

Merged
merged 1 commit into from
Jan 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "SensibleEditorSourceCodeAccessPrivatePCH.h"
#include "SensibleEditorSourceCodeAccessor.h"
#include "DesktopPlatformModule.h"
#include <cstdlib>

#define LOCTEXT_NAMESPACE "SensibleEditorSourceCodeAccessor"

Expand Down Expand Up @@ -56,7 +57,12 @@ bool FSensibleSourceCodeAccessor::OpenSolution()
// Add this to handle spaces in path names.
const FString NewFullPath = FString::Printf(TEXT("\"%s\""), *FullPath);

FString Editor = FString(TEXT("/usr/bin/sensible-editor"));
FString Editor = FString(UTF8_TO_TCHAR(std::getenv("EDITOR")));
if (Editor.IsEmpty())
{
Editor = FString(TEXT("/usr/bin/sensible-editor"));
}

if(FLinuxPlatformProcess::CreateProc(*Editor,
*NewFullPath,
true,
Expand All @@ -76,7 +82,11 @@ bool FSensibleSourceCodeAccessor::OpenSolution()

bool FSensibleSourceCodeAccessor::OpenFileAtLine(const FString& FullPath, int32 LineNumber, int32 ColumnNumber)
{
FString Editor = FString(TEXT("/usr/bin/sensible-editor"));
FString Editor = FString(UTF8_TO_TCHAR(std::getenv("EDITOR")));
if (Editor.IsEmpty())
{
Editor = FString(TEXT("/usr/bin/sensible-editor"));
}

// Add this to handle spaces in path names.
const FString NewFullPath = FString::Printf(TEXT("\"%s+%d\""), *FullPath, LineNumber);
Expand All @@ -101,7 +111,11 @@ bool FSensibleSourceCodeAccessor::OpenSourceFiles(const TArray<FString>& Absolut
{
for ( const FString& SourcePath : AbsoluteSourcePaths )
{
FString Editor = FString(TEXT("/usr/bin/sensible-editor"));
FString Editor = FString(UTF8_TO_TCHAR(std::getenv("EDITOR")));
if (Editor.IsEmpty())
{
Editor = FString(TEXT("/usr/bin/sensible-editor"));
}

// Add this to handle spaces in path names.
const FString NewSourcePath = FString::Printf(TEXT("\"%s\""), *SourcePath);
Expand Down