Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bce65f7db1 | ||
|
|
e18579164f | ||
|
|
16273a1981 | ||
|
|
ce82979e2b |
8
.idea/codeStyleSettings.xml
generated
8
.idea/codeStyleSettings.xml
generated
@@ -63,9 +63,7 @@
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
<XML>
|
||||
<option name="XML_KEEP_LINE_BREAKS" value="false" />
|
||||
<option name="XML_ALIGN_ATTRIBUTES" value="false" />
|
||||
<option name="XML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
||||
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
||||
</XML>
|
||||
<codeStyleSettings language="XML">
|
||||
<option name="FORCE_REARRANGE_MODE" value="1" />
|
||||
@@ -79,7 +77,7 @@
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:android</NAME>
|
||||
<XML_NAMESPACE />
|
||||
<XML_NAMESPACE>Namespace:</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
@@ -89,7 +87,7 @@
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:.*</NAME>
|
||||
<XML_NAMESPACE />
|
||||
<XML_NAMESPACE>Namespace:</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
|
||||
@@ -18,8 +18,8 @@ android {
|
||||
applicationId "com.termux"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 23
|
||||
versionCode 21
|
||||
versionName "0.21"
|
||||
versionCode 22
|
||||
versionName "0.22"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
||||
@@ -293,6 +293,8 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
||||
|
||||
mTerminalView.checkForTypeface();
|
||||
mTerminalView.checkForColors();
|
||||
|
||||
TermuxInstaller.setupStorageSymlink(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
package com.termux.app;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
@@ -26,6 +15,17 @@ import android.view.WindowManager;
|
||||
import com.termux.R;
|
||||
import com.termux.terminal.EmulatorDebug;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
/**
|
||||
* Install the Termux bootstrap packages if necessary by following the below steps:
|
||||
*
|
||||
@@ -200,4 +200,36 @@ final class TermuxInstaller {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setupStorageSymlink(final Context context) {
|
||||
final File[] dirs = context.getExternalFilesDirs(null);
|
||||
if (dirs == null || dirs.length < 2) return;
|
||||
new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
final File externalDir = dirs[1];
|
||||
File homeDir = new File(TermuxService.HOME_PATH);
|
||||
homeDir.mkdirs();
|
||||
File externalLink = new File(homeDir, "storage");
|
||||
|
||||
if (externalLink.exists()) {
|
||||
if (externalLink.getCanonicalPath().equals(externalDir.getPath())) {
|
||||
// Keeping existing link.
|
||||
return;
|
||||
} else {
|
||||
// Removing old link to give place to new.
|
||||
if (!externalLink.delete()) {
|
||||
Log.e("termux", "Unable to remove old $HOME/storage to give place for new");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Os.symlink(externalDir.getAbsolutePath(), externalLink.getAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
Log.e("termux", "Error setting up link", e);
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1444,7 +1444,7 @@ public final class TerminalEmulator {
|
||||
final int linesToScrollArg = getArg0(1);
|
||||
final int linesBetweenTopAndBottomMargins = mBottomMargin - mTopMargin;
|
||||
final int linesToScroll = Math.min(linesBetweenTopAndBottomMargins, linesToScrollArg);
|
||||
mScreen.blockCopy(0, mTopMargin, mColumns, linesBetweenTopAndBottomMargins - linesToScroll, 0, linesToScroll);
|
||||
mScreen.blockCopy(0, mTopMargin, mColumns, linesBetweenTopAndBottomMargins - linesToScroll, 0, mTopMargin + linesToScroll);
|
||||
blockClear(0, mTopMargin, mColumns, linesToScroll);
|
||||
} else {
|
||||
// "${CSI}${func};${startx};${starty};${firstrow};${lastrow}T" - initiate highlight mouse tracking.
|
||||
|
||||
@@ -94,4 +94,8 @@ public class ScrollRegionTest extends TerminalTestCase {
|
||||
withTerminalSized(3, 3).enterString("\033[?69h\033[0;2sABCD\0339").assertLinesAre("B ", "D ", " ");
|
||||
}
|
||||
|
||||
public void testScrollDownWithScrollRegion() {
|
||||
withTerminalSized(2, 5).enterString("1\r\n2\r\n3\r\n4\r\n5").assertLinesAre("1 ", "2 ", "3 ", "4 ", "5 ");
|
||||
enterString("\033[3r").enterString("\033[2T").assertLinesAre("1 ", "2 ", " ", " ", "3 ");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user