Skip to content

Commit

Permalink
Neovim 0.10.0 has been released
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhiya committed May 18, 2024
1 parent 97a6b72 commit ab23c6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lua/fittencode/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ end
---@param name string
---@param hi table
function M.set_hi(name, hi)
-- Neovim 0.10.0 has been released on 2024-05-16.
if fn.has('nvim-0.10') == 1 then
-- https://github.com/neovim/neovim/pull/25229
-- https://github.com/luozhiya/fittencode.nvim/issues/20
-- hi.force = true
hi.force = true
end
hi.cterm = hi.cterm or {}
api.nvim_set_hl(0, name, hi)
Expand Down
8 changes: 5 additions & 3 deletions lua/fittencode/engines/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,19 +214,21 @@ end
---@field start integer[]
---@field end integer[]
---@field vmode boolean
---@field region string[]
---@field region? string[]

local VMODE = { ['v'] = true, ['V'] = true, [api.nvim_replace_termcodes('<C-V>', true, true, true)] = true }

local function make_range(buffer)
local in_v = false
local region = {}
local region = nil

local mode = api.nvim_get_mode().mode
Log.debug('Action mode: {}', mode)
if VMODE[mode] then
in_v = true
region = fn.getregion(vim.fn.getpos('.'), vim.fn.getpos('v'), { type = vim.fn.mode() })
if fn.has('nvim-0.10') == 1 then
region = fn.getregion(vim.fn.getpos('.'), vim.fn.getpos('v'), { type = vim.fn.mode() })
end
end

api.nvim_feedkeys(api.nvim_replace_termcodes('<ESC>', true, true, true), 'nx', false)
Expand Down
2 changes: 1 addition & 1 deletion lua/fittencode/prompt_providers/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ end
local function get_range_content(buffer, range)
local lines = {}
if range.vmode then
lines = range.region
lines = range.region or {}
else
-- lines = api.nvim_buf_get_text(buffer, range.start[1] - 1, 0, range.start[1] - 1, -1, {})
local end_col = max_len(buffer, range['end'][1], range['end'][2])
Expand Down

0 comments on commit ab23c6a

Please sign in to comment.