Compare commits

..

22 Commits
v0.57 ... v0.61

Author SHA1 Message Date
Fredrik Fornwall
17c4a45212 Bump gradle dependencies 2018-06-15 00:22:52 +02:00
Fredrik Fornwall
6d9ffb6922 Bump version to 0.61 2018-06-15 00:21:27 +02:00
Fredrik Fornwall
8472fce8ba Use lower when looking up mime type from extension
Fixes #721.
2018-06-15 00:19:47 +02:00
Fredrik Fornwall
69d954a583 Update gradle configuration 2018-06-14 23:58:41 +02:00
easyaspi314 (Devin)
ec1087d56f Replace CRLF with CR as well.
This should replace both \r\n and \n with \r now.

"\r?\n" matches 0 or 1 \r and one \n, which should capture both
escape sequences.
2018-06-13 22:45:37 +02:00
easyaspi314 (Devin)
be6a73d862 Replace \n with \r when pasting (Fixes #678)
Termux will now properly send \r to the terminal instead of \n when pasting
multiline strings.

This fixes cat not repeating back lines and nano accidentally justifying
text (because \n maps to ^J), as well as other potential issues.

This matches the behavior of other terminals, such as iTerm2 which explicitly
does it here:
https://github.com/gnachman/iTerm2/blob/f8a5930/sources/iTermPasteHelper.m#L113

Signed-off-by: easyaspi314 (Devin) <easyaspi314@users.noreply.github.com>
2018-06-13 22:45:37 +02:00
l-jonas
80c81b274d Update build.gradle 2018-06-11 12:26:35 +02:00
Jonas L
cd9dbac548 Add Google Repository
The Google-Repository is required for compilation because some dependencies were removed from jcenter()
2018-06-11 12:26:35 +02:00
Fredrik Fornwall
0c837796f0 Update Android plugin for Gradle 2018-06-11 12:23:52 +02:00
Fredrik Fornwall
3417e37e8d Update gitignore for Android Studio 3.1 2018-04-02 01:38:47 +02:00
Fredrik Fornwall
31ba36e0fa Remove explicit buildToolsVersion
https://developer.android.com/studio/releases/gradle-plugin.html#behavior_changes
2018-04-02 00:58:02 +02:00
Fredrik Fornwall
c444f1fd28 Update gradle configuration 2018-04-02 00:40:16 +02:00
RangerMauve
9f36ed06b8 Make TerminalRenderer public
I want to use the renderer with a custom canvas without having to render to an Android View which requires a context and all sorts of stuff.

Can't currently do that because the renderer is package-private
2018-03-10 22:55:10 +01:00
Fredrik Fornwall
c2ab5bcd50 Bump some dependency versions 2018-02-06 23:30:28 +01:00
Fredrik Fornwall
48fab33b79 Bump version to 0.60 2018-01-26 01:00:37 +01:00
Marcel Dopita
8d7a67645b Fix notification icon color
Icons used in notifications/status bar are monochrome and should use only white color and transparency. It is displayed fine on Android emulators but it's shown in black on Samsung Galaxy S7 running Android 7.0.

After the change, status bar icon is white and the small icon in notification still uses the black color set via setColor(). Termux doesn't support devices running Android older than 5.0 but using white color in vector drawables would be also necessary to generate proper (white) bitmap icons.
2018-01-01 23:17:22 +01:00
Fredrik Fornwall
186b49d429 Work around travis API 27 SDK checksum mismatch
See https://github.com/travis-ci/travis-ci/issues/8874.
2018-01-01 23:16:43 +01:00
Fredrik Fornwall
40a2775f52 Bump version to 0.59 2017-12-09 00:59:19 +01:00
Fredrik Fornwall
f802d6001d Do not send mouse clicks out of range (fixes #501) 2017-12-09 00:58:31 +01:00
Fredrik Fornwall
50f66a12da Bump version to 0.58 2017-12-08 23:32:44 +01:00
Fredrik Fornwall
d8e6fd21d1 Set android:resizeableActivity="true"
Setting android:resizeableActivity="true" should AFAIK not be needed
as https://developer.android.com/guide/topics/ui/multi-window.html
states that:

  If your app targets API level 24, but you do not specify a value
  for this attribute, the attribute's value defaults to true.

However, on a Galaxy S8 running Android 7.0 this attribute is needed
in order to have resizeable windows when in Samsung Dex mode.

Fixes #309.
2017-12-08 23:30:45 +01:00
Fredrik Fornwall
0964d83572 Bump com.android.support dependencies 2017-12-07 10:25:02 +01:00
14 changed files with 37 additions and 20 deletions

2
.gitignore vendored
View File

@@ -33,6 +33,8 @@ local.properties
.idea/scopes/scope_settings.xml .idea/scopes/scope_settings.xml
.idea/vcs.xml .idea/vcs.xml
.idea/dictionaries/ .idea/dictionaries/
.idea/caches/
.idea/codeStyles/
*.iml *.iml
# OS-specific files # OS-specific files

View File

@@ -12,13 +12,14 @@ android:
components: components:
- platform-tools - platform-tools
- tools - tools
- build-tools-27.0.2 - build-tools-27.0.3
- android-27 - android-27
- extra-android-m2repository - extra-android-m2repository
before_install: before_install:
- git clone https://github.com/urho3d/android-ndk.git $HOME/android-ndk - git clone https://github.com/urho3d/android-ndk.git $HOME/android-ndk
- export ANDROID_NDK_HOME=$HOME/android-ndk - export ANDROID_NDK_HOME=$HOME/android-ndk
- yes | sdkmanager "platforms;android-27"
script: script:
- ./gradlew testDebugUnitTest - ./gradlew testDebugUnitTest

View File

@@ -2,11 +2,10 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 27 compileSdkVersion 27
buildToolsVersion "27.0.2"
dependencies { dependencies {
implementation 'com.android.support:support-annotations:27.0.1' implementation 'com.android.support:support-annotations:27.1.1'
implementation "com.android.support:support-core-ui:27.0.1" implementation "com.android.support:support-core-ui:27.1.1"
implementation project(":terminal-view") implementation project(":terminal-view")
} }
@@ -14,8 +13,8 @@ android {
applicationId "com.termux" applicationId "com.termux"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 27 targetSdkVersion 27
versionCode 57 versionCode 61
versionName "0.57" versionName "0.61"
} }
buildTypes { buildTypes {

View File

@@ -32,6 +32,7 @@
android:name="com.termux.app.TermuxActivity" android:name="com.termux.app.TermuxActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:launchMode="singleTask" android:launchMode="singleTask"
android:resizeableActivity="true"
android:windowSoftInputMode="adjustResize|stateAlwaysVisible" > android:windowSoftInputMode="adjustResize|stateAlwaysVisible" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@@ -49,6 +50,7 @@
android:exported="false" android:exported="false"
android:theme="@android:style/Theme.Material.Light.DarkActionBar" android:theme="@android:style/Theme.Material.Light.DarkActionBar"
android:parentActivityName=".app.TermuxActivity" android:parentActivityName=".app.TermuxActivity"
android:resizeableActivity="true"
android:label="@string/application_name" /> android:label="@string/application_name" />
<activity <activity
@@ -56,6 +58,7 @@
android:label="@string/application_name" android:label="@string/application_name"
android:taskAffinity="com.termux.filereceiver" android:taskAffinity="com.termux.filereceiver"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:resizeableActivity="true"
android:noHistory="true"> android:noHistory="true">
<!-- Accept multiple file types when sending. --> <!-- Accept multiple file types when sending. -->
<intent-filter> <intent-filter>

View File

@@ -195,7 +195,7 @@ public class TermuxDocumentsProvider extends DocumentsProvider {
final String name = file.getName(); final String name = file.getName();
final int lastDot = name.lastIndexOf('.'); final int lastDot = name.lastIndexOf('.');
if (lastDot >= 0) { if (lastDot >= 0) {
final String extension = name.substring(lastDot + 1); final String extension = name.substring(lastDot + 1).toLowerCase();
final String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); final String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
if (mime != null) return mime; if (mime != null) return mime;
} }

View File

@@ -9,7 +9,7 @@
<!-- Screen border. --> <!-- Screen border. -->
<path android:fillColor="#00000000" <path android:fillColor="#00000000"
android:strokeColor="#000" android:strokeColor="#FFF"
android:strokeWidth="3" android:strokeWidth="3"
android:pathData="M7,4 android:pathData="M7,4
l34,0 l34,0
@@ -23,7 +23,7 @@
/> />
<!-- Block cursor. --> <!-- Block cursor. -->
<path android:fillColor="#000" <path android:fillColor="#FFF"
android:pathData="M14,14 android:pathData="M14,14
l5,0 l5,0
l0,10 l0,10

View File

@@ -4,16 +4,14 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.android.tools.build:gradle:3.1.3'
} }
} }
allprojects { allprojects {
repositories { repositories {
google()
jcenter() jcenter()
maven {
url "https://maven.google.com"
}
} }
} }

