Skip to content

Treat ASCII/non-ASCII boundaries as word boundaries in text editing (word deletion, word movement) #5805

Description

@kyu08

For context, I'm Japanese. And I work with Japanese people. So I use Japanese and English in commit messages. (we use English only for proper nouns and technical terms, by the way)

Is your feature request related to a problem? Please describe.

When I write a commit message using Lazygit, ctrl+w deletes consecutive characters regardless of whether they are ASCII or non-ASCII characters.

For example, when the current commit message is 関数名をDoSomethingに変更 (which means rename function name to DoSomething), if I press ctrl+w at the end of the line, all the characters are deleted.

Describe the solution you'd like

ctrl+w only deletes consecutive characters of the same kind (ASCII or non-ASCII).

For example, when the current commit message is 関数名をDoSomethingに変更, if I press ctrl+w at the end of the line, only に変更 is deleted. (ctrl+w deletes only the consecutive non-ASCII characters in this example.)

In addition to this, for consistenc word movement should respect ASCII/non-ASCII boundaries as well.

Describe alternatives you've considered

N/A

Additional context

Many tools I use delete only consecutive characters of the same kind (ASCII or non-ASCII) as the character immediately before the cursor. (e.g. ctrl+w in Vim/Neovim and Claude Code, opt+delete in macOS and Emacs)

For reference, as far as I know these tools delete consecutive characters regardless of whether they are ASCII or non-ASCII characters.

  • ctrl+w in zsh
  • opt+delete in VSCode

@stefanhaller

I've opened a PR with an implementation.

If this sounds reasonable, I'd appreciate a review of my PR. #5804

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions