Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17c4a45212 | ||
|
|
6d9ffb6922 | ||
|
|
8472fce8ba | ||
|
|
69d954a583 | ||
|
|
ec1087d56f | ||
|
|
be6a73d862 | ||
|
|
80c81b274d | ||
|
|
cd9dbac548 | ||
|
|
0c837796f0 | ||
|
|
3417e37e8d | ||
|
|
31ba36e0fa | ||
|
|
c444f1fd28 | ||
|
|
9f36ed06b8 | ||
|
|
c2ab5bcd50 | ||
|
|
48fab33b79 | ||
|
|
8d7a67645b | ||
|
|
186b49d429 | ||
|
|
40a2775f52 | ||
|
|
f802d6001d | ||
|
|
50f66a12da | ||
|
|
d8e6fd21d1 | ||
|
|
0964d83572 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -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
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ ext {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 27
|
compileSdkVersion 27
|
||||||
buildToolsVersion "27.0.2"
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
|
|||||||
@@ -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~");
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user