Repository navigation
fix: let fed <BS> replace the pre-edit through the guard - #2
Merged
Merged
Conversation
atusy
force-pushed
the
fix/guard-fed-backspace
branch
from
September 24, 2026 15:59
6001a49 to
c2d2f28
Compare
atusy
added a commit
to atusy/dotfiles
that referenced
this pull request
Sep 25, 2026
laser types a selected candidate as <BS> and then the word, but skkelua's guard discards any unmapped <BS> during pre-edit as a physical key. Selecting a candidate for ▽かんじ therefore produced ▽かんじ漢字, and cancelling could not restore the reading. Wrap the guard so that it passes <BS> that was fed rather than typed, while still guarding macro replay and every other key. This is a stopgap until kjuq/skkelua.nvim#2 fixes the guard itself. It is not done by mapping <BS>, because laser feeds its keys noremap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Completion UIs replace the typed input with a candidate by feeding <BS> noremap and then the candidate: pum.vim does so when cancelling, and laser.nvim whenever it selects, confirms or cancels. The guard took these <BS> for unmapped physical keys and discarded them during pre-edit, so the candidate was appended after the pre-edit instead (▽かんじ漢字) and cancelling could not restore the reading. Pass <BS> through when vim.on_key reports no typed key. Physical <BS> reaching the guard unmapped is still discarded, and so is <BS> replayed by a macro, which vim.on_key also reports as untyped. Other special keys stay discarded even when fed, since only <BS> is needed to replace the input and cursor motions are what leave the ▽ marker behind. The pre-edit tracking that the replacement desynchronizes is recovered by the prevInput mismatch reset, as with insertOnSelect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
atusy
force-pushed
the
fix/guard-fed-backspace
branch
from
October 1, 2026 13:49
c2d2f28 to
931b0d7
Compare
atusy
added a commit
to atusy/dotfiles
that referenced
this pull request
Oct 21, 2026
skkelua's guard now passes fed <BS> through by itself (kjuq/skkelua.nvim#2), so patching its private _on_key is no longer needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Completion UIs replace the typed input with a candidate by feeding
<BS>(noremap) and then the candidate text:s:insert_line_feedkeys)During pre-edit, the guard treats these fed
<BS>as unmapped physical keys and discards them. The candidate is then appended after the pre-edit instead of replacing it:Cancelling a selection also cannot restore the reading.
Change
The guard now passes
<BS>through whenvim.on_keyreports no typed key (typed == ""). The fix is scoped narrowly:<BS>reaching the guard unmapped is still discarded.<BS>replayed by a macro is still discarded.vim.on_keyreports macro replay as untyped too, soreg_executing()is checked as well.<BS>, and cursor motions such as<Left>are what leave the ▽ marker behind.The replacement desynchronizes the pre-edit tracking. That is recovered by the existing prevInput mismatch reset, just as it is for
insertOnSelect.Tests
In
tests/integration_spec.lua:fed <BS> from a completion UI replaces the pre-edit: fails on master with▽かんじ漢字and passes with this change.<BS> reaching the guard unmapped is discarded unless fed: physical and macro-replayed<BS>are still discarded.env -u NVIM_LISTEN_ADDRESS nvim --clean --headless -l tests/run.lua: all tests passed on the rebased branch, including the macro regression tests.Rebased onto master at
b1e8d46. The insert-mode:lmapchange does not remove the need to allow completion UIs’ fed<BS>through the guard.This fix is independent of #1.
🤖 Generated with Claude Code