ahmednooor / lino

A command line text editor with notepad like key bindings.
MIT License
36 stars 2 forks source link

ctrl-arrow #3

Closed njskalski closed 3 years ago

njskalski commented 3 years ago

Hi!

you editor is almost perfect. Can you please add ctrl-arrow (jumping left-right a single word)?

ahmednooor commented 3 years ago

@njskalski Thank you!

This functionality is already present and tested on Windows Terminal. I am using Crossterm library for terminal interactions including event handling. And perhaps due to the challenge of parsing escape codes of different terminals (specially complex ones like CTRL+LEFT/RIGHT), the library might not be able to cater to all terminals.

Implementation of Ctrl+Left event handling: https://github.com/ahmednooor/lino/blob/main/src/lino/handle.rs#L239-L241 https://github.com/ahmednooor/lino/blob/main/src/lino/keybindings.rs#L37 https://github.com/ahmednooor/lino/blob/main/src/lino/commands.rs#L44-L53 https://github.com/ahmednooor/lino/blob/main/src/lino/cursor.rs#L90-L115

Implementation of Ctrl+Right event handling: https://github.com/ahmednooor/lino/blob/main/src/lino/handle.rs#L261-L263 https://github.com/ahmednooor/lino/blob/main/src/lino/keybindings.rs#L38 https://github.com/ahmednooor/lino/blob/main/src/lino/commands.rs#L54-L63 https://github.com/ahmednooor/lino/blob/main/src/lino/cursor.rs#L117-L142