Repository navigation
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.
feat(ftplugin): add Direct mode for continuous key forwarding #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
feat(ftplugin): add Direct mode for continuous key forwarding #56
Changes from all commits
abd57e2File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: lambdalisue/nvim-aibo
Length of output: 1049
🏁 Script executed:
Repository: lambdalisue/nvim-aibo
Length of output: 15981
<C-c>doesn’t send ESC here; it exits Direct mode instead. Line 22 is misleading becausekeycode.get_single_keycode()wrapsvim.fn.getchar()inpcall, so a real Ctrl-C is treated as an interrupt and the loop breaks before anything is forwarded. Update the hint or add a dedicated capture path if ESC forwarding is intended. There’s also no test for the Ctrl-C case.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Prompt is never restored if
open_indicatorthrows.hide_prompt(line 101) andopen_indicator(line 102) run before thepcallblock. Ifopen_indicatorraises (e.g.console_winidbecomes invalid,nvim_open_winfails on a very constrained layout), the function aborts immediately —restore_promptis never reached, permanently leaving the user without their prompt window until they manually reopen it.🛠️ Proposed fix: wrap the whole sequence so cleanup always runs
function M.enter(console_winid, send_fn) local keycode = require("aibo.internal.keycode") local had_prompt, was_insert = hide_prompt(console_winid) - local indicator_winid = open_indicator(console_winid) - active_indicators[console_winid] = indicator_winid - -- Paint the indicator before the first (blocking) getchar() call. - vim.cmd("redraw") - - local ok, err = pcall(function() + local ok, err = pcall(function() + local indicator_winid = open_indicator(console_winid) + active_indicators[console_winid] = indicator_winid + -- Paint the indicator before the first (blocking) getchar() call. + vim.cmd("redraw") + while true do local key = keycode.get_single_keycode() if not key or key == "<Esc>" then break end send_fn(key) vim.wait(50) vim.cmd("redraw!") end end) - close_indicator(indicator_winid) + close_indicator(active_indicators[console_winid]) active_indicators[console_winid] = nil if had_prompt then restore_prompt(console_winid, was_insert) end if not ok then error(err, 0) end end📝 Committable suggestion
🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.