Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ca055bb25 | ||
|
|
ce7ad530cd | ||
|
|
d0015cbe82 | ||
|
|
9e19217f8f | ||
|
|
048af64093 | ||
|
|
a8f7bf1b6e | ||
|
|
62e229e184 |
@@ -18,8 +18,8 @@ android {
|
|||||||
applicationId "com.termux"
|
applicationId "com.termux"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 28
|
versionCode 30
|
||||||
versionName "0.28"
|
versionName "0.30"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -525,6 +525,10 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
|||||||
}
|
}
|
||||||
|
|
||||||
registerReceiver(mBroadcastReceiever, new IntentFilter(RELOAD_STYLE_ACTION));
|
registerReceiver(mBroadcastReceiever, new IntentFilter(RELOAD_STYLE_ACTION));
|
||||||
|
|
||||||
|
// The current terminal session may have changed while being away, force
|
||||||
|
// a refresh of the displayed terminal:
|
||||||
|
mTerminalView.onScreenUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ final class TermuxInstaller {
|
|||||||
if (arch.startsWith("arm") || arch.equals("aarch64")) {
|
if (arch.startsWith("arm") || arch.equals("aarch64")) {
|
||||||
// Handle different arm variants such as armv7l:
|
// Handle different arm variants such as armv7l:
|
||||||
arch = "arm";
|
arch = "arm";
|
||||||
} else if (arch.equals("x86_64")) {
|
} else if (arch.startsWith("x86")) { // "x86" on arcwelder, "x86_64" on 64-bit android.
|
||||||
arch = "i686";
|
arch = "i686";
|
||||||
}
|
}
|
||||||
return new URL("https://termux.net/bootstrap/bootstrap-" + arch + ".zip");
|
return new URL("https://termux.net/bootstrap/bootstrap-" + arch + ".zip");
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.database.Cursor;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.webkit.MimeTypeMap;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@@ -15,7 +16,7 @@ import java.io.FileNotFoundException;
|
|||||||
public class TermuxFilePickerProvider extends ContentProvider {
|
public class TermuxFilePickerProvider extends ContentProvider {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreate() {
|
public boolean onCreate() {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -25,7 +26,20 @@ public class TermuxFilePickerProvider extends ContentProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getType(@NonNull Uri uri) {
|
public String getType(@NonNull Uri uri) {
|
||||||
return null;
|
String contentType = null;
|
||||||
|
String path = uri.getPath();
|
||||||
|
int lastDotIndex = path.lastIndexOf('.');
|
||||||
|
String possibleFileExtension = path.substring(lastDotIndex + 1, path.length());
|
||||||
|
if (possibleFileExtension.contains("/")) {
|
||||||
|
// The dot was in the path, so not a file extension.
|
||||||
|
} else {
|
||||||
|
MimeTypeMap mimeTypes = MimeTypeMap.getSingleton();
|
||||||
|
// Lower casing makes it work with e.g. "JPG":
|
||||||
|
contentType = mimeTypes.getMimeTypeFromExtension(possibleFileExtension.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contentType == null) contentType = "application/octet-stream";
|
||||||
|
return contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -425,9 +425,9 @@ public final class TerminalEmulator {
|
|||||||
processCodePoint((codePoint & 0x7F) + 0x40);
|
processCodePoint((codePoint & 0x7F) + 0x40);
|
||||||
} else {
|
} else {
|
||||||
switch (Character.getType(codePoint)) {
|
switch (Character.getType(codePoint)) {
|
||||||
case Character.UNASSIGNED:
|
case Character.UNASSIGNED:
|
||||||
case Character.SURROGATE:
|
case Character.SURROGATE:
|
||||||
codePoint = UNICODE_REPLACEMENT_CHAR;
|
codePoint = UNICODE_REPLACEMENT_CHAR;
|
||||||
}
|
}
|
||||||
processCodePoint(codePoint);
|
processCodePoint(codePoint);
|
||||||
}
|
}
|
||||||
@@ -474,16 +474,19 @@ public final class TerminalEmulator {
|
|||||||
else
|
else
|
||||||
mSession.onBell();
|
mSession.onBell();
|
||||||
break;
|
break;
|
||||||
case 8: // BS
|
case 8: // Backspace (BS, ^H).
|
||||||
setCursorCol(Math.max(mLeftMargin, mCursorCol - 1));
|
setCursorCol(Math.max(mLeftMargin, mCursorCol - 1));
|
||||||
break;
|
break;
|
||||||
case 9: // Horizontal tab - move to next tab stop, but not past edge of screen
|
case 9: // Horizontal tab (HT, \t) - move to next tab stop, but not past edge of screen
|
||||||
int nextTabStop = nextTabStop(1);
|
// XXX: Should perhaps use color if writing to new cells. Try with
|
||||||
while (mCursorCol < nextTabStop) {
|
// printf "\033[41m\tXX\033[0m\n"
|
||||||
// Emit newlines to get background color right.
|
// The OSX Terminal.app colors the spaces from the tab red, but xterm does not.
|
||||||
processCodePoint(' ');
|
// Note that Terminal.app only colors on new cells, in e.g.
|
||||||
}
|
// printf "\033[41m\t\r\033[42m\tXX\033[0m\n"
|
||||||
break;
|
// the first cells are created with a red background, but when tabbing over
|
||||||
|
// them again with a green background they are not overwritten.
|
||||||
|
mCursorCol = nextTabStop(1);
|
||||||
|
break;
|
||||||
case 10: // Line feed (LF, \n).
|
case 10: // Line feed (LF, \n).
|
||||||
case 11: // Vertical tab (VT, \v).
|
case 11: // Vertical tab (VT, \v).
|
||||||
case 12: // Form feed (FF, \f).
|
case 12: // Form feed (FF, \f).
|
||||||
@@ -1331,7 +1334,7 @@ public final class TerminalEmulator {
|
|||||||
continueSequence(ESC_CSI_ARGS_ASTERIX);
|
continueSequence(ESC_CSI_ARGS_ASTERIX);
|
||||||
break;
|
break;
|
||||||
case '@': {
|
case '@': {
|
||||||
// "CSI{n}@" - Insert ${n} space characters (ICH) - http://www.vt100.net/docs/vt510-rm/ICH.
|
// "CSI{n}@" - Insert ${n} space characters (ICH) - http://www.vt100.net/docs/vt510-rm/ICH.
|
||||||
mAboutToAutoWrap = false;
|
mAboutToAutoWrap = false;
|
||||||
int columnsAfterCursor = mColumns - mCursorCol;
|
int columnsAfterCursor = mColumns - mCursorCol;
|
||||||
int spacesToInsert = Math.min(getArg0(1), columnsAfterCursor);
|
int spacesToInsert = Math.min(getArg0(1), columnsAfterCursor);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import java.util.Properties;
|
|||||||
public final class TerminalView extends View {
|
public final class TerminalView extends View {
|
||||||
|
|
||||||
/** Log view key and IME events. */
|
/** Log view key and IME events. */
|
||||||
private static final boolean LOG_KEY_EVENTS = true;
|
private static final boolean LOG_KEY_EVENTS = false;
|
||||||
|
|
||||||
/** The currently displayed terminal session, whose emulator is {@link #mEmulator}. */
|
/** The currently displayed terminal session, whose emulator is {@link #mEmulator}. */
|
||||||
TerminalSession mTermSession;
|
TerminalSession mTermSession;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<string name="help">Help</string>
|
<string name="help">Help</string>
|
||||||
|
|
||||||
<string name="welcome_dialog_title">Welcome to Termux</string>
|
<string name="welcome_dialog_title">Welcome to Termux</string>
|
||||||
<string name="welcome_dialog_body">Long press anywhere on the terminal for a context menu where Help is available.\n\nExecute \'apt update\' to update the packages list before installing packages.</string>
|
<string name="welcome_dialog_body">Long press and select <i>More…</i> to show a menu where <i>Help</i> is available.\n\nExecute <b>apt update</b> to update the packages list before installing packages.</string>
|
||||||
<string name="welcome_dialog_dont_show_again_button">Do not show again</string>
|
<string name="welcome_dialog_dont_show_again_button">Do not show again</string>
|
||||||
|
|
||||||
<string name="bootstrap_installer_body">Installing…</string>
|
<string name="bootstrap_installer_body">Installing…</string>
|
||||||
|
|||||||
@@ -163,7 +163,12 @@ public class CursorAndScreenTest extends TerminalTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHorizontalTabColorsBackground() {
|
/**
|
||||||
|
* See comments on horizontal tab handling in TerminalEmulator.java.
|
||||||
|
*
|
||||||
|
* We do not want to color already written cells when tabbing over them.
|
||||||
|
*/
|
||||||
|
public void DISABLED_testHorizontalTabColorsBackground() {
|
||||||
withTerminalSized(10, 3).enterString("\033[48;5;15m").enterString("\t");
|
withTerminalSized(10, 3).enterString("\033[48;5;15m").enterString("\t");
|
||||||
assertCursorAt(0, 8);
|
assertCursorAt(0, 8);
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
|
|||||||
@@ -258,4 +258,9 @@ public class TerminalTest extends TerminalTestCase {
|
|||||||
withTerminalSized(3, 3).enterString("abc\r ").assertLinesAre(" bc", " ", " ").assertCursorAt(0, 1);
|
withTerminalSized(3, 3).enterString("abc\r ").assertLinesAre(" bc", " ", " ").assertCursorAt(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testTab() {
|
||||||
|
withTerminalSized(11, 2).enterString("01234567890\r\tXX").assertLinesAre("01234567XX0", " ");
|
||||||
|
withTerminalSized(11, 2).enterString("01234567890\033[44m\r\tXX").assertLinesAre("01234567XX0", " ");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user