Skip to content

Commit 404f8d8

Browse files
committed
cleanup?
1 parent b961b72 commit 404f8d8

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

lua/claudecode/selection.lua

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -445,13 +445,7 @@ function M.get_visual_selection()
445445
local start_coords, end_coords = get_selection_coordinates()
446446

447447
local current_buf = vim.api.nvim_get_current_buf()
448-
local raw_file_path = vim.api.nvim_buf_get_name(current_buf)
449-
450-
-- Extract real filesystem path from mini.files buffer path if needed
451-
local file_path = raw_file_path
452-
if file_path:match("^minifiles://") then
453-
file_path = file_path:gsub("^minifiles://[^/]*/", "")
454-
end
448+
local file_path = vim.api.nvim_buf_get_name(current_buf)
455449

456450
local lines_content = vim.api.nvim_buf_get_lines(
457451
current_buf,
@@ -496,13 +490,7 @@ end
496490
function M.get_cursor_position()
497491
local cursor_pos = vim.api.nvim_win_get_cursor(0)
498492
local current_buf = vim.api.nvim_get_current_buf()
499-
local raw_file_path = vim.api.nvim_buf_get_name(current_buf)
500-
501-
-- Extract real filesystem path from mini.files buffer path if needed
502-
local file_path = raw_file_path
503-
if file_path:match("^minifiles://") then
504-
file_path = file_path:gsub("^minifiles://[^/]*/", "")
505-
end
493+
local file_path = vim.api.nvim_buf_get_name(current_buf)
506494

507495
return {
508496
text = "",
@@ -596,13 +584,7 @@ function M.get_range_selection(line1, line2)
596584
end
597585

598586
local current_buf = vim.api.nvim_get_current_buf()
599-
local raw_file_path = vim.api.nvim_buf_get_name(current_buf)
600-
601-
-- Extract real filesystem path from mini.files buffer path if needed
602-
local file_path = raw_file_path
603-
if file_path:match("^minifiles://") then
604-
file_path = file_path:gsub("^minifiles://[^/]*/", "")
605-
end
587+
local file_path = vim.api.nvim_buf_get_name(current_buf)
606588

607589
-- Get the total number of lines in the buffer
608590
local total_lines = vim.api.nvim_buf_line_count(current_buf)
@@ -686,13 +668,7 @@ function M.send_at_mention_for_visual_selection(line1, line2)
686668
end
687669

688670
-- Sanity check: ensure the selection is for the current buffer
689-
local raw_current_buf_name = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf())
690-
691-
-- Extract real filesystem path from mini.files buffer path if needed
692-
local current_buf_name = raw_current_buf_name
693-
if current_buf_name:match("^minifiles://") then
694-
current_buf_name = current_buf_name:gsub("^minifiles://[^/]*/", "")
695-
end
671+
local current_buf_name = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf())
696672

697673
if sel_to_send.filePath ~= current_buf_name then
698674
logger.warn(

0 commit comments

Comments
 (0)