OSDN Git Service

android-x86/packages-apps-AndroidTerm.git
12 years agoDisplay toast after terminal reset, fixes #55
damor [Tue, 29 Nov 2011 10:47:59 +0000 (11:47 +0100)]
Display toast after terminal reset, fixes #55

12 years agoAdded portuguese (pt) localization
damor [Mon, 28 Nov 2011 18:26:36 +0000 (19:26 +0100)]
Added portuguese (pt) localization

12 years agoUpdated german translation
damor [Fri, 25 Nov 2011 22:58:05 +0000 (23:58 +0100)]
Updated german translation

12 years agoMerge pull request #59 from eauland/patch-5
Jack Palevich [Wed, 23 Nov 2011 18:35:27 +0000 (10:35 -0800)]
Merge pull request #59 from eauland/patch-5

Little update

12 years agoFix indentation on manifest file.
Jack Palevich [Wed, 23 Nov 2011 18:33:18 +0000 (10:33 -0800)]
Fix indentation on manifest file.

12 years agoTidy up after the default preferences patch
Steven Luo [Wed, 23 Nov 2011 04:18:22 +0000 (20:18 -0800)]
Tidy up after the default preferences patch

* Keep variables and functions in TermSettings.java in the order
  corresponding to their appearance in preferences.xml
* Remove old and unnecessary default_value_*_preference strings from
  translations (silences warnings)

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoKeep all default preferences in one place
Steven Luo [Wed, 23 Nov 2011 04:18:10 +0000 (20:18 -0800)]
Keep all default preferences in one place

We keep forgetting to change bits and pieces which contain default
preferences when we update them.  That's nuts, so let's keep all the
default preferences in one file (res/value/defaults.xml) in the
resources, and fetch those preferences from the resources whenever we
need them.

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoReset back key pressed state in onPause()
Steven Luo [Wed, 23 Nov 2011 04:18:04 +0000 (20:18 -0800)]
Reset back key pressed state in onPause()

This prevents us from incorrectly consuming a back key up event in the
following scenario on Android < 2.0:

(1) User presses back key down in the terminal activity
(2) While the back key is down, another activity moves to the top of our
    task's back stack
(3) User releases the back key
(4) User presses the back key down again, returning focus to us
(5) User releases the back key

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoUse Android 2.0 or later back key event tracking where possible
Steven Luo [Wed, 23 Nov 2011 04:17:58 +0000 (20:17 -0800)]
Use Android 2.0 or later back key event tracking where possible

Our key event tracking probably won't ever work as well as the system
built into Android, so use Android's whenever possible (e.g. on API >= 5
devices).

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoUpdate res/values-fr/strings.xml
eauland [Wed, 23 Nov 2011 10:00:56 +0000 (11:00 +0100)]
Update res/values-fr/strings.xml

12 years agoVersion 1.0.39
Jack Palevich [Wed, 23 Nov 2011 04:09:59 +0000 (20:09 -0800)]
Version 1.0.39

12 years agoMerge pull request #58 from eauland/patch-4
Jack Palevich [Wed, 23 Nov 2011 04:01:58 +0000 (20:01 -0800)]
Merge pull request #58 from eauland/patch-4

Update res/values-fr/strings.xml

12 years agoMerge pull request #54 from eauland/patch-3
Jack Palevich [Wed, 23 Nov 2011 04:00:58 +0000 (20:00 -0800)]
Merge pull request #54 from eauland/patch-3

Update res/menu/main.xml

12 years agoMerge pull request #53 from eauland/patch-2
Jack Palevich [Wed, 23 Nov 2011 03:58:14 +0000 (19:58 -0800)]
Merge pull request #53 from eauland/patch-2

Update res/values-fr/arrays.xml

12 years agoNotify the EmulatorView of an update after resetting the terminal
Steven Luo [Tue, 22 Nov 2011 22:15:25 +0000 (14:15 -0800)]
Notify the EmulatorView of an update after resetting the terminal

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoMake terminal window titles in window list activity localizable
Steven Luo [Tue, 22 Nov 2011 22:14:56 +0000 (14:14 -0800)]
Make terminal window titles in window list activity localizable

