Skip to content

Suspending Droid (ctrl+z) leaves terminal in CSI-u keyboard mode, breaking shell keybindings. #672

@MaicoTimmerman

Description

@MaicoTimmerman

When suspending the CLI with Ctrl-Z, the terminal is left in CSI-u keyboard mode. After the process is suspended, the shell receives CSI-u encoded key sequences instead of normal control characters, causing keybindings like Ctrl-E to appear as literal escape sequences.

For example, pressing Ctrl-E after suspending shows:

01;5u

instead of moving the cursor to the end of the line. This breaks normal shell interaction until the terminal keyboard mode is manually reset.


Steps to reproduce:

  1. Start droid
  2. Press Ctrl-Z to suspend it
  3. Back in the shell, press Ctrl-E

Actual behavior:

The shell prints literal escape sequences:

01;5u

Expected behavior:

The shell should interpret Ctrl-E normally (move cursor to end of line).


Root cause:

The CLI enables CSI-u keyboard mode (ESC [ > 1 u) but does not disable it (ESC [ < u) when receiving SIGTSTP. Terminal keyboard mode persists after process suspension.


Workaround:

Running the following restores normal behavior:

printf '\033[<u'  # send escape code
reset             # reinitializes terminal

However, resuming droid leaves it in broken state, because the expected bindings do not work.


Suggested fix:

Disable CSI-u keyboard mode on suspend (SIGTSTP) and re-enable it on resume (SIGCONT).


Environment:

  • Terminal: xterm-ghostty|ghostty|Ghostty
  • Shell: zsh
  • OS: MacOS 26.2 (25C56)
  • CLI version: 0.57.17

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions