Commit Graph

35 Commits

Author SHA1 Message Date
agnostic-apollo
49f53f55f3 Renamed TextDataUtils to DataUtils 2021-03-28 09:08:45 +05:00
agnostic-apollo
c9e18e5b93 Refactor TermuxActivity
This commit majorly refactors `TermuxActivity` and moves its view components and functions into dedicated classes.

- The view layouts and ids have been given meaningful names, like `termux_activity.xml`.
- The `TerminalToolbarViewPager` class has been created to handle the now called toolbar that shows on the bottom of the terminal view. It currently contains extra keys view defined by `terminal_toolbar_extra_keys_view.xml` file and a text input view defined by `terminal_toolbar_text_input_view.xml` file when user can switch to by swiping left. The input text will now be preserved if android destroys the activity or its recreated.
- The `TermuxSessionsListViewController` class has been created to handle view related functionality of the termux sessions list shown in the left drawer, namely view creation, `onItemClick()`, `onItemLongClick()`, etc. Its list view is defined by `termux_activity.xml` file and each item's layout is defined by the `terminal_sessions_list_item.xml` file.
- The `TextDataUtils` class has been added to the `com.termux.app.utils` package for text utils.
- The design for the `SessionChangedCallback` interface for `TerminalSession` has been majorly changed. Firstly, it has been renamed and moved from `TerminalSession` to the dedicated `TerminalSessionClient` class file. The interface now also supports the termux app centralized logging framework so that `TerminalSession` and `TerminalEmulator` can use them. Previously, `TermuxService` was implementing a wrapper interface, which would then call the real interface defined by the `TermuxActivity` if it was currently bound to the service. This cluttered and partially duplicated the code. Now, the implementation is defined by the `TermuxSessionClientBase` and `TermuxSessionClient` classes. The `TermuxSessionClientBase` implements the `TerminalSessionClient` interface but the definition of the activity related functions do not do anything, only the background ones like the logging functions are fully implemented. The `TermuxSessionClient` class inherits from the `TermuxSessionClientBase` class and provides the implementation for the activity related functions. The design for how this works is that if the `TermuxService` is not bound to `TermuxActivity`, it just passes the `TermuxSessionClientBase` implementation to `TerminalSession`. If the activity is bound at some point, then in `onServiceConnected()` it replaces/updates the client objects stored in `TerminalSession` and `TerminalEmulator` with `TermuxSessionClient`, and then replaces them back with `TermuxSessionClientBase` in `onDestroy()`. This seems to be working for now without an issue.
2021-03-16 05:01:09 +05:00
Daniel Lublin
1819087ca0 Add tests for URL fragment 2020-03-24 23:13:14 +01:00
Fredrik Fornwall
fd13f3f98d Handle magnet links with termux-url-opener
Fixes #1339 and #1382.
2020-01-05 01:02:47 +01:00
Fredrik Fornwall
009de5a3ee Split up into modules and add float module
Split the app/ module into three modules

terminal/ - Terminal emulator library module.
view/ - Terminal view library module (depending on terminal/).
app/ - The main Termux app (depending on view/).

Also add the

float/ - The Termux:Float app (depending on view/).
2017-04-01 19:06:02 +02:00
Fredrik Fornwall
d48b438c40 Test wcwidth on two more code points 2016-12-30 02:39:01 +01:00
Fredrik Fornwall
a2cb3fafee Fix numpad 0 and . key handling
Fixes #146.
2016-09-05 23:11:25 +02:00
Fredrik Fornwall
64c23f498f Implement true (24-bit) color 2016-08-27 00:32:38 +02:00
Fredrik Fornwall
4609dd71c6 Switch KEYCODE_HOME -> KEYCODE_MOVE_HOME in tests 2016-08-12 06:13:26 +02:00
Fredrik Fornwall
f9c642c672 Support Unicode 9 for wcwidth (don't squash emojis) 2016-08-04 23:58:09 +02:00
Fredrik Fornwall
a020d7c484 Add a wcwidth test 2016-06-22 00:23:38 +02:00
Fredrik Fornwall
491240ee3f Fix MockTerminalOutput to implement all methods 2016-06-08 16:09:42 +02:00
Fredrik Fornwall
ca71265f23 Handle backspace across wrapped lines (closes #59) 2016-03-07 23:45:02 +01:00
Fredrik Fornwall
6ca055bb25 Fix tabs to not overwrite cells 2016-02-25 16:33:00 +01:00
Fredrik Fornwall
1b6919bb23 Add test comment 2016-01-28 16:45:45 +01:00
Fredrik Fornwall
54857d5fd4 Replace surrogate chars with U+FFFD
Also add some more unicode input tests.
2016-01-19 23:11:20 +01:00
Fredrik Fornwall
38dd99e827 Add wcwidth test for U+2060 2016-01-19 23:08:28 +01:00
Fredrik Fornwall
7256b04317 Clear autowrap bit at some escape sequences
Add test adapted from chromiums hterm.
2016-01-19 17:24:18 +01:00
Fredrik Fornwall
b2b39abacd Recognize '\033c' - RIS, reset terminal state 2016-01-19 12:05:38 +01:00
Fredrik Fornwall
c8d2f28ed8 Terminal emulation: Test "CSI X"/ECH processing 2016-01-18 15:15:34 +01:00
Fredrik Fornwall
60bdaa3bf6 Add test for space handling 2016-01-05 03:14:18 +01:00
Fredrik Fornwall
4de0f98fa4 Fix lint warning 2015-12-23 01:08:23 +01:00
Fredrik Fornwall
16273a1981 Fix bug with scrolling down and top scroll margin
The Termux implementation of the ${CSI}${N}T escape sequence to scroll
down N lines (SD - Pan Up) did not take the top margin into account
when figuring out where to place the scrolled rows.

Fixes #28.
2015-12-12 00:07:55 +01:00
Fredrik Fornwall
625aeab398 Reformat code 2015-11-30 00:39:24 +01:00
Fredrik Fornwall
b54c7909bd Fix crash with wide character in last column
Ignore wide character outputs instead of crashing when the cursor
is in the last column with autowrap disabled.
2015-11-29 10:04:50 +01:00
Fredrik Fornwall
7348820caf Add screen wraparound test 2015-11-29 09:36:06 +01:00
Fredrik Fornwall
525985b1f2 Remove some dead code 2015-11-29 08:56:56 +01:00
Fredrik Fornwall
9928073e48 Fix bitwise operation issue 2015-11-29 02:20:37 +01:00
Fredrik Fornwall
74dca95101 Fix inspect code warnings 2015-11-29 01:55:41 +01:00
Fredrik Fornwall
7389dbb56f Fix two Android Studio inspect code warnings 2015-11-29 01:12:27 +01:00
Fredrik Fornwall
d982c71efe Url-regexp: Remove redundant escapes and add test 2015-11-29 01:08:18 +01:00
Fredrik Fornwall
95fbb810e2 Code simplifications 2015-11-29 00:20:45 +01:00
Fredrik Fornwall
1aa439311b Remove some warnings 2015-11-29 00:17:50 +01:00
Fredrik Fornwall
05e250bb96 Fix minor Android Studio inspection warnings 2015-10-25 16:39:34 +01:00
Fredrik Fornwall
a18ee58f7a Initial commit 2015-10-25 15:27:32 +01:00