Thanks to Github user eauland for reporting.

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoUpdate res/values-fr/strings.xml
eauland [Tue, 22 Nov 2011 18:18:54 +0000 (19:18 +0100)]
Update res/values-fr/strings.xml

12 years agoUpdate res/menu/main.xml
eauland [Tue, 22 Nov 2011 15:08:57 +0000 (16:08 +0100)]
Update res/menu/main.xml

12 years agoUpdate res/values-fr/arrays.xml
eauland [Tue, 22 Nov 2011 15:06:33 +0000 (16:06 +0100)]
Update res/values-fr/arrays.xml

12 years agoVersion 1.0.38
Jack Palevich [Tue, 22 Nov 2011 10:50:22 +0000 (02:50 -0800)]
Version 1.0.38

12 years agoOn further thought, switch to BACK_KEY_CLOSES_ACTIVITY by default.
Jack Palevich [Tue, 22 Nov 2011 10:49:21 +0000 (02:49 -0800)]
On further thought, switch to BACK_KEY_CLOSES_ACTIVITY by default.

12 years agoVersion 1.0.37
Jack Palevich [Tue, 22 Nov 2011 10:42:29 +0000 (02:42 -0800)]
Version 1.0.37

12 years agoRevert default behavior of "Back Key" to exiting application.
Jack Palevich [Tue, 22 Nov 2011 10:41:40 +0000 (02:41 -0800)]
Revert default behavior of "Back Key" to exiting application.

Users were confused by having the default be "ESC". Better to keep
the default "exit the app", and let people manually change it.

12 years agoUpdate version number to 1.0.36
Jack Palevich [Tue, 22 Nov 2011 07:24:43 +0000 (23:24 -0800)]
Update version number to 1.0.36

And version code to 37

12 years agoPoll for window size changes when SDK <= 7
Jack Palevich [Tue, 22 Nov 2011 07:14:47 +0000 (23:14 -0800)]
Poll for window size changes when SDK <= 7

(Tested API levels 3 to 10 in emulator.)

12 years agoFix text renderer to draw text in correct position on screen
Jack Palevich [Tue, 22 Nov 2011 07:13:09 +0000 (23:13 -0800)]
Fix text renderer to draw text in correct position on screen

Was drawing slightly too low, which resulted in empty space on top,
cut-off characters at the bottom.

12 years agoFix calculation of visible window size.
Jack Palevich [Tue, 22 Nov 2011 06:18:03 +0000 (22:18 -0800)]
Fix calculation of visible window size.

There's a bug in pre-Android-SDK 10 when the view is full screen.

See the discussion here:

http://stackoverflow.com/questions/7659652

12 years agoRemove drop shadow at top of text window.
Jack Palevich [Tue, 22 Nov 2011 06:12:49 +0000 (22:12 -0800)]
Remove drop shadow at top of text window.

It makes no sense in full screen mode, and it obscures the top
few pixels of terminal text in both full screen and non-full-screen mode.

12 years agoMake the soft keyboard always visible when ATE starts.
Jack Palevich [Tue, 22 Nov 2011 04:18:25 +0000 (20:18 -0800)]
Make the soft keyboard always visible when ATE starts.

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.

12 years agoAvoid polling for window size change on Android API level > 5
Jack Palevich [Tue, 22 Nov 2011 04:06:46 +0000 (20:06 -0800)]
Avoid polling for window size change on Android API level > 5

12 years agoRefuse to draw on a finished TranscriptScreen
Steven Luo [Tue, 22 Nov 2011 00:56:37 +0000 (16:56 -0800)]
Refuse to draw on a finished TranscriptScreen

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>
12 years agoFinish changing default preferences
Steven Luo [Tue, 22 Nov 2011 00:56:26 +0000 (16:56 -0800)]
Finish changing default preferences

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoAllow the Back button to be configured to send "TAB"
Jack Palevich [Mon, 21 Nov 2011 20:03:39 +0000 (12:03 -0800)]
Allow the Back button to be configured to send "TAB"

