Skip to content

Commit

Permalink
Feed <ESC> in visual mode only
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhiya committed Jun 11, 2024
1 parent 9af308c commit 2ba31fe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/fittencode/engines/actions/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ local function on_stage_end(is_error, headless, elapsed_time, depth, suggestions
end

if ready then
-- Log.debug('Stage End Suggestions: {}', suggestions)
schedule(on_success, vim.deepcopy(suggestions))
end

Expand Down Expand Up @@ -306,7 +307,9 @@ local function make_range(buffer)
start = { pos[1][1][2], pos[1][1][3] }
end_ = { pos[#pos][2][2], pos[#pos][2][3] }
else
api.nvim_feedkeys(api.nvim_replace_termcodes('<ESC>', true, true, true), 'nx', false)
if in_v then
api.nvim_feedkeys(api.nvim_replace_termcodes('<ESC>', true, true, true), 'nx', false)
end
start = api.nvim_buf_get_mark(buffer, '<')
end_ = api.nvim_buf_get_mark(buffer, '>')
end
Expand Down Expand Up @@ -406,7 +409,9 @@ local function chain_actions(opts)
Promise:new(function(resolve, reject)
local task_id = _create_task(headless)
Sessions.request_generate_one_stage(task_id, prompt_ctx, function(_, prompt, suggestions)
-- Log.debug('Generated Suggestions: {}', suggestions)
local lines, ms = preprocessing(presug, task_id, headless, preprocess_format, suggestions)
-- Log.debug('Preprocessed Lines: {}', lines)
elapsed_time = elapsed_time + ms
if not lines or #lines == 0 then
reject({ false, presug })
Expand Down

0 comments on commit 2ba31fe

Please sign in to comment.