Using control+left/right arrow to jump between words in the prompt

Hi,

I tried using lldb (and the Swift repl, which uses it), and found it
very annoying that the CTRL+left/right arrow key sequence isn't
handled correctly, spewing ;5D and ;5C instead.

I'm used to be able to hit Ctrl+left/right to jump between words in
almost any editing software.

Is it a feature that would be welcome?

Thanks,
Ori

LLDB's command line editing leaves a lot to be desired. The thing
which annoys me the most is that you get bogus characters inserted if
you press the wrong character (e.g. left arrow) in the incremental
search (^R) mode.

Is it a feature that would be welcome?

Is this an offer to implement the feature? :wink:
If so, I know a couple of people, who would be very pleased by that. :slight_smile:

cheers,
pl

I'm willing to implement it (or at least try :P), but first I wanted to
gauge interest and get approval, as I don't know how the project decides
on new features.

On OS X Ctrl left & right arrow are taken over by the system to move between virtual desktops. Instead, option left & right are the equivalent gesture for move by word on OS X, and in the OS X lldb, option left & right do indeed move by word.

LLDB doesn't do most of this stuff by hand, it lets editline handle it, and so Ctrl-Arrow may be an optional feature you need to enable. I'd have no objection to turning this on for Linux and Windows if that is appropriate. The appropriate equivalent already works for OS X so this seems only fair.

Jim

So anything that is missing can be added to your ~/.editrc file since LLDB uses the editline library and that reads .editrc file.

Examples of what you can add to your .editrc file:

lldb:bind '^[[5C' vi-next-word
lldb:bind '^[[5D' vi-prev-word
lldb:bind '^D' ed-delete-next-char
lldb:bind '^B' ed-command
lldb:bind '^P' ed-search-prev-history
lldb:bind '^N' ed-search-next-history

For more info, just type "man editrc" at your shell command line.

If you think any such bindings should be included by default, please file a bug and suggest what you think should be added by default. If you do add something you should think if the binding should be for vi or emacs bindings by default as these bindings often would differ between the two.

OK.

Pavel, perhaps you should open a separate bug about the arrow behavior
in incremental search mode.