12 years agoTweak default preferences
Jack Palevich [Mon, 21 Nov 2011 19:57:09 +0000 (11:57 -0800)]
Tweak default preferences

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.

12 years agoMerge pull request #52 from eauland/patch-1
Jack Palevich [Mon, 21 Nov 2011 18:44:38 +0000 (10:44 -0800)]
Merge pull request #52 from eauland/patch-1

Update res/values-fr/strings.xml

12 years agoMake sure onResume() is called for active EmulatorView in populateViewFlipper()
Steven Luo [Mon, 21 Nov 2011 07:58:56 +0000 (23:58 -0800)]
Make sure onResume() is called for active EmulatorView in populateViewFlipper()

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>
12 years agoPreserve bold when setting default foreground color (SGR code 39)
Steven Luo [Mon, 21 Nov 2011 07:26:17 +0000 (23:26 -0800)]
Preserve bold when setting default foreground color (SGR code 39)

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>
12 years agoUpdate res/values-fr/strings.xml
eauland [Mon, 21 Nov 2011 16:59:07 +0000 (17:59 +0100)]
Update res/values-fr/strings.xml

12 years agoSet TERM in process environment and provide preference to choose value
Steven Luo [Fri, 18 Nov 2011 10:26:26 +0000 (02:26 -0800)]
Set TERM in process environment and provide preference to choose value

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>
12 years agoMake Exec.createSubprocess() handle environment variables and unlimited args
Steven Luo [Fri, 18 Nov 2011 10:26:21 +0000 (02:26 -0800)]
Make Exec.createSubprocess() handle environment variables and unlimited args

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>
12 years agoSupport the VT100 special graphics character set
Steven Luo [Fri, 18 Nov 2011 10:26:15 +0000 (02:26 -0800)]
Support the VT100 special graphics character set

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>
12 years agoCorrect color rendition for color schemes other than white on black
Steven Luo [Fri, 18 Nov 2011 10:26:10 +0000 (02:26 -0800)]
Correct color rendition for color schemes other than white on black

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>
12 years agoAdd a few more escapes to the terminal emulator
Steven Luo [Fri, 18 Nov 2011 10:26:00 +0000 (02:26 -0800)]
Add a few more escapes to the terminal emulator

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>
12 years agoFix tab behavior when cursor is on tab stop
Steven Luo [Fri, 18 Nov 2011 10:25:55 +0000 (02:25 -0800)]
Fix tab behavior when cursor is on tab stop

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>
12 years agoDisplay a message in the EmulatorView when the shell exits
Steven Luo [Fri, 18 Nov 2011 10:25:09 +0000 (02:25 -0800)]
Display a message in the EmulatorView when the shell exits

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>
12 years agoAdd option to close terminal windows on shell exit
Steven Luo [Fri, 18 Nov 2011 10:25:03 +0000 (02:25 -0800)]
Add option to close terminal windows on shell exit

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoDeal with cases where a session ends without our intervention
Steven Luo [Fri, 18 Nov 2011 10:24:56 +0000 (02:24 -0800)]
Deal with cases where a session ends without our intervention

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>
12 years agoClean up setting UpdateCallback for a TermSession
Steven Luo [Fri, 18 Nov 2011 10:24:45 +0000 (02:24 -0800)]
Clean up setting UpdateCallback for a TermSession

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>
12 years agoAdd configurable back button behavior
Steven Luo [Fri, 18 Nov 2011 10:24:40 +0000 (02:24 -0800)]
Add configurable back button behavior

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>
12 years agoMake "Reset terminal" do what it says instead of closing the activity
Steven Luo [Fri, 18 Nov 2011 10:24:33 +0000 (02:24 -0800)]
Make "Reset terminal" do what it says instead of closing the activity

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoSlow down scrolling by vertical fling
Steven Luo [Fri, 18 Nov 2011 10:24:29 +0000 (02:24 -0800)]
Slow down scrolling by vertical fling

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>
12 years agoMake window title string localizable
Steven Luo [Fri, 18 Nov 2011 10:24:19 +0000 (02:24 -0800)]
Make window title string localizable

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoSimplify Android compatibility class
Steven Luo [Fri, 18 Nov 2011 10:24:11 +0000 (02:24 -0800)]
Simplify Android compatibility class

