File tree Expand file tree Collapse file tree 4 files changed +6
-12
lines changed
Expand file tree Collapse file tree 4 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,11 @@ function M.swap_position()
1717end
1818
1919function M .open_input ()
20- core .open ({ new_session = false , focus = ' input' })
20+ core .open ({ new_session = false , focus = ' input' , start_insert = true })
2121end
2222
2323function M .open_input_new_session ()
24- core .open ({ new_session = true , focus = ' input' })
24+ core .open ({ new_session = true , focus = ' input' , start_insert = true })
2525end
2626
2727function M .open_output ()
@@ -44,7 +44,7 @@ function M.toggle(new_session)
4444 if state .windows == nil then
4545 local focus = state .last_focused_opencode_window or ' input'
4646
47- core .open ({ new_session = new_session == true , focus = focus })
47+ core .open ({ new_session = new_session == true , focus = focus , start_insert = false })
4848 else
4949 M .close ()
5050 end
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ function M.open(opts)
7474 end
7575
7676 if opts .focus == ' input' then
77- ui .focus_input ({ restore_position = are_windows_closed , start_insert = true })
77+ ui .focus_input ({ restore_position = are_windows_closed , start_insert = opts . start_insert == true })
7878 elseif opts .focus == ' output' then
7979 ui .focus_output ({ restore_position = are_windows_closed })
8080 end
Original file line number Diff line number Diff line change 268268
269269--- @class OpenOpts
270270--- @field focus ? ' input' | ' output'
271+ --- @field start_insert ? boolean
271272--- @field new_session ? boolean
272273
273274--- @class SendMessageOpts
Original file line number Diff line number Diff line change @@ -125,19 +125,12 @@ function M.focus_input(opts)
125125 return
126126 end
127127
128- if vim .api .nvim_get_current_win () == windows .input_win then
129- if opts .start_insert then
130- vim .cmd (' startinsert!' )
131- end
132- return
133- end
134-
135128 vim .api .nvim_set_current_win (windows .input_win )
136129
137130 if opts .restore_position and state .last_input_window_position then
138131 pcall (vim .api .nvim_win_set_cursor , 0 , state .last_input_window_position )
139132 end
140- if opts .start_insert then
133+ if vim . api . nvim_get_current_win () == windows . input_win and opts .start_insert then
141134 vim .api .nvim_feedkeys (' a' , ' n' , false )
142135 end
143136end
You can’t perform that action at this time.
0 commit comments