Skip to content

Commit

Permalink
Fix #316
Browse files Browse the repository at this point in the history
  • Loading branch information
gnunn1 committed May 10, 2016
1 parent 0b624dc commit 38bc955
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
43 changes: 28 additions & 15 deletions source/gx/terminix/application.d
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,12 @@ private:
if (terminalUUID.length == 0) {
AppWindow window = getActiveAppWindow();
if (window !is null) terminalUUID = window.getActiveTerminalUUID();
}
}
//If workingDir is not set, override it with cwd so that it takes priority for
//executing actions below
if (cp.workingDir.length == 0) {
cp.workingDir = cp.cwd;
}
executeAction(terminalUUID, cp.action);
return cp.exitCode;
}
Expand All @@ -302,29 +307,37 @@ private:
string instanceAction = gsGeneral.getString(SETTINGS_NEW_INSTANCE_MODE_KEY);
//If focus-window command line parameter was passed, override setting
if (cp.focusWindow) instanceAction = SETTINGS_NEW_INSTANCE_MODE_VALUES[4];
//If workingDir is not set, override it with cwd so that it takes priority for
//executing actions below
if (cp.workingDir.length ==0) {
cp.workingDir = cp.cwd;
}
switch (instanceAction) {
//New Session
case SETTINGS_NEW_INSTANCE_MODE_VALUES[1]:
aw.present();
aw.createSession();
return cp.exitCode;
//Split Right
case SETTINGS_NEW_INSTANCE_MODE_VALUES[2]:
aw.present();
executeAction(aw.getActiveTerminalUUID, "terminal-split-right");
if (cp.session.length > 0) {
// This will use global override and load sessions
aw.initialize();
} else {
aw.createSession();
}
return cp.exitCode;
//Split Down
case SETTINGS_NEW_INSTANCE_MODE_VALUES[3]:
//Split Right, Split Down
case SETTINGS_NEW_INSTANCE_MODE_VALUES[2], SETTINGS_NEW_INSTANCE_MODE_VALUES[3]:
if (cp.session.length > 0) break;
aw.present();
executeAction(aw.getActiveTerminalUUID, "terminal-split-down");
//If workingDir is not set, override it with cwd so that it takes priority for
//executing actions below
if (cp.workingDir.length == 0) {
cp.workingDir = cp.cwd;
}
if (instanceAction == SETTINGS_NEW_INSTANCE_MODE_VALUES[2])
executeAction(aw.getActiveTerminalUUID, "terminal-split-right");
else
executeAction(aw.getActiveTerminalUUID, "terminal-split-down");
return cp.exitCode;
//Focus Window
case SETTINGS_NEW_INSTANCE_MODE_VALUES[4]:
if (cp.session.length > 0) {
// This will use global override and load sessions
aw.initialize();
}
aw.present();
return cp.exitCode;
default:
Expand Down
2 changes: 1 addition & 1 deletion source/gx/terminix/appwindow.d
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ public:
void initialize(Session session) {
addSession(session);
}

/**
* Activates the specified sessionUUID
*/
Expand Down
1 change: 1 addition & 0 deletions source/gx/terminix/terminal/terminal.d
Original file line number Diff line number Diff line change
Expand Up @@ -1382,6 +1382,7 @@ private:
CommandParameters overrides = terminix.getGlobalOverrides();
//If cwd is set in overrides use that if an explicit working dir wasn't passed as a parameter
if (workingDir.length == 0 && overrides.cwd.length > 0) {
trace("Using cwd provided");
workingDir = overrides.cwd;
}
if (overrides.workingDir.length > 0) {
Expand Down

0 comments on commit 38bc955

Please sign in to comment.