* Make names less cumbersome
* Use lazy loading instead of reflection to simplify code

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoColor tweaks
Steven Luo [Sun, 6 Nov 2011 08:25:10 +0000 (01:25 -0700)]
Color tweaks

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>
12 years agoMake changes to UTF-8 preference take effect immediately in running sessions
Steven Luo [Sun, 6 Nov 2011 08:24:40 +0000 (01:24 -0700)]
Make changes to UTF-8 preference take effect immediately in running sessions

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>
12 years agoFix fast resize when screen shrinks
Steven Luo [Sun, 6 Nov 2011 08:24:31 +0000 (01:24 -0700)]
Fix fast resize when screen shrinks

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>
12 years agoDeclare version 1.0.35
Jack Palevich [Mon, 24 Oct 2011 17:05:48 +0000 (10:05 -0700)]
Declare version 1.0.35

12 years agoCreate Android 1.5 version of notification icon.
Jack Palevich [Mon, 24 Oct 2011 16:50:26 +0000 (09:50 -0700)]
Create Android 1.5 version of notification icon.

Use MDPI version, as Android 1.5 devices are defined to be MDPI.

12 years agoUpdate documentation checklist.
Jack Palevich [Mon, 24 Oct 2011 16:41:58 +0000 (09:41 -0700)]
Update documentation checklist.

12 years agoAdd notification icon for use with Android 1.5
Jack Palevich [Mon, 24 Oct 2011 16:41:31 +0000 (09:41 -0700)]
Add notification icon for use with Android 1.5

12 years agoUpdate service notification icon.
Jack Palevich [Mon, 24 Oct 2011 16:34:18 +0000 (09:34 -0700)]
Update service notification icon.

Used "Android Asset Studio" to create the icons from a template.

12 years agoUpdate checklist.
Jack Palevich [Sun, 23 Oct 2011 17:49:10 +0000 (10:49 -0700)]
Update checklist.

12 years agoAdd a publish checklist.
Jack Palevich [Sun, 23 Oct 2011 17:29:27 +0000 (10:29 -0700)]
Add a publish checklist.

12 years agoBump version number.
Jack Palevich [Sun, 23 Oct 2011 17:13:52 +0000 (10:13 -0700)]
Bump version number.

12 years agoRevert "Return empty ExtractedText instead of null from getExtractedText()"
Jack Palevich [Sun, 23 Oct 2011 17:07:28 +0000 (10:07 -0700)]
Revert "Return empty ExtractedText instead of null from getExtractedText()"

This reverts commit 2d640ff2381925d9784248712671b7c47f2b7f56.

The original commit broke Swype soft keyboard support.

12 years agoMake sure we build on API level 10.
Jack Palevich [Sun, 23 Oct 2011 13:56:22 +0000 (06:56 -0700)]
Make sure we build on API level 10.

(Previously our manifest said we used API level 10, but we actually built
against API level 11.)

12 years agoAvoid possible overflow if the text ends in a high surrogate.
Jack Palevich [Sun, 23 Oct 2011 01:39:24 +0000 (18:39 -0700)]
Avoid possible overflow if the text ends in a high surrogate.

12 years agoAdd link to Android Market.
Jack Palevich [Sat, 22 Oct 2011 12:57:23 +0000 (05:57 -0700)]
Add link to Android Market.

12 years agoA UTF-8 encoded text file
Jack Palevich [Sat, 22 Oct 2011 12:24:24 +0000 (05:24 -0700)]
A UTF-8 encoded text file

From http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt

This test file shows that we don't currently handle many obscure parts
of unicode rendering, including combining diacritics, brail, etc.

12 years agoCreate a status bar notification icon.
Jack Palevich [Sat, 22 Oct 2011 03:58:24 +0000 (20:58 -0700)]
Create a status bar notification icon.

See http://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar.html

