Create new terminal sessions with directory of active session

This mimics the behaviour of most tabbed terminal emulators.

Fixes #1009.
This commit is contained in:
Fredrik Fornwall
2020-01-05 02:00:25 +01:00
parent 7f7c1efac1
commit e28be01dc2
2 changed files with 25 additions and 1 deletions

View File

@@ -603,7 +603,9 @@ public final class TermuxActivity extends Activity implements ServiceConnection
new AlertDialog.Builder(this).setTitle(R.string.max_terminals_reached_title).setMessage(R.string.max_terminals_reached_message)
.setPositiveButton(android.R.string.ok, null).show();
} else {
TerminalSession newSession = mTermService.createTermSession(null, null, null, failSafe);
TerminalSession currentSession = getCurrentTermSession();
String workingDirectory = (currentSession == null) ? null : currentSession.getCwd();
TerminalSession newSession = mTermService.createTermSession(null, null, workingDirectory, failSafe);
if (sessionName != null) {
newSession.mSessionName = sessionName;
}