Not really "always". It won't be made visibile if there is a hardware
keyboard on the device or if there is a bluetooth keyboard currently
connected to the device.
It's not clear why we try to draw on a finished TranscriptScreen when
exiting on Honeycomb (and not on other platforms), but this works around
the resulting crash.
Signed-off-by: Jack Palevich <jackpal@google.com>
Default back key preference is to send ESC
Default TERM setting is screen
Close Window on process exit defaults to true. Linux term users expect
this, even though it can lead to accidental data loss.
Otherwise, the screen size check handler isn't installed in the
EmulatorView, and the screen won't resize properly until something else
causes its onResume() to be called.
Signed-off-by: Jack Palevich <jackpal@google.com>
This matches the Linux console terminal emulator's behavior and
(apparently) the expectations of full-screen programs.
Signed-off-by: Jack Palevich <jackpal@google.com>
In ordinary Unix (non-Android) environments, the behavior of programs
that use advanced terminal capabilities depends on the value of TERM in
the environment. Currently, we don't set TERM at all, which leads most
of those programs to assume a dumb terminal and behave accordingly.
Instead, set TERM in the started process's environment, and provide the
user a preference to choose the value of TERM. The current default of
"vt100" is the safest, as it's understood on every system since near the
beginning of time, but does not expose capabilities such as colors or
Home/End keys. The other options provided are "screen", which is the
best match for our currently implemented capabilities and reasonably
widespread, and "linux".
Signed-off-by: Jack Palevich <jackpal@google.com>
Add the ability to modify the subprocess's environment by passing in an
array of environment variable strings suitable for passing to putenv()
("VAR=value"). While we're at it, lift the restriction on the number of
arguments passed to the subprocess by using an array instead of a fixed
number of String arguments to hold command line arguments.
This change breaks the ABI for the JNI library, so bump the library ABI
version (to 3) to avoid any potential problems with external copies of
the library.
Signed-off-by: Jack Palevich <jackpal@google.com>
The VT100 special graphics character set is used as the alternate (G1)
character set by many full-screen applications which want to draw lines
and boxes on screen; these applications currently show lots of "q"s and
"x"s where boxes should be.
To implement this character set, we provide a mapping between the ASCII
characters sent by the application in this character set and Unicode
codepoints for the expected display characters, and use it when the G1
character set is selected (via the existing support for the SI and SO
control characters).
Signed-off-by: Jack Palevich <jackpal@google.com>
Applications expect to get black when they ask for a black background,
independent of what the default background color actually is; similarly,
they expect white when they ask for a white foreground, independent of
the default foreground color. We, however, currently substitute the
default background color for black and the default foreground color for
white in our palette, which leads to incorrect color when the color
scheme is anything other than white on black.
A full solution to this problem probably requires us to distinguish
"default color" from the colors in the palette, which would require
additional storage for color information. As a band-aid fix, though,
keep track of which colors in the palette are the closest match to the
default colors, and substitute those instead of always substituting for
black and white.
Signed-off-by: Jack Palevich <jackpal@google.com>
Implement support for the following escape codes (not supported by a
real VT100, but not conflicting with any VT100 escapes either):
* Esc [ Z: backwards tab
* Esc [ Pn X: erase Pn characters
* SGR codes 10/11: exit/enter alternate charset (used when TERM=linux)
[ECMA-48 uses this pair of codes for font selection]
* SGR codes 3/23: "standout" (reverse video for TERM=screen) [ECMA-48
uses this pair of codes for italics, but this seems to be rarely
implemented]
With these escapes implemented, we should have the complete set of
escapes required to keep termcap/terminfo-using applications happy when
TERM=linux or TERM=screen. (We may be missing a few graphic
modes/attributes, but nothing that should cause major breakage.)
Signed-off-by: Jack Palevich <jackpal@google.com>
Sending a tab to the emulator when the cursor sits on a tab stop should
move the cursor to the next tab stop, not leave the cursor in its
current position.
Signed-off-by: Jack Palevich <jackpal@google.com>
Currently, if the shell exits and the option to close windows on shell
exit isn't activated, the user gets no visual cue that the shell has
exited -- only an unresponsive session. Instead, take a page from the
Mac OS X Terminal's book and display a message that the terminal session
has finished.
Signed-off-by: Jack Palevich <jackpal@google.com>
At the moment, the terminal activity, the window list activity, and the
service all assume that terminal sessions only end when they're
explicitly closed by an action from our UI (the close buttons in the
activities) -- which is currently true, but breaks if sessions end when
the shell running in the session exits.
To account for the possibility of sessions ending on their own, add
callback interfaces to notify when sessions have finished and when the
list of sessions changes.
Signed-off-by: Jack Palevich <jackpal@google.com>
Remove the unused UpdateCallback argument to the TermSession
constructor, and move the setUpdateCallback() into the EmulatorView
constructor, eliminating the need for a getUpdateCallback() in
EmulatorView.
Signed-off-by: Jack Palevich <jackpal@google.com>
Allow the back button to (1) close all windows (the current behavior);
(2) close the current window only; (3) close the activity, but leave the
terminal sessions running; or (4) send ESC to the terminal.
Signed-off-by: Jack Palevich <jackpal@google.com>
As of now, a vertical fling scrolls the screen far too quickly to be
useful -- even a small flick of the finger scrolls the screen by
hundreds of lines. Reduce the coefficient converting fling velocity to
scroll distance from 2 to 0.1, which results in much more reasonable
scroll distances.
Signed-off-by: Jack Palevich <jackpal@google.com>
Other terminals which offer color support generally have two sets of
colors, a "dim" set for regular text and backgrounds and a "bright" set
for use with bold text. At the moment, Android Terminal Emulator uses
the same set of eight colors for backgrounds, normal text, and bold
text, which causes one notable problem: applications generally expect
bold text colored black to be displayed as "bright black" (a dark gray),
but this text is invisible in Android Terminal Emulator in the
white-on-black configuration.
Fix this by extending the array of foreground colors to include "bright"
colors (actually, the same colors we were using before, except for the
addition of a "bright black"), taking advantage of the fact that we're
using the high bit of the foreground color to store bold information.
We dim the regular set of colors slightly, to distinguish them from the
bright colors.
Signed-off-by: Jack Palevich <jackpal@google.com>
Add a updatePrefs() method in TermSession and TerminalEmulator and call
it from Term's updatePrefs(), so that changes to the UTF-8 preference
will be picked up immediately by running terminal sessions.
Note that a terminal emulator will ignore the UTF-8 preference once any
application running in it uses one of the ESC % codes to request a
specific character set.
Signed-off-by: Jack Palevich <jackpal@google.com>
When the line containing the cursor is blank, and the cursor is not at
the bottom edge of the screen, fast resize will move the line containing
the cursor off the screen. Fix this by ensuring that fast resize never
considers lines at or above the cursor for shrinking.
This patch prevents a crash which occurs when a full resize operation is
conducted immediately after this bug is triggered (the full resize
attempts to fetch the character at the cursor, which is off the screen,
causing an IllegalArgumentException).
Signed-off-by: Jack Palevich <jackpal@google.com>