Skip to content

Commit 4f1d172

Browse files
committed
fix(api): no restore_position on mention/slash
Restoring position was moving the cursor to the start of the input box (the initial last saved position before we started insert mode) when adding a mention rather than leaving the cursor where it is (i.e. where the user is typing) Since we're almost certainly already in insert mode, we don't want to restore position when adding a mention / slash_command.
1 parent 6f424e0 commit 4f1d172

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lua/opencode/api.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,15 @@ end
289289
function M.mention()
290290
local config = require('opencode.config')
291291
local char = config.get_key_for_function('input_window', 'mention')
292-
ui.focus_input({ restore_position = true, start_insert = true })
292+
293+
ui.focus_input({ restore_position = false, start_insert = true })
293294
require('opencode.ui.completion').trigger_completion(char)()
294295
end
295296

296297
function M.slash_commands()
297298
local config = require('opencode.config')
298299
local char = config.get_key_for_function('input_window', 'slash_commands')
299-
ui.focus_input({ restore_position = true, start_insert = true })
300+
ui.focus_input({ restore_position = false, start_insert = true })
300301
require('opencode.ui.completion').trigger_completion(char)()
301302
end
302303

0 commit comments

Comments
 (0)