Skip to content

Commit 7740806

Browse files
committed
fix(context): don't add selection if empty
1 parent 554ed9e commit 7740806

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lua/opencode/context.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,10 @@ function M.get_current_selection()
278278
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Esc>', true, false, true), 'nx', true)
279279
vim.fn.setpos('.', current_pos)
280280

281+
if not text or text == '' then
282+
return nil
283+
end
284+
281285
return {
282286
text = text and text:match('[^%s]') and text or nil,
283287
lines = start_line .. ', ' .. end_line,

0 commit comments

Comments
 (0)