12 years agoRemove executable bit.
Jack Palevich [Sat, 22 Oct 2011 03:21:57 +0000 (20:21 -0700)]
Remove executable bit.

These files are not executable, and should not have executable bits
set.

These bits sometimes gets set when importing files from Windows.

12 years agoMove atari font notice out of res directory.
Jack Palevich [Sat, 22 Oct 2011 03:06:41 +0000 (20:06 -0700)]
Move atari font notice out of res directory.

12 years agoIncrement version number.
Jack Palevich [Sat, 22 Oct 2011 03:01:22 +0000 (20:01 -0700)]
Increment version number.

12 years agoImplement fast resize for cases where width remains constant
Steven Luo [Tue, 11 Oct 2011 10:20:14 +0000 (03:20 -0700)]
Implement fast resize for cases where width remains constant

A resize operation currently requires getting the entire transcript
text, throwing away the backing store, constructing a new one, and then
writing the transcript to the new store.  Particularly when the
transcript is large, this is a slow and inefficient operation.

As it turns out, it's really quite easy to change the number of screen
rows for a particular backing store, which allows much faster resize
operations in the case where the number of columns does not change.
This is particularly useful when using soft keyboards, where the number
of rows will change depending on whether the keyboard is displayed, but
the number of columns doesn't.

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoMake the screen a movable window in the transcript buffer
Steven Luo [Tue, 11 Oct 2011 10:20:08 +0000 (03:20 -0700)]
Make the screen a movable window in the transcript buffer

Instead of the current scheme of having 0..mScreenRows-1 be the screen,
and everything else be the transcript, let the screen be a movable
window into the circular buffer.  This allows scrolling the whole screen
to be much faster (just move the window), and should make fast resize
easier.

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoPreserve colors and formatting across screen size changes
Steven Luo [Tue, 11 Oct 2011 10:05:26 +0000 (03:05 -0700)]
Preserve colors and formatting across screen size changes

Currently, getTranscriptText() has no option for preserving
color/formatting information, so this information is lost when resizing
the screen.  Fix this by adding a variant of getTranscriptText() which
accepts a StringBuilder in which color information will be stored, and
using it during resize operations.

To save memory, this implementation only preserves color information for
regions of the screen which contain text, so blank areas of the screen
with colored backgrounds will still revert to the default background
color.

(Why StringBuilder?  Post-Unicode, we cannot store information in the
upper bits of a char, as we would have before.  An ArrayList<Byte> would
be the most natural fit, but the need to box the values creates serious
memory overhead.  StringBuilder handles dynamic sizing of the array for
us and uses less memory per cell than an ArrayList.)

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoAdd a hack to remember the cursor position across screen size changes
Steven Luo [Tue, 11 Oct 2011 10:05:20 +0000 (03:05 -0700)]
Add a hack to remember the cursor position across screen size changes

As it stands, the cursor ends up immediately after the last
non-whitespace character in the transcript after a screen resize, which
is very frequently incorrect (the last character in the output is
often a space or newline, and it's possible the cursor has been moved,
as during command line editing).

Since lines could be re-wrapped during the screen size update, there's
no easy way to calculate where the cursor should end up.  Therefore, we
use a hack: since ASCII ESC (\033) is non-printable and should never be
part of the transcript, we mark the cursor location with an ESC before
resizing, and restore the cursor to the location where the ESC ends up
afterwards (taking care to save and restore the real character at the
cursor position correctly).

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoReturn empty ExtractedText instead of null from getExtractedText()
Steven Luo [Tue, 11 Oct 2011 10:05:11 +0000 (03:05 -0700)]
Return empty ExtractedText instead of null from getExtractedText()

This silences the following error message in logs:

E/InputMethodService(29043): Unexpected null in startExtractingText : mExtractedText = null, input connection = com.android.internal.view.InputConnectionWrapper@405ef968

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoHide the soft keyboard when pausing the activity
Steven Luo [Tue, 11 Oct 2011 10:04:48 +0000 (03:04 -0700)]
Hide the soft keyboard when pausing the activity

