fix: preserve prompt position after ExternalBreak#1042
Conversation
|
How does this affect normal use? |
This change only affects callers that use the Apologies for the late fix. I should have caught this issue when working on #1035. |
|
Am I misreading this? I thought this change was for everyone? |
The changed code is inside the The core fix is replacing |
…113) ## Summary Add an experimental JSON-RPC 2.0 IPC server for AI agents, IDE extensions, and other external tools to interact with a running arf R session. ### Features - **Transport**: Unix domain sockets (Linux/macOS), Windows named pipes - **Protocol**: JSON-RPC 2.0 over HTTP (curl-compatible) or raw JSON - **`evaluate` method**: Silent or visible evaluation with captured stdout/value/error via WriteConsoleEx interception - **`user_input` method**: Inject code into the REPL via reedline's `ExternalBreak` signal (nushell/reedline#1035), with full echo, history, spinner, and duration tracking - **`send` method**: Alias for `user_input` - **`:ipc` meta command**: Start/stop/check server status at runtime - **`arf ipc` subcommand**: CLI client for eval/send/list/status from another terminal - **Session discovery**: `~/.cache/arf/sessions/<pid>.json`, cleaned up on exit ### Safety - Mutual exclusion with console input: IPC requests are rejected with `USER_IS_TYPING` (-32003) when the user has typed something in the buffer - Alternate screen modes (help pager, history browser, shell mode): IPC requests are rejected immediately with `R_NOT_AT_PROMPT` (-32001) - Prompt position is preserved after rejected ExternalBreak (reedline fix: nushell/reedline#1042) ### Tests - 7 cross-platform IPC unit tests (protocol, evaluate, user_input) - 6 PTY integration tests (evaluate capture, visible/silent modes, user_input, rejection, prompt position)
|
ah, ok. I missed that. I guess this isn't an issue anymore since you closed it? |
|
I'm sorry, it was an accident. |
|
Thanks |
|
Thanks for the quick review! |
Follow-up to #1035.
In #1035, when a caller handles
ExternalBreakby callingread_line()again (e.g., to resume editing after inspecting the buffer), the prompt jumps down one line each time.This is because
move_cursor_to_end()unconditionally prints a CRLF before returningExternalBreak.This PR replaces
move_cursor_to_end()with savingsuspended_state, matching the pattern used byExecuteHostCommand.The updated example demonstrates resuming
read_line()afterExternalBreak.