这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
a2df7d7
Fixed: Fix bootstrap not installing on app install
agnostic-apollo Jun 18, 2022
5fc2b4c
Added: Add `SCROLL` extra key to toggle auto scrolling of terminal to…
agnostic-apollo Jun 18, 2022
f1d411a
Fixed: Fix shared terminal transcript joining back lines
agnostic-apollo Jun 18, 2022
4646aca
Added: Start termux app docs support at https://termux.dev/docs/apps/…
agnostic-apollo Jun 20, 2022
605dd6c
Added: Add check for if Termux has been granted Display Over Apps Per…
agnostic-apollo Jul 5, 2022
2113407
Added: Add multi language i18n support for docs per termux/termux.git…
agnostic-apollo Jul 17, 2022
061dc77
rename dev_keystore.jks to testkey_untrusted.jks
Sep 21, 2022
6c56073
readme: add notes about test keystore
Sep 21, 2022
8c1749e
Added|Changed: Add `AppSharedPreferences` to hold `SharedPreferences`…
agnostic-apollo Sep 28, 2022
63d035c
Changed: Update phantom process links
agnostic-apollo Oct 3, 2022
0c14c29
Changed: Use `ShareUtils` to copy and paste text and prevent potentia…
agnostic-apollo Oct 3, 2022
3f7a939
Added: Add support for `Share selected text` of terminal in long hold…
agnostic-apollo Oct 3, 2022
5bc3d2d
Added: Add `KEY_LAST_PENDING_INTENT_REQUEST_CODE` to `TermuxAPIAppSha…
EduardDurech Oct 12, 2022
3516f19
Update actions/checkout to v3
Sushrut1101 Oct 5, 2022
20dee0e
Update actions/upload-artifact to v3
daywalk3r666 Oct 14, 2022
c8a74dc
feat(KeyHandler): respect modifiers with PgUp and PgDn
thunder-coding Oct 24, 2022
29cf982
Fix GitHub spelling
friederbluemle Oct 27, 2022
cff6cff
Create dependabot.yml
landfillbaby Nov 7, 2022
b1c043d
update WcWidth.java to Unicode 15.0.0
landfillbaby Dec 16, 2022
82f83a2
WcWidth.c: fix typo
landfillbaby Dec 16, 2022
2f5a6f7
WcWidth.c: fix 2nd typo
landfillbaby Dec 16, 2022
c6dce12
Fix GitHub spelling
Young-Lord Jan 13, 2023
2ac7fd1
ci: use termux/upload-release-actions to attach debug builds to new r…
thunder-coding Feb 8, 2023
b800f1c
Added: Add monochrome icon
Sandelinos Sep 16, 2022
9b274f9
Changed: Bump robolectric to 4.9.2
utzcoz Jan 28, 2023
93eafff
Changed: Bump Robolectric to 4.10
utzcoz Apr 16, 2023
c1dca29
[doc](readme)modified the links in file
nikam14 Mar 13, 2023
1240c5c
Revert "[doc](readme)modified the links in file"
2096779623 May 1, 2023
ba1fb85
Changed(README.md): Improved some links to Hyperlinks
nikam14 May 1, 2023
33295de
Changed: Add `PGUP` and `PGDN` extra keys to repetitive keys so that …
agnostic-apollo May 21, 2023
66a9495
Fixed: Fix `SHIFT+PAGE_UP` and `SHIFT+PAGE_DOWN` behaviour to scroll …
agnostic-apollo May 21, 2023
11d8e4f
update readme
May 25, 2023
9d308c2
update readme
Jun 25, 2023
06230f9
Changed: Only show github action builds for pushes to master branch a…
agnostic-apollo Aug 9, 2023
7c262b8
Fixed: Fix toggle toolbar not working due to accidental comment of fu…
agnostic-apollo Aug 14, 2023
55cdef0
Fixed: Allow numbers and hyphens in domain extension for url selector
agnostic-apollo Aug 18, 2023
eef5ac4
Fixed: Fix headings in README.md
agnostic-apollo Aug 22, 2023
32cd8a9
Changed: Remove info from README.md that fornwall is inactive and iss…
Oct 5, 2023
cce78cc
Fixed: Fix dependabot commit format to use convetional commit format
agnostic-apollo Oct 7, 2023
c5b6997
Changed: Bump actions/checkout from 3 to 4
dependabot[bot] Oct 7, 2023
e2f0edf
Chore: Add vim swap files to .gitignore
fornwall Oct 8, 2023
e27f9fa
Changed: Update README with info on how to install termux for android…
agnostic-apollo Oct 19, 2023
6727bbe
Changed: Put GitHub debug keystore information in README in dropdown
agnostic-apollo Oct 19, 2023
c84d480
Changed!: Update commit messages guidelines in README to be more clea…
agnostic-apollo Nov 1, 2023
3b5018b
Changed: Update `Twitter` to `X (Twitter)` in README
agnostic-apollo Nov 2, 2023
e438583
Changed: Bump actions/download-artifact from 3 to 4 (#3736)
dependabot[bot] Jan 1, 2024
8e3a898
Changed: Bump actions/upload-artifact from 3 to 4 (#3735)
dependabot[bot] Jan 1, 2024
882da34
Changed: Bump gradle/wrapper-validation-action from 1 to 2
dependabot[bot] Jan 30, 2024
7b19cd2
Changed: Bump termux/upload-release-action from 4.1.0 to 4.2.0
dependabot[bot] Apr 1, 2024
67f4891
Fixed: Limit max combining characters in TerminalRow to 15 characters…
agnostic-apollo Mar 21, 2024
755b752
Reverted: Revert "ci: use termux/upload-release-actions to attach deb…
agnostic-apollo Apr 16, 2024
2f40df9
Changed: Bump gradle/wrapper-validation-action from 2 to 3
dependabot[bot] Apr 15, 2024
062c977
Added: Request `SET_ALARM` permission to allow broadcasting an intent…
agnostic-apollo Jun 5, 2024
d90be9c
Changed: Update information regarding Google Play in README
fornwall Jun 13, 2024
57e4ef4
Added: Add support for GitHub action builds for `github-releases/**` …
agnostic-apollo Jun 17, 2024
a5de3d3
Fixed: Use current bg color when scrolling with horizontal margins
fornwall Aug 13, 2024
f80b464
Fixed: Improve handling of empty ';' SGR sequences
fornwall Jun 24, 2024
661c375
Make Shift-PgUp and Shift-PgDn scroll by pages rather than lines
joshtriplett Aug 16, 2024
c2d57f2
Added|Fixed: Do not show AutoFill UI on Termux start and add support …
agnostic-apollo Aug 26, 2024
36d811e
Fixed: Parse (but ignore for now) terminal APC sequences
fornwall Sep 17, 2024
438cd73
Added|Changed: Fill `.ws_xpixel` and `.ws_ypixel` in `winsize`
Kruna1Pate1 Nov 16, 2022
a8a69c6
Update latest version in README.md to v0.118.1
Dvd-Znf Jul 25, 2024
4443b65
Fixed: Mark view as important for AutoFill before requesting an AutoFill
AChep Sep 23, 2024
0314259
Added: Terminal CSI reporting of window and cell pixel size
fornwall Sep 26, 2024
6c00f1f
Fixed: Use Canvas.drawTextRun instead of drawText
MatanZ Sep 19, 2022
245158c
Added: Basic MIME type recognition in ContentProvider
TpmKranz Jun 20, 2022
d90e3fb
Fixed: Make ScrollDown escape respect margins
evg-zhabotinsky Sep 25, 2022
8be5333
Fixed: Implement colon separated CSI parameters
fornwall Sep 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
commit-message:
# Prefix all commit messages with "Changed: "
prefix: "Changed"
2 changes: 1 addition & 1 deletion .github/workflows/attach_debug_apks_to_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Clone repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ env.GITHUB_REF }}

Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/debug_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- 'github-releases/**'
pull_request:
branches:
- master
Expand All @@ -18,7 +19,7 @@ jobs:

steps:
- name: Clone repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Build APKs
shell: bash {0}
Expand Down Expand Up @@ -78,47 +79,47 @@ jobs:
fi

- name: Attach universal APK file
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ env.APK_BASENAME_PREFIX }}_universal
path: |
${{ env.APK_DIR_PATH }}/${{ env.APK_BASENAME_PREFIX }}_universal.apk
${{ env.APK_DIR_PATH }}/output-metadata.json

- name: Attach arm64-v8a APK file
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ env.APK_BASENAME_PREFIX }}_arm64-v8a
path: |
${{ env.APK_DIR_PATH }}/${{ env.APK_BASENAME_PREFIX }}_arm64-v8a.apk
${{ env.APK_DIR_PATH }}/output-metadata.json

- name: Attach armeabi-v7a APK file
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ env.APK_BASENAME_PREFIX }}_armeabi-v7a
path: |
${{ env.APK_DIR_PATH }}/${{ env.APK_BASENAME_PREFIX }}_armeabi-v7a.apk
${{ env.APK_DIR_PATH }}/output-metadata.json

- name: Attach x86_64 APK file
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ env.APK_BASENAME_PREFIX }}_x86_64
path: |
${{ env.APK_DIR_PATH }}/${{ env.APK_BASENAME_PREFIX }}_x86_64.apk
${{ env.APK_DIR_PATH }}/output-metadata.json

- name: Attach x86 APK file
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ env.APK_BASENAME_PREFIX }}_x86
path: |
${{ env.APK_DIR_PATH }}/${{ env.APK_BASENAME_PREFIX }}_x86.apk
${{ env.APK_DIR_PATH }}/output-metadata.json

- name: Attach sha256sums file
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ env.APK_BASENAME_PREFIX }}_sha256sums
path: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v3
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Execute tests
run: |
./gradlew test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ local.properties
.idea/
*.iml

# Vim
*.swo
*.swp

# OS-specific files
.DS_Store
.DS_Store?
Expand Down
128 changes: 65 additions & 63 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ android {

signingConfigs {
debug {
storeFile file('dev_keystore.jks')
storeFile file('testkey_untrusted.jks')
keyAlias 'alias'
storePassword 'xrj45yWGLbsO7W0v'
keyPassword 'xrj45yWGLbsO7W0v'
Expand Down Expand Up @@ -142,7 +142,7 @@ android {

dependencies {
testImplementation "junit:junit:4.13.2"
testImplementation "org.robolectric:robolectric:4.4"
testImplementation "org.robolectric:robolectric:4.10"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />

<application
android:name=".app.TermuxApplication"
Expand Down
50 changes: 27 additions & 23 deletions app/src/main/java/com/termux/app/TermuxActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.view.ContextMenu;
Expand All @@ -21,7 +20,6 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.autofill.AutofillManager;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ListView;
Expand All @@ -38,6 +36,7 @@
import com.termux.shared.activity.media.AppCompatActivityUtils;
import com.termux.shared.data.IntentUtils;
import com.termux.shared.android.PermissionUtils;
import com.termux.shared.data.DataUtils;
import com.termux.shared.termux.TermuxConstants;
import com.termux.shared.termux.TermuxConstants.TERMUX_APP.TERMUX_ACTIVITY;
import com.termux.app.activities.HelpActivity;
Expand Down Expand Up @@ -179,7 +178,9 @@ public final class TermuxActivity extends AppCompatActivity implements ServiceCo

private static final int CONTEXT_MENU_SELECT_URL_ID = 0;
private static final int CONTEXT_MENU_SHARE_TRANSCRIPT_ID = 1;
private static final int CONTEXT_MENU_AUTOFILL_ID = 2;
private static final int CONTEXT_MENU_SHARE_SELECTED_TEXT = 10;
private static final int CONTEXT_MENU_AUTOFILL_USERNAME = 11;
private static final int CONTEXT_MENU_AUTOFILL_PASSWORD = 2;
private static final int CONTEXT_MENU_RESET_TERMINAL_ID = 3;
private static final int CONTEXT_MENU_KILL_PROCESS_ID = 4;
private static final int CONTEXT_MENU_STYLING_ID = 5;
Expand Down Expand Up @@ -588,7 +589,7 @@ private void setToggleKeyboardView() {
});

findViewById(R.id.toggle_keyboard_button).setOnLongClickListener(v -> {
//toggleTerminalToolbar();
toggleTerminalToolbar();
return true;
});
}
Expand Down Expand Up @@ -630,17 +631,16 @@ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuIn
TerminalSession currentSession = getCurrentSession();
if (currentSession == null) return;

boolean addAutoFillMenu = false;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
AutofillManager autofillManager = getSystemService(AutofillManager.class);
if (autofillManager != null && autofillManager.isEnabled()) {
addAutoFillMenu = true;
}
}
boolean autoFillEnabled = mTerminalView.isAutoFillEnabled();

menu.add(Menu.NONE, CONTEXT_MENU_SELECT_URL_ID, Menu.NONE, R.string.action_select_url);
menu.add(Menu.NONE, CONTEXT_MENU_SHARE_TRANSCRIPT_ID, Menu.NONE, R.string.action_share_transcript);
if (addAutoFillMenu) menu.add(Menu.NONE, CONTEXT_MENU_AUTOFILL_ID, Menu.NONE, R.string.action_autofill_password);
if (!DataUtils.isNullOrEmpty(mTerminalView.getStoredSelectedText()))
menu.add(Menu.NONE, CONTEXT_MENU_SHARE_SELECTED_TEXT, Menu.NONE, R.string.action_share_selected_text);
if (autoFillEnabled)
menu.add(Menu.NONE, CONTEXT_MENU_AUTOFILL_USERNAME, Menu.NONE, R.string.action_autofill_username);
if (autoFillEnabled)
menu.add(Menu.NONE, CONTEXT_MENU_AUTOFILL_PASSWORD, Menu.NONE, R.string.action_autofill_password);
menu.add(Menu.NONE, CONTEXT_MENU_RESET_TERMINAL_ID, Menu.NONE, R.string.action_reset_terminal);
menu.add(Menu.NONE, CONTEXT_MENU_KILL_PROCESS_ID, Menu.NONE, getResources().getString(R.string.action_kill_process, getCurrentSession().getPid())).setEnabled(currentSession.isRunning());
menu.add(Menu.NONE, CONTEXT_MENU_STYLING_ID, Menu.NONE, R.string.action_style_terminal);
Expand Down Expand Up @@ -668,8 +668,14 @@ public boolean onContextItemSelected(MenuItem item) {
case CONTEXT_MENU_SHARE_TRANSCRIPT_ID:
mTermuxTerminalViewClient.shareSessionTranscript();
return true;
case CONTEXT_MENU_AUTOFILL_ID:
requestAutoFill();
case CONTEXT_MENU_SHARE_SELECTED_TEXT:
mTermuxTerminalViewClient.shareSelectedText();
return true;
case CONTEXT_MENU_AUTOFILL_USERNAME:
mTerminalView.requestAutoFillUsername();
return true;
case CONTEXT_MENU_AUTOFILL_PASSWORD:
mTerminalView.requestAutoFillPassword();
return true;
case CONTEXT_MENU_RESET_TERMINAL_ID:
onResetTerminalSession(session);
Expand Down Expand Up @@ -697,6 +703,13 @@ public boolean onContextItemSelected(MenuItem item) {
}
}

@Override
public void onContextMenuClosed(Menu menu) {
super.onContextMenuClosed(menu);
// onContextMenuClosed() is triggered twice if back button is pressed to dismiss instead of tap for some reason
mTerminalView.onContextMenuClosed(menu);
}

private void showKillSessionDialog(TerminalSession session) {
if (session == null) return;

Expand Down Expand Up @@ -745,15 +758,6 @@ private void toggleKeepScreenOn() {
}
}

private void requestAutoFill() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
AutofillManager autofillManager = getSystemService(AutofillManager.class);
if (autofillManager != null && autofillManager.isEnabled()) {
autofillManager.requestAutofill(mTerminalView);
}
}
}



/**
Expand Down
11 changes: 7 additions & 4 deletions app/src/main/java/com/termux/app/TermuxInstaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.termux.shared.android.PackageUtils;
import com.termux.shared.termux.TermuxConstants;
import com.termux.shared.termux.TermuxUtils;
import com.termux.shared.termux.shell.command.environment.TermuxShellEnvironment;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
Expand Down Expand Up @@ -103,10 +104,8 @@ static void setupBootstrapIfNeeded(final Activity activity, final Runnable whenD

// If prefix directory exists, even if its a symlink to a valid directory and symlink is not broken/dangling
if (FileUtils.directoryFileExists(TERMUX_PREFIX_DIR_PATH, true)) {
File[] PREFIX_FILE_LIST = TERMUX_PREFIX_DIR.listFiles();
// If prefix directory is empty or only contains the tmp directory
if(PREFIX_FILE_LIST == null || PREFIX_FILE_LIST.length == 0 || (PREFIX_FILE_LIST.length == 1 && TermuxConstants.TERMUX_TMP_PREFIX_DIR_PATH.equals(PREFIX_FILE_LIST[0].getAbsolutePath()))) {
Logger.logInfo(LOG_TAG, "The termux prefix directory \"" + TERMUX_PREFIX_DIR_PATH + "\" exists but is empty or only contains the tmp directory.");
if (TermuxFileUtils.isTermuxPrefixDirectoryEmpty()) {
Logger.logInfo(LOG_TAG, "The termux prefix directory \"" + TERMUX_PREFIX_DIR_PATH + "\" exists but is empty or only contains specific unimportant files.");
} else {
whenDone.run();
return;
Expand Down Expand Up @@ -218,6 +217,10 @@ public void run() {
}

Logger.logInfo(LOG_TAG, "Bootstrap packages installed successfully.");

// Recreate env file since termux prefix was wiped earlier
TermuxShellEnvironment.writeEnvironmentToFile(activity);

activity.runOnUiThread(whenDone);

} catch (final Exception e) {
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/com/termux/app/TermuxOpenReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ public Cursor query(@NonNull Uri uri, String[] projection, String selection, Str

@Override
public String getType(@NonNull Uri uri) {
String path = uri.getLastPathSegment();
int extIndex = path.lastIndexOf('.') + 1;
if (extIndex > 0) {
MimeTypeMap mimeMap = MimeTypeMap.getSingleton();
String ext = path.substring(extIndex).toLowerCase();
return mimeMap.getMimeTypeFromExtension(ext);
}
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/termux/app/TermuxService.java
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ private void startTermuxActivity() {
TermuxAppSharedPreferences preferences = TermuxAppSharedPreferences.build(this);
if (preferences == null) return;
if (preferences.arePluginErrorNotificationsEnabled(false))
Logger.showToast(this, this.getString(R.string.error_display_over_other_apps_permission_not_granted), true);
Logger.showToast(this, this.getString(R.string.error_display_over_other_apps_permission_not_granted_to_start_terminal), true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import androidx.annotation.Nullable;

import com.termux.R;
import com.termux.shared.interact.ShareUtils;
import com.termux.shared.termux.shell.command.runner.terminal.TermuxSession;
import com.termux.shared.termux.interact.TextInputDialogUtils;
import com.termux.app.TermuxActivity;
Expand Down Expand Up @@ -183,20 +184,16 @@ public void onSessionFinished(@NonNull TerminalSession finishedSession) {
public void onCopyTextToClipboard(@NonNull TerminalSession session, String text) {
if (!mActivity.isVisible()) return;

ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setPrimaryClip(new ClipData(null, new String[]{"text/plain"}, new ClipData.Item(text)));
ShareUtils.copyTextToClipboard(mActivity, text);
}

@Override
public void onPasteTextFromClipboard(@Nullable TerminalSession session) {
if (!mActivity.isVisible()) return;

ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clipData = clipboard.getPrimaryClip();
if (clipData != null) {
CharSequence paste = clipData.getItemAt(0).coerceToText(mActivity);
if (!TextUtils.isEmpty(paste)) mActivity.getTerminalView().mEmulator.paste(paste.toString());
}
String text = ShareUtils.getTextStringFromClipboardIfSet(mActivity, true);
if (text != null)
mActivity.getTerminalView().mEmulator.paste(text);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,13 @@ public void shareSessionTranscript() {
transcriptText, mActivity.getString(R.string.title_share_transcript_with));
}

public void shareSelectedText() {
String selectedText = mActivity.getTerminalView().getStoredSelectedText();
if (DataUtils.isNullOrEmpty(selectedText)) return;
ShareUtils.shareText(mActivity, mActivity.getString(R.string.title_share_selected_text),
selectedText, mActivity.getString(R.string.title_share_selected_text_with));
}

public void showUrlSelection() {
TerminalSession session = mActivity.getCurrentSession();
if (session == null) return;
Expand All @@ -702,9 +709,7 @@ public void showUrlSelection() {
// Click to copy url to clipboard:
final AlertDialog dialog = new AlertDialog.Builder(mActivity).setItems(urls, (di, which) -> {
String url = (String) urls[which];
ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setPrimaryClip(new ClipData(null, new String[]{"text/plain"}, new ClipData.Item(url)));
Toast.makeText(mActivity, R.string.msg_select_url_copied_to_clipboard, Toast.LENGTH_LONG).show();
ShareUtils.copyTextToClipboard(mActivity, url, mActivity.getString(R.string.msg_select_url_copied_to_clipboard));
}).setTitle(R.string.title_select_url_dialog).create();

// Long press to open URL:
Expand Down Expand Up @@ -789,12 +794,9 @@ public void doPaste() {
if (session == null) return;
if (!session.isRunning()) return;

ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clipData = clipboard.getPrimaryClip();
if (clipData == null) return;
CharSequence paste = clipData.getItemAt(0).coerceToText(mActivity);
if (!TextUtils.isEmpty(paste))
session.getEmulator().paste(paste.toString());
String text = ShareUtils.getTextStringFromClipboardIfSet(mActivity, true);
if (text != null)
session.getEmulator().paste(text);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public void onTerminalExtraKeyButtonClick(View view, String key, boolean ctrlDow
} else if ("PASTE".equals(key)) {
if(mTermuxTerminalSessionActivityClient != null)
mTermuxTerminalSessionActivityClient.onPasteTextFromClipboard(null);
} else if ("SCROLL".equals(key)) {
TerminalView terminalView = mTermuxTerminalViewClient.getActivity().getTerminalView();
if (terminalView != null && terminalView.mEmulator != null)
terminalView.mEmulator.toggleAutoScrollDisabled();
} else {
super.onTerminalExtraKeyButtonClick(view, key, ctrlDown, altDown, shiftDown, fnDown);
}
Expand Down
Loading
Loading