Otherwise, the keyboard will remain open after the user leaves the
activity, possibly covering up part of whatever the user is now doing.

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoReturn early from charWidth() for all ASCII printable chars, not just space
Steven Luo [Tue, 11 Oct 2011 10:04:33 +0000 (03:04 -0700)]
Return early from charWidth() for all ASCII printable chars, not just space

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoFix off-by-one error in getting selected text
Steven Luo [Tue, 11 Oct 2011 10:04:15 +0000 (03:04 -0700)]
Fix off-by-one error in getting selected text

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoFix getTranscriptText() behavior with autowrapped lines
Steven Luo [Tue, 11 Oct 2011 10:04:10 +0000 (03:04 -0700)]
Fix getTranscriptText() behavior with autowrapped lines

Since the Unicode patches, internalGetTranscriptText() has been
ignoring trailing whitespace for lines that were autowrapped, which
causes the content which was wrapped to the next line to be appended
immediately after the last printing character -- not its original
location.  This patch fixes that regression.

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoAvoid going off end of offset array when going from width 2 to 1 at end of line
Steven Luo [Tue, 11 Oct 2011 10:04:06 +0000 (03:04 -0700)]
Avoid going off end of offset array when going from width 2 to 1 at end of line

Why this is happening is somewhat puzzling in the first place (since a
width 2 character doesn't fit at the end of the line), but this prevents
a crash.

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agogetEastAsianWidth: Actually invoke method after initializing when first called
Jack Palevich [Sat, 22 Oct 2011 02:39:41 +0000 (19:39 -0700)]
getEastAsianWidth: Actually invoke method after initializing when first called

Signed-off-by: Jack Palevich <jackpal@google.com>
12 years agoUpdate project organization for SDK version 14
Jack Palevich [Sat, 22 Oct 2011 02:37:20 +0000 (19:37 -0700)]
Update project organization for SDK version 14

12 years agoEnable code to run pre-SDK-level 8.
Jack Palevich [Mon, 10 Oct 2011 00:14:21 +0000 (17:14 -0700)]
Enable code to run pre-SDK-level 8.

Introduce a utility class to deal with post-SDK-level-3 APIs.

Cache the SDK level as an integer at start-up.

Use reflection to access post-SDK-level-3 APIs.

Add early out for space character, which shows up frequently.

12 years agoMicro optimization: avoid unnescessary shifts.
Jack Palevich [Mon, 10 Oct 2011 00:09:57 +0000 (17:09 -0700)]
Micro optimization: avoid unnescessary shifts.

12 years agoShorten UI message for "Default to UTF-8 mode".
Jack Palevich [Mon, 10 Oct 2011 00:08:44 +0000 (17:08 -0700)]
Shorten UI message for "Default to UTF-8 mode".

The original message text, while more accurate, did not fit in the UI.

12 years agoRestore SCREEN_CHECK_PERIOD constant.
Jack Palevich [Sun, 9 Oct 2011 22:15:34 +0000 (15:15 -0700)]
Restore SCREEN_CHECK_PERIOD constant.

(I think Steven has a patch in his source tree that removes the need to
use SCREEN_CHECK_PERIOD, but that patch wasn't accepted for the main
branch, so SCREEN_CHECK_PERIOD is unused in Steven's tree, but is still
required for the main branch.)

12 years agoSupport for Unicode text input and UTF-8 I/O to process
Steven Luo [Sat, 1 Oct 2011 05:48:47 +0000 (22:48 -0700)]
Support for Unicode text input and UTF-8 I/O to process

* Ensure all output paths produce UTF-8
* Decode UTF-8 sequences in the input
* Support switching to/from UTF-8 mode using ESC % escape codes
* Add a preference to control whether the emulator is in UTF-8 mode by
  default

Signed-off-by: Jack Palevich <jack.palevich@gmail.com>
12 years agoSupport displaying Unicode text
Steven Luo [Sat, 1 Oct 2011 05:48:35 +0000 (22:48 -0700)]
Support displaying Unicode text

The current scheme, whereby we store the contents of our screen in an
array of char (two bytes in Java) with the upper byte used to encode
color and formatting information, is fundamentally incompatible with
Unicode, where the available encodings all either need more than one
byte per character or are variable-length encodings.

Instead, we use a new UnicodeTranscript class, which stores the
transcript row by row and includes facilities to handle combining
characters and East Asian wide characters.

We also need to make some minor changes to the code which displays text
on screen to support Unicode output.

Signed-off-by: Jack Palevich <jack.palevich@gmail.com>
12 years agoAdd a transcript backing store suitable for Unicode text
Steven Luo [Sat, 1 Oct 2011 05:48:23 +0000 (22:48 -0700)]
Add a transcript backing store suitable for Unicode text

Storing Unicode text in a form suitable for a terminal emulator poses
several challenges:

* In Java's native UTF-16 encoding, some Unicode code points (those
  outside the Basic Multilingual Plane) require two chars to express.
