default insert mode for the overlay#161
default insert mode for the overlay#161aakash2330 wants to merge 1 commit intoThePrimeagen:masterfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| ) | ||
| end | ||
|
|
||
| vim.cmd("startinsert") |
There was a problem hiding this comment.
Insert mode forced on read-only select input overlay
High Severity
vim.cmd("startinsert") is added unconditionally in capture_input, but capture_select_input also calls capture_input and then makes the buffer read-only and non-modifiable via a vim.scheduled on_load callback. This puts the user in insert mode on a buffer that immediately becomes non-modifiable, causing errors when typing and breaking the selection workflow. The startinsert call needs to be conditional or moved to only the text-input callers.
Additional Locations (1)
| ) | ||
| end | ||
|
|
||
| vim.cmd("startinsert") |
There was a problem hiding this comment.
Bug: capture_input unconditionally enters insert mode, which breaks capture_select_input's read-only selection window by putting the user in insert mode instead of normal mode for navigation.
Severity: HIGH
Suggested Fix
The call to vim.cmd("startinsert") should be conditional. It should only be executed for input buffers, not for selection buffers. This could be controlled by a new option in the opts table passed to M.capture_input.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: lua/99/window/init.lua#L549
Potential issue: The function `M.capture_input` is modified to always call
`vim.cmd("startinsert")` before returning. However, this function is also used by
`M.capture_select_input` to create a read-only selection window. Due to a timing issue
with `vim.schedule`, the user is placed in insert mode *before* the buffer is made
read-only by the `on_load` callback. This leads to a broken user experience in selection
windows, where users expect to navigate in normal mode but are instead in insert mode.
Any attempt to type will result in an `E21: Cannot make changes, 'modifiable' is off`
error once the buffer becomes non-modifiable.
Did we get this right? 👍 / 👎 to inform future reviews.
|
yeah, i dont think i like this. |


opens the overlay in insert mode by default so you can start typing right away.