Binary file not shown.

View File

@@ -1,5 +1,5 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -18,7 +18,6 @@ ext {
android { android {
compileSdkVersion 27 compileSdkVersion 27
buildToolsVersion "27.0.2"
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21

View File

@@ -301,6 +301,11 @@ public final class TerminalEmulator {
* @param mouseButton one of the MOUSE_* constants of this class. * @param mouseButton one of the MOUSE_* constants of this class.
*/ */
public void sendMouseEvent(int mouseButton, int column, int row, boolean pressed) { public void sendMouseEvent(int mouseButton, int column, int row, boolean pressed) {
if (column < 1) column = 1;
if (column > mColumns) column = mColumns;
if (row < 1) row = 1;
if (row > mRows) row = mRows;
if (mouseButton == MOUSE_LEFT_BUTTON_MOVED && !isDecsetInternalBitSet(DECSET_BIT_MOUSE_TRACKING_BUTTON_EVENT)) { if (mouseButton == MOUSE_LEFT_BUTTON_MOVED && !isDecsetInternalBitSet(DECSET_BIT_MOUSE_TRACKING_BUTTON_EVENT)) {
// Do not send tracking. // Do not send tracking.
} else if (isDecsetInternalBitSet(DECSET_BIT_MOUSE_PROTOCOL_SGR)) { } else if (isDecsetInternalBitSet(DECSET_BIT_MOUSE_PROTOCOL_SGR)) {
@@ -308,7 +313,7 @@ public final class TerminalEmulator {
} else { } else {
mouseButton = pressed ? mouseButton : 3; // 3 for release of all buttons. mouseButton = pressed ? mouseButton : 3; // 3 for release of all buttons.
// Clip to screen, and clip to the limits of 8-bit data. // Clip to screen, and clip to the limits of 8-bit data.
boolean out_of_bounds = column < 1 || row < 1 || column > mColumns || row > mRows || column > 255 - 32 || row > 255 - 32; boolean out_of_bounds = column > 255 - 32 || row > 255 - 32;
if (!out_of_bounds) { if (!out_of_bounds) {
byte[] data = {'\033', '[', 'M', (byte) (32 + mouseButton), (byte) (32 + column), (byte) (32 + row)}; byte[] data = {'\033', '[', 'M', (byte) (32 + mouseButton), (byte) (32 + column), (byte) (32 + row)};
mSession.write(data, 0, data.length); mSession.write(data, 0, data.length);
@@ -2333,6 +2338,9 @@ public final class TerminalEmulator {
public void paste(String text) { public void paste(String text) {
// First: Always remove escape key and C1 control characters [0x80,0x9F]: // First: Always remove escape key and C1 control characters [0x80,0x9F]:
text = text.replaceAll("(\u001B|[\u0080-\u009F])", ""); text = text.replaceAll("(\u001B|[\u0080-\u009F])", "");
// Second: Replace all newlines (\n) or CRLF (\r\n) with carriage returns (\r).
text = text.replaceAll("\r?\n", "\r");
// Then: Implement bracketed paste mode if enabled: // Then: Implement bracketed paste mode if enabled:
boolean bracketed = isDecsetInternalBitSet(DECSET_BIT_BRACKETED_PASTE_MODE); boolean bracketed = isDecsetInternalBitSet(DECSET_BIT_BRACKETED_PASTE_MODE);
if (bracketed) mSession.write("\033[200~"); if (bracketed) mSession.write("\033[200~");

View File

@@ -55,6 +55,14 @@ public class TerminalTest extends TerminalTestCase {
assertEquals("\033[<0;3;4M", mOutput.getOutputAndClear()); assertEquals("\033[<0;3;4M", mOutput.getOutputAndClear());
mTerminal.sendMouseEvent(TerminalEmulator.MOUSE_LEFT_BUTTON, 3, 4, false); mTerminal.sendMouseEvent(TerminalEmulator.MOUSE_LEFT_BUTTON, 3, 4, false);
assertEquals("\033[<0;3;4m", mOutput.getOutputAndClear()); assertEquals("\033[<0;3;4m", mOutput.getOutputAndClear());
// When the client says that a click is outside (which could happen when pixels are outside
// the terminal area, see https://github.com/termux/termux-app/issues/501) the terminal
// sends a click at the edge.
mTerminal.sendMouseEvent(TerminalEmulator.MOUSE_LEFT_BUTTON, 0, 0, true);
assertEquals("\033[<0;1;1M", mOutput.getOutputAndClear());
mTerminal.sendMouseEvent(TerminalEmulator.MOUSE_LEFT_BUTTON, 11, 11, false);
assertEquals("\033[<0;10;10m", mOutput.getOutputAndClear());
} }
public void testNormalization() throws UnsupportedEncodingException { public void testNormalization() throws UnsupportedEncodingException {

View File

@@ -18,10 +18,9 @@ ext {
android { android {
compileSdkVersion 27 compileSdkVersion 27
buildToolsVersion "27.0.2"
dependencies { dependencies {
implementation 'com.android.support:support-annotations:27.0.0' implementation 'com.android.support:support-annotations:27.1.1'
api project(":terminal-emulator") api project(":terminal-emulator")
} }

View File

@@ -16,7 +16,7 @@ import com.termux.terminal.WcWidth;
* <p/> * <p/>
* Saves font metrics, so needs to be recreated each time the typeface or font size changes. * Saves font metrics, so needs to be recreated each time the typeface or font size changes.
*/ */
final class TerminalRenderer { public final class TerminalRenderer {
final int mTextSize; final int mTextSize;
final Typeface mTypeface; final Typeface mTypeface;