Skip to content

Commit

Permalink
show a different message in terminal after reconnecting versus new te…
Browse files Browse the repository at this point in the history
…rminal (mainly a flag I’ll use later to know to restore buffer)
  • Loading branch information
gtritchie committed Dec 2, 2016
1 parent e5bb6b5 commit bfdf1b5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ private void initialize(WorkbenchServerOperations server,
*/
public void connect()
{
setNewTerminal(getHandle() == null);

server_.startTerminal(80, 25, getHandle(), getTitle(), getSequence(),
new ServerRequestCallback<ConsoleProcess>()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,18 @@ public void execute(String title)
*/
private void showBanner()
{
writeln("Welcome to " + AnsiColor.LIGHTBLUE + "RStudio" +
AnsiColor.DEFAULT + " terminal.");
if (newTerminal_)
{
writeln("Welcome to " + AnsiColor.LIGHTBLUE + "RStudio" +
AnsiColor.DEFAULT + " terminal.");
}
else
{
// TODO (gary) this is temporary until buffer save and restore is done
writeln("\33[30;43m" +
"Reconnected. Restoring buffer is not-yet-implemented.");
writeln("Hit <enter> for prompt." + AnsiColor.DEFAULT);
}
}

/**
Expand Down Expand Up @@ -328,7 +338,25 @@ public void onLoaded()
}
});
}

/**
* Set if connecting to a new terminal session.
* @param isNew true if a new connection, false if a reconnect
*/
public void setNewTerminal(boolean isNew)
{
newTerminal_ = isNew;
}

/**
* Indicates if connecting to a new terminal session.
* @return true if a new connection, false if a reconnect
*/
public boolean newTerminal()
{
return newTerminal_;
}

private static final ExternalJavaScriptLoader xtermLoader_ =
getLoader(XTermResources.INSTANCE.xtermjs(),
XTermResources.INSTANCE.xtermjsUncompressed());
Expand All @@ -340,6 +368,7 @@ public void onLoaded()
private XTermNative terminal_;
private LinkElement currentStyleEl_;
private boolean initialized_ = false;
private boolean newTerminal_ = true;

private int previousRows_ = -1;
private int previousCols_ = -1;
Expand Down

0 comments on commit bfdf1b5

Please sign in to comment.