@@ -70,16 +70,13 @@ function Question:create_buffer(new_tabp)
7070 if new_tabp then
7171 cmd = (" $tabe %s" ):format (file_name )
7272 else
73- cmd = (" e %s" ):format (file_name )
73+ cmd = (" edit %s" ):format (file_name )
7474 end
7575
7676 local i = self :fold_range ()
7777 if i then cmd = cmd .. (" | %d,%dfold" ):format (1 , i ) end
78- vim .api .nvim_exec2 (cmd , {})
79-
80- self .winid = vim .api .nvim_get_current_win ()
8178
82- utils . exec_hook ( " question_enter " , self )
79+ vim . api . nvim_exec2 ( cmd , {} )
8380
8481 return false
8582end
@@ -148,6 +145,8 @@ Question.unmount = vim.schedule_wrap(function(self, pre) self:_unmount(pre) end)
148145function Question :handle_mount ()
149146 self :create_buffer (true )
150147
148+ self .winid = vim .api .nvim_get_current_win ()
149+
151150 table.insert (_Lc_questions , self )
152151
153152 vim .api .nvim_create_autocmd (" QuitPre" , {
@@ -159,6 +158,8 @@ function Question:handle_mount()
159158 self .console = Console (self )
160159 self .info = Info (self )
161160
161+ utils .exec_hook (" question_enter" , self )
162+
162163 return self
163164end
164165
231232--- @param self lc.ui.Question
232233--- @param lang lc.lang
233234Question .change_lang = vim .schedule_wrap (function (self , lang )
235+ if vim .api .nvim_get_current_win () ~= self .winid then
236+ vim .api .nvim_set_current_win (self .winid )
237+ end
238+
234239 local old_lang , old_bufnr = self .lang , self .bufnr
235240 self .lang = lang
236241
0 commit comments