Skip to content

Make Replxx a modal line editor - #36

Merged
alexey-milovidov merged 8 commits into
ClickHouse:masterfrom
spinojara:vi
Jul 7, 2026
Merged

alexey-milovidov merged 8 commits into
ClickHouse:masterfrom
spinojara:vi

Conversation

@spinojara

Copy link
Copy Markdown

Make Replxx a modal line editor. This is completely backward-compatible since the default editing mode is always 0 if it is not explicitly set. I will later contribute a vi/vim mode to the ClickHouse cli (see https://github.com/spinojara/ClickHouse/tree/vim for a partial implementation). This would make it possible to emulate vi/vim mode inside the ClickHouse cli (e.g. as 'set -o vi' does in bash).

For this we need to be able to parse the escape key as a separate key. This is done through the escDelay variable. By default escDelay is set to 0 which makes Replxx act as before. The changes in src/escape.cxx are many, but are only there to pass the escDelay variable, nothing else.

This patch also adds several new actions which help with emulated vi/vim mode.

Warning: The small windows specific snippet is not actually tested since I do not have access to a windows machine. That is around line 469 in src/terminal.cxx.

@spinojara spinojara changed the title Make Replxx a model line editor Make Replxx a modal line editor Nov 24, 2025
@ClickHouse ClickHouse deleted a comment from CLAassistant Dec 6, 2025
@george-larionov

Copy link
Copy Markdown
Member

Removing the CLAssistant since @spinojara is covered under our corporate CLA with Axis Communications.

@george-larionov

Copy link
Copy Markdown
Member

Could you add some tests for this?

@spinojara

Copy link
Copy Markdown
Author

How do I make tests in this repo? Documentation is lacking, but I assume tests.py? I cannot even build the project on the master branch.

@george-larionov

Copy link
Copy Markdown
Member

@spinojara I don't have much experience with this repo, I'll see if I can get someone else to look at it.

# Conflicts:
#	src/terminal.cxx
@alexey-milovidov

alexey-milovidov commented Jul 7, 2026 •

Copy link
Copy Markdown
Member

@spinojara, could you please sign the CLA? (it's fully online, so it should be quick)

@spinojara

Copy link
Copy Markdown
Author

I have already signed a CCLA, see comment from George above.

@alexey-milovidov alexey-milovidov self-assigned this Jul 7, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

The code LGTM, ready to merge.

@ClickHouse ClickHouse deleted a comment from CLAassistant Jul 7, 2026
@alexey-milovidov
alexey-milovidov merged commit 0e5df37 into ClickHouse:master Jul 7, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

@spinojara Thank you! Now waiting for a PR to the main repo - to toggle the new mode and see it in action.

groeneai added a commit to groeneai/ClickHouse that referenced this pull request Oct 15, 2026
ClickHouse/replxx#50 is merged into `master` of `replxx`, and the copy of
the same fixes on top of the previous pointer (ClickHouse/replxx#51) is
closed. Point the submodule to the merge commit.

This also brings the `master` changes that were not in the previous
pointer: editing modes, `Esc` delay, prompt indentation, per-terminal
state and the Meta+Up fix (ClickHouse/replxx#36, ClickHouse#43, ClickHouse#44, ClickHouse#45, ClickHouse#46, ClickHouse#47,
ClickHouse#48). `04909_client_hints_history_navigation`, which the `Esc` delay
broke before ClickHouse#48, passes 10/10 locally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

3 participants