Skip to content

Commit 2ced676

Browse files
committed
fix: when rename_term action is called with exit_on_action=true, focus on the terminal that was just renamed
1 parent b6dede8 commit 2ced676

2 files changed

Lines changed: 2 additions & 14 deletions

File tree

lua/lib/actions/init.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ function M.toggle_term(prompt_bufnr, exit_on_action)
201201
util.refresh_picker(prompt_bufnr, term)
202202
end
203203

204-
--- Rename a terminal.
204+
--- Rename a terminal. If exit_on_action is true, focus it.
205205
--- @param prompt_bufnr number The buffer number of the telescope prompt.
206206
--- @param exit_on_action boolean Whether to exit the telescope buffer when the action executes.
207207
function M.rename_term(prompt_bufnr, exit_on_action)
@@ -221,6 +221,7 @@ function M.rename_term(prompt_bufnr, exit_on_action)
221221

222222
if exit_on_action then
223223
actions.close(prompt_bufnr)
224+
term:focus()
224225
else
225226
local current_picker = actions_state.get_current_picker(prompt_bufnr)
226227
local finder, new_row_number = util.create_finder(term.id)

lua/lib/telescope/init.lua

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,14 @@ local function telescope_leave_autocmd(picker)
1515
nested = true,
1616
once = true,
1717
callback = function()
18-
local desktopPath = os.getenv("HOME") .. "/Desktop/new.txt"
19-
local file, err = io.open(desktopPath, "a")
20-
if not file then
21-
print("Error opening file:", err)
22-
return
23-
end
24-
file:write("leave" .. "\n")
25-
2618
local win_is_valid = vim.api.nvim_win_is_valid(picker.original_win_id)
27-
file:write("picker.original_win_id: " .. picker.original_win_id .. "\n")
2819
if win_is_valid then
29-
file:write("win_is_valid" .. "\n")
3020
local picker_orig_win_bufnr = vim.fn.winbufnr(picker.original_win_id)
3121
local buftype = vim.api.nvim_buf_get_option(picker_orig_win_bufnr, "filetype")
32-
file:write("buftype: " .. buftype .. "\n")
3322
if buftype == "toggleterm" then
3423
util.start_insert_mode()
3524
end
3625
end
37-
file:write("\n")
38-
file:close()
3926
end,
4027
})
4128
end

0 commit comments

Comments
 (0)