Skip to content

Conversation

@func25
Copy link

@func25 func25 commented Nov 28, 2025

Hi, readline already supports word-wise movement and deletion via Alt+Arrow/ Alt+f/ Alt+b/ Ctrl+w, though many terminals send different escape sequences for the same intent. So users often get "move/delete by word" in their shell, but not in programs using this library (e.g., VictoriaMetrics/VictoriaLogs#108).

This change makes readline more forgiving about what terminals send, without changing the exported API or higher‑level behavior:

  • Map ESC + Backspace / ESC + DEL to MetaBackspace so Alt+Backspace deletes the previous word.
  • Treat modifier codes 3, 5, and 7 in cursor sequences (e.g. ESC[1;5D / ESC[1;5C) as "word-wise" arrows, same as Alt+Left/Right (MetaBackward / MetaForward).

Please review. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant