mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 07:24:52 +01:00
fix: get rid of order_tuples
no longer necessary: lib does it under the hood since forever
This commit is contained in:
parent
0c078ddcf1
commit
27ad9fe773
1 changed files with 2 additions and 17 deletions
|
@ -16,20 +16,6 @@ local function color(x)
|
||||||
return available_colors[ math.fmod(math.abs(native.hash(x)), #available_colors) + 1 ]
|
return available_colors[ math.fmod(math.abs(native.hash(x)), #available_colors) + 1 ]
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param x [ [integer, integer], [integer, integer] ]
|
|
||||||
---@return [ [integer, integer], [integer, integer] ]
|
|
||||||
local function order_tuples(x) -- TODO send help...
|
|
||||||
if x[1][1] < x[2][1] then
|
|
||||||
return { { x[1][1], x[1][2] }, { x[2][1], x[2][2] } }
|
|
||||||
elseif x[1][1] > x[2][1] then
|
|
||||||
return { { x[2][1], x[2][2] }, { x[1][1], x[1][2] } }
|
|
||||||
elseif x[1][2] < x[2][2] then
|
|
||||||
return { { x[1][1], x[1][2] }, { x[2][1], x[2][2] } }
|
|
||||||
else
|
|
||||||
return { { x[2][1], x[2][2] }, { x[1][1], x[1][2] } }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param first integer
|
---@param first integer
|
||||||
---@param last integer
|
---@param last integer
|
||||||
---@return integer, integer, integer, integer
|
---@return integer, integer, integer, integer
|
||||||
|
@ -102,7 +88,7 @@ local function cursor_position()
|
||||||
if mode == "v" then
|
if mode == "v" then
|
||||||
local _, ls, cs = unpack(vim.fn.getpos('v'))
|
local _, ls, cs = unpack(vim.fn.getpos('v'))
|
||||||
local _, le, ce = unpack(vim.fn.getpos('.'))
|
local _, le, ce = unpack(vim.fn.getpos('.'))
|
||||||
return order_tuples({ { ls-1, cs-1 }, { le-1, ce } })
|
return { { ls-1, cs-1 }, { le-1, ce } }
|
||||||
elseif mode == "V" then
|
elseif mode == "V" then
|
||||||
local _, ls, _ = unpack(vim.fn.getpos('v'))
|
local _, ls, _ = unpack(vim.fn.getpos('v'))
|
||||||
local _, le, _ = unpack(vim.fn.getpos('.'))
|
local _, le, _ = unpack(vim.fn.getpos('.'))
|
||||||
|
@ -116,7 +102,7 @@ local function cursor_position()
|
||||||
else
|
else
|
||||||
local win = vim.api.nvim_get_current_win()
|
local win = vim.api.nvim_get_current_win()
|
||||||
local cur = vim.api.nvim_win_get_cursor(win)
|
local cur = vim.api.nvim_win_get_cursor(win)
|
||||||
return order_tuples({ { cur[1]-1, cur[2] }, { cur[1]-1, cur[2]+1 } })
|
return { { cur[1]-1, cur[2] }, { cur[1]-1, cur[2]+1 } }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -188,7 +174,6 @@ end
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
order_tuples = order_tuples,
|
|
||||||
multiline_highlight = multiline_highlight,
|
multiline_highlight = multiline_highlight,
|
||||||
cursor = {
|
cursor = {
|
||||||
position = cursor_position,
|
position = cursor_position,
|
||||||
|
|
Loading…
Reference in a new issue