* The use of combining characters means that it's possible for the
  character displayed in one column/screen position to require several
  Unicode code points to express.
* Some Unicode code points (particularly East Asian wide characters,
  which include all of the CJK ideographs) take up two columns/screen
  positions.

The UnicodeTranscript class is designed to make the operations we need
most frequently -- storing a character to a particular screen position,
and getting all or part of a line -- as fast as possible.  The design
uses an array of two types of lines: "basic", which is just an array of
char[], and is used to store a line as long as it has no combining
characters, wide characters, or non-BMP characters; and "full", which is
an array of char[] together with an array of offsets allowing us to
easily find a particular column in the line.  Basic lines in the
transcript are automatically converted to full lines as needed.
Color/formatting information and line wrapping information are stored in
separate arrays.

We also expose a static method, charWidth(), which returns the number of
columns/screen positions that a particular Unicode code point will use.
This information is needed by other parts of the emulator to correctly
handle Unicode.

Correct support for East Asian wide characters requires Android 2.2 or
later -- 2.2 introduced a getEastAsianWidth() method, which we use to
determine the width of a character.  On older platforms, we just pretend
all characters which aren't combining or control characters have width
1.

Signed-off-by: Jack Palevich <jack.palevich@gmail.com>
12 years agoOptimize getTranscriptText()
Steven Luo [Sat, 1 Oct 2011 05:48:08 +0000 (22:48 -0700)]
Optimize getTranscriptText()

The current implementation is going through each line character by
character, even for lines that are known to be unwanted in the final
output; this is silly and easy to fix.

Signed-off-by: Jack Palevich <jack.palevich@gmail.com>
12 years agoBasque localization.
Jack Palevich [Thu, 29 Sep 2011 04:56:45 +0000 (21:56 -0700)]
Basque localization.

Courtesy asier.iturralde@gmail.com

12 years agoUpdate Italian translations
Jack Palevich [Thu, 29 Sep 2011 04:42:00 +0000 (21:42 -0700)]
Update Italian translations

Courtesy fireb33@gmail.com

12 years agoGenerate native code for x86 as well as armeabi.
Jack Palevich [Sun, 18 Sep 2011 17:13:05 +0000 (10:13 -0700)]
Generate native code for x86 as well as armeabi.

In theory this will allow Android Terminal Emulator to run on an
x86 version of Android.

12 years agoUpdate config file for latest Android SDK
Jack Palevich [Sun, 18 Sep 2011 17:11:20 +0000 (10:11 -0700)]
Update config file for latest Android SDK

12 years agoUpdate private build tool to support NDK r6b
Jack Palevich [Sun, 18 Sep 2011 17:09:24 +0000 (10:09 -0700)]
Update private build tool to support NDK r6b

12 years agoIncrement version number.
Jack Palevich [Mon, 29 Aug 2011 23:52:45 +0000 (16:52 -0700)]
Increment version number.

12 years agoHandle fractional-pixel-width fixed-width fonts.
Jack Palevich [Sun, 28 Aug 2011 18:34:21 +0000 (11:34 -0700)]
Handle fractional-pixel-width fixed-width fonts.

This should fix the problems people have been having with text rendering
when using non-standard fixed-width fonts.