Skip to content

Alt backspace/delete: treat path-like words as slash-delimited - #396

Merged
HalFrgrd merged 2 commits into
masterfrom
copilot/update-alt-backspace-delete-logic
Apr 1, 2026
Merged

HalFrgrd merged 2 commits into
masterfrom
copilot/update-alt-backspace-delete-logic

Conversation

Copilot AI commented Apr 1, 2026 •

Copy link
Copy Markdown
Contributor

In LessStrict mode, alt+backspace/delete split on every ASCII punctuation character, so baz.jeb would be broken at the . rather than deleted as a unit. When working with paths this is almost never the desired behaviour.

Approach

Detect whether the whitespace-delimited word in the deletion direction contains / or \. If so, switch to a slash-only punctuation classifier for that operation — ., :, -, _, etc. become regular word characters, and only //\ act as boundaries.

echo ./foo_bar/baz.jeb|
       ^^^^^^^^^^^^^^^^^
alt+backspace #1 → deletes "baz.jeb"   (not just "jeb")
alt+backspace #2 → deletes "/"
alt+backspace #3 → deletes "foo_bar"

Non-path words (no slashes) continue to use the full ASCII punctuation boundary set — no behaviour change for abc::def::ghi style tokens.

Changes

  • less_strict_class_slash_only — new character classifier; only / and \ are class 1 (punctuation), everything else non-whitespace is class 2.
  • has_slash_in_word_left / has_slash_in_word_right — scan from cursor to the nearest whitespace and return whether a slash is present.
  • delete_one_word_left / delete_one_word_right (LessStrict branch) — select the slash-only classifier when the relevant word context contains a slash.
  • New tests — delete_one_word_left_less_strict_path and delete_one_word_right_less_strict_path covering the echo ./foo_bar/baz.jeb case from the issue; existing less-strict tests are unaffected.
Original prompt

alt backspace and alt delete changes

Alt backspace / delete should detect if there are backslashed in the word. If so, it should consider the set of punctuation to be just backslash not the full set of punctuation.
add a test case like: echo ./foo_bar/baz.jeb
one alt backspace should delete baz.jeb
another should delete /
another should delete foo_bar.

other tests in text buffer.rs might need to be updated .

… strings

When the whitespace-delimited word to the left (or right) of the cursor
contains `/` or `\`, LessStrict mode now treats only those slash characters
as punctuation word boundaries instead of the full ASCII punctuation set.

This makes alt+backspace on `./foo_bar/baz.jeb` delete `baz.jeb` as a
single unit rather than splitting on `.`, then delete `/`, then `foo_bar`.

- Add less_strict_class_slash_only: only / and \ are class 1 (punctuation)
- Add has_slash_in_word_left / has_slash_in_word_right helpers
- Use slash-only classification in delete_one_word_left/right (LessStrict)
- Add delete_one_word_left_less_strict_path test
- Add delete_one_word_right_less_strict_path test

Agent-Logs-Url: https://github.com/HalFrgrd/flyline/sessions/3afddf3a-8bf5-4bf5-85c0-e1ed33865b3e

Co-authored-by: HalFrgrd <[email protected]>
Copilot AI changed the title [WIP] Update alt backspace and delete behavior for backslashed words Alt backspace/delete: treat path-like words as slash-delimited Apr 1, 2026
Copilot AI requested a review from HalFrgrd April 1, 2026 12:47
@HalFrgrd
HalFrgrd marked this pull request as ready for review April 1, 2026 19:12
@HalFrgrd
HalFrgrd merged commit 72c1179 into master Apr 1, 2026
@HalFrgrd
HalFrgrd deleted the copilot/update-alt-backspace-delete-logic branch April 3, 2026 10:49
@HalFrgrd
HalFrgrd restored the copilot/update-alt-backspace-delete-logic branch April 23, 2026 21:44
@HalFrgrd
HalFrgrd deleted the copilot/update-alt-backspace-delete-logic branch April 23, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants