mirror of https://github.com/termux/termux-app
Fix issue where cursor blinker wouldn't automatically start after terminal reset if it was disabled before reset
This commit is contained in:
parent
d3c34ad1f5
commit
00f805f7ec
|
@ -611,7 +611,7 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
|||
requestAutoFill();
|
||||
return true;
|
||||
case CONTEXT_MENU_RESET_TERMINAL_ID:
|
||||
resetSession(session);
|
||||
onResetTerminalSession(session);
|
||||
return true;
|
||||
case CONTEXT_MENU_KILL_PROCESS_ID:
|
||||
showKillSessionDialog(session);
|
||||
|
@ -650,10 +650,13 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
|||
b.show();
|
||||
}
|
||||
|
||||
private void resetSession(TerminalSession session) {
|
||||
private void onResetTerminalSession(TerminalSession session) {
|
||||
if (session != null) {
|
||||
session.reset();
|
||||
showToast(getResources().getString(R.string.msg_terminal_reset), true);
|
||||
|
||||
if (mTermuxTerminalSessionClient != null)
|
||||
mTermuxTerminalSessionClient.onResetTerminalSession();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -205,6 +205,15 @@ public class TermuxTerminalSessionClient extends TermuxTerminalSessionClientBase
|
|||
mActivity.getTerminalView().setTerminalCursorBlinkerState(enabled, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be called when mActivity.onResetTerminalSession() is called
|
||||
*/
|
||||
public void onResetTerminalSession() {
|
||||
// Ensure blinker starts again after reset if cursor blinking was disabled before reset like
|
||||
// with "tput civis" which would have called onTerminalCursorStateChange()
|
||||
mActivity.getTerminalView().setTerminalCursorBlinkerState(true, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
@ -905,6 +905,10 @@ public final class TerminalView extends View {
|
|||
* to be shown. It should also be checked if activity is visible if blinker is to be started
|
||||
* before calling this.
|
||||
*
|
||||
* It should also be called after terminal is reset with {@link TerminalSession#reset()} in case
|
||||
* cursor blinker was disabled before reset due to call to
|
||||
* {@link com.termux.terminal.TerminalSessionClient#onTerminalCursorStateChange(boolean)}.
|
||||
*
|
||||
* How cursor blinker starting works is by registering a {@link Runnable} with the looper of
|
||||
* the main thread of the app which when run, toggles the cursor blinking state and re-registers
|
||||
* itself to be called with the delay set by {@link #mTerminalCursorBlinkerRate}. When cursor
|
||||
|
|
Loading…
Reference in New Issue