Describe the bug
Often in the interactive Linux CLI one may want to keep a long key from a previous command but modify the command at the start of the previous line. redis-cli allows the convenience of up-arrow to review the previous command, but ctrl+left arrow or ctrl+right arrow for word jumping seems to be broken, and instead prints "5C" to the CLI
To reproduce
Fresh Ubuntu container:
apt update && apt install -y redis-tools
redis-cli -h myredishost
In interactive CLI:
HGETALL MY:INCREDIBLY:LONG:keythattakesalongtimetoscrollthrough123
<UpArrow> # retrieves last command, cursor at end
<ctrl+LeftArrow> # command edited to:
HGETALL MY:INCREDIBLY:LONG:keythattakesalongtimetoscrollthrough1235C
Expected behavior
<ctrl+LeftArrow>
above should jump to the start of the key, or jump by word, but instead it attaches the characters 5C
to the end
Additional information
This is standard behaviour for Linux and other OSes' CLIs, e.g. psql
. It's a fairly common operation to check and then set the same key in quick succession, e.g. an HGETALL followed by an HSET or DEL. This would be more convenient especially with long key names if the ctrl + arrow convention were implemented
Comment From: zhijun42
I've noticed the same issue and it's pretty annoying since such behavior is different from common CLIs. I'm now trying to make some code changes and hopefully can come up with a PR.
Comment From: sundb
From the code from linenoise.c, i don't see we handle the
Comment From: zhijun42
@sundb In linenoise, word jumping was never implemented. I'm using MacOS terminal (xterm).
@coldham10 I just pushed a fix PR (https://github.com/redis/redis/pull/14331) for this, would you like to test it?