feat/fix: Align the word break behaviour of Aspiers' new text transformation functions more closely with readlines conventions.#211
Conversation
Without this patch, users must manually retype text to change case or paste deleted content in the TUI prompt, and some keybindings conflict with other TUI functions. This is a problem because it slows down text editing and limits the ability to customize keybindings to match user preferences. This patch solves the problem by adding configurable shortcuts for lowercase, uppercase, capitalize word, transpose characters, and yank operations, along with a kill buffer for storing deleted text.
Punctuation characters (., -, etc.) are now treated as word boundaries instead of being part of words, matching the behavior of Readline and Emacs where only alphanumeric characters and underscores are word constituents.
- input_delete_word_backward now uses isWordChar() like other word operations, treating punctuation as word boundaries - Remove duplicate input_transpose_characters handler (dead code) - Add tests for underscore handling and merged-branches.md scenarios
|
Thanks for this! I noticed your PR while looking at the upstream PR — and I had already pushed an equivalent fix to my branch earlier today (see my comment on the upstream PR).\n\nOur implementations are functionally equivalent: both switch from |
|
I've now pushed a "best of breed" version to my upstream PR that incorporates the best aspects of both of our fixes. Here's a summary of what ended up in the final version: From your PR:
Fixes beyond both our initial attempts:
The final |
- Move isWordChar, getWordBoundaries, and case transformation functions to word.ts - Use /[A-Za-z0-9]/ for word chars (underscore is now a boundary, matching Readline/Emacs) - Update tests to import from actual module - Add isWordChar tests and underscore boundary tests
Type of change
What does this PR do?
This PR is an enhancement/fix to a PR on the upstream repo (anomalyco#6778), which provides additional readline/Emacs-style text transformations, that aligns the word break behaviour more closely with readline/Emacs conventions, addressing the issue that I pointed, out in my recent comments on the upstream PR.