Skip to content

cli: word boundary navigation inconsistent with other applications #120751

Open
@stevendanna

Description

@stevendanna

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 backward-word-delete, it will delete all of some_func(hello. Other applications such as psql only delete hello.

The libedit behaviour is likely:

/* ce__isword():
 *	Return if p is part of a word according to emacs
 */
libedit_private int
ce__isword(wint_t p)
{
	return iswalnum(p) || wcschr(L"*?_-.[]~=", p) != NULL;
}

GNU readline seems to use rl_alphabetic which depends on some internal config and some conditional compilation:

int _rl_allow_pathname_alphabetic_chars = 0;
static const char * const pathname_alphabetic_chars = "/-_=~.#$";

_rl_walphabetic (WCHAR_T wc)
{
  int c;

  if (iswalnum (wc))
    return (1);     

  c = wc & 0177;
  return (_rl_allow_pathname_alphabetic_chars &&
	    strchr (pathname_alphabetic_chars, c) != NULL);
}

Jira issue: CRDB-36856

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cli-clientCLI commands that pertain to using SQL featuresC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions