Fix issue where terminal cursor blinking would not automatically start again if termux activity was restarted after exiting it with double back press

This commit is contained in:
agnostic-apollo
2021-06-10 08:03:12 +05:00
parent f545ebf0bd
commit e119d34bca
5 changed files with 36 additions and 3 deletions

View File

@@ -60,6 +60,8 @@ public class TermuxTerminalViewClient extends TermuxTerminalViewClientBase {
private boolean mShowSoftKeyboardIgnoreOnce;
private boolean mShowSoftKeyboardWithDelayOnce;
private boolean mTerminalCursorBlinkerStateAlreadySet;
private static final String LOG_TAG = "TermuxTerminalViewClient";
public TermuxTerminalViewClient(TermuxActivity activity, TermuxTerminalSessionClient termuxTerminalSessionClient) {
@@ -95,8 +97,7 @@ public class TermuxTerminalViewClient extends TermuxTerminalViewClientBase {
// Show the soft keyboard if required
setSoftKeyboardState(true, false);
// Start terminal cursor blinking if enabled
setTerminalCursorBlinkerState(true);
mTerminalCursorBlinkerStateAlreadySet = false;
}
/**
@@ -118,6 +119,23 @@ public class TermuxTerminalViewClient extends TermuxTerminalViewClientBase {
setTerminalCursorBlinkerState(true);
}
/**
* Should be called when {@link com.termux.view.TerminalView#mEmulator}
*/
@Override
public void onEmulatorSet() {
if (!mTerminalCursorBlinkerStateAlreadySet) {
// Start terminal cursor blinking if enabled
// We need to wait for the first session to be attached that's set in
// TermuxActivity.onServiceConnected() and then the multiple calls to TerminalView.updateSize()
// where the final one eventually sets the mEmulator when width/height is not 0. Otherwise
// blinker will not start again if TermuxActivity is started again after exiting it with
// double back press. Check TerminalView.setTerminalCursorBlinkerState().
setTerminalCursorBlinkerState(true);
mTerminalCursorBlinkerStateAlreadySet = true;
}
}
@Override