nushell / nushell/reedline

Support for custom event handler

Open
#520 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-API A-Events enhancement
Dominant language
Rust
Stars
818
Forks
249
Avg merge
4d 14h
Merged PRs (30d)
30

Description

Support for custom event handler

I am currently using Reedline to develop a console for a custom language. And I am trying to implement the following feature:

  • Automatically add indent when enter is hit but validator says input is incomplete.
>>> if 3:
...     a = 5
...     a<-- next line should start here
  • Automatic delete 4 spaces when delete is hit. My console treats tab as 4 spaces so I bind Tab key to automatically insert 4 spaces but I can not let delete to behave correspondingly. For example, delete 4 space if there are 4 before the cursor, otherwise delete a single character if there is any.
>>>     <-- delete all 4 previous space here
>>> asbds<-- only delete `s` from buffer

There are also an option that a special event is made for indent handling. But it could be more useful and extensive if user defined handler for ReedlineEvent can be supported.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how ReedlineEvent, key bindings, validation, and the Tab binding are handled. Determine how a user-defined event handler could support indentation on incomplete input and context-sensitive deletion. Done means the handler API supports these behaviors without requiring special built-in indent events.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.