Skip to content

Commit 7350976

Browse files
committed
fix(question_window): avoid duplicate 'other' option
1 parent f6f1ec5 commit 7350976

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

lua/opencode/ui/question_window.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ end
9292

9393
local function get_total_options(question_info)
9494
local has_other = find_other_option(question_info.options) ~= nil
95-
return has_other and (#question_info.options + 1) or #question_info.options
95+
return has_other and #question_info.options or (#question_info.options + 1)
9696
end
9797

9898
---@param option_index number
@@ -131,10 +131,8 @@ function M._answer_with_custom()
131131
end
132132

133133
local function add_other_if_missing(options)
134-
for _, opt in ipairs(options) do
135-
if opt.label:lower() == 'other' then
136-
return options
137-
end
134+
if find_other_option(options) ~= nil then
135+
return options
138136
end
139137
local result = vim.deepcopy(options)
140138
table.insert(result, { label = 'Other', description = 'Type your own answer' })

0 commit comments

Comments
 (0)