cockroachdb / cockroachdb/cockroach
cli: word boundary navigation inconsistent with other applications
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
The bubbletea library we use selects word boundaries based on whitespace:
https://github.com/charmbracelet/bubbles/blob/9030d22eecdf8d17f13f1ef31e5ee74b9d6c673e/textinput/textinput.go#L402-L408
As a result, if your input is (with your cursor at the end of the line):
```
select some_func(hello
```
And you do a Option/Meta-Backspace, it will delete all of `some_func(hello`. Other applications such as `psql` may only delete `hello`. This difference is that in many applications using libreadline Meta-Backspace is bound to a `backword-kill-word` action while Ctrl-W is bound to `unix-word-rubout`. The former considers word boundaries any anything that isn't an alphanumeric whereas the latter considers the word boundary whitespace. Many applications that use libedit bind both to the same behaviour as `unix-word-rubout`.
Perhaps there is nothing to fix here as some users might expect the libedit shortcuts at this point.
Jira issue: CRDB-36856
Epic CRDB-23743
Contributor guide
Research direction
Start with the linked bubbles/textinput/textinput.go lines 402-408 and trace where CockroachDB's CLI input handles Meta-Backspace and Ctrl-W. Compare the current behavior with the examples in the issue, then determine and document the intended word-boundary behavior; done means the chosen behavior is implemented consistently or the issue's no-change decision is recorded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100