From 27ad9fe773e28c9426683424b99d4a6cdc8e8236 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 9 Sep 2024 02:37:32 +0200 Subject: [PATCH] fix: get rid of order_tuples no longer necessary: lib does it under the hood since forever --- lua/codemp/utils.lua | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/lua/codemp/utils.lua b/lua/codemp/utils.lua index ef40701..6760586 100644 --- a/lua/codemp/utils.lua +++ b/lua/codemp/utils.lua @@ -16,20 +16,6 @@ local function color(x) return available_colors[ math.fmod(math.abs(native.hash(x)), #available_colors) + 1 ] 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 last integer ---@return integer, integer, integer, integer @@ -102,7 +88,7 @@ local function cursor_position() if mode == "v" then local _, ls, cs = unpack(vim.fn.getpos('v')) 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 local _, ls, _ = unpack(vim.fn.getpos('v')) local _, le, _ = unpack(vim.fn.getpos('.')) @@ -116,7 +102,7 @@ local function cursor_position() else local win = vim.api.nvim_get_current_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 @@ -188,7 +174,6 @@ end return { - order_tuples = order_tuples, multiline_highlight = multiline_highlight, cursor = { position = cursor_position,