From 48b9451188a3d6cc2f1465a4766aebdc01ea3e39 Mon Sep 17 00:00:00 2001 From: LudoPinelli <93927273+LudoPinelli@users.noreply.github.com> Date: Sat, 13 Jan 2024 11:02:25 +0100 Subject: [PATCH] fixed(code): new nomenclature for adapted box was not working when using the function instead of the command --- CHANGELOG.md | 6 ++++++ lua/comment-box/init.lua | 11 +++++++---- plugin/comment-box.lua | 30 +++++++++++++++++++++++++++--- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1ed0f3..a28bcac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## January 13 2024 + +### Fixed + +- For the adapted boxes, the new nomenclature was not working when using the function directly (for example: `require("comment-box").cabox()`). + ## January 10 2024 ### Added diff --git a/lua/comment-box/init.lua b/lua/comment-box/init.lua index aa1fae2..c53ff05 100644 --- a/lua/comment-box/init.lua +++ b/lua/comment-box/init.lua @@ -225,7 +225,7 @@ end -- │ CORE │ -- ╰──────────────────────────────────────────────────────────╯ --- Return the selected text formated +-- Return the selected text formatted ---@param lstart number ---@param lend number ---@return string[] @@ -1140,9 +1140,12 @@ return { rlbox = print_rlbox, rcbox = print_rcbox, rrbox = print_rrbox, - albox = print_labox, - acbox = print_cabox, - arbox = print_rabox, + albox = print_labox, -- deprecated + labox = print_labox, + acbox = print_cabox, -- deprecated + cabox = print_cabox, + arbox = print_rabox, -- deprecated + rabox = print_rabox, dbox = del, yank = yank_in, line = print_line, diff --git a/plugin/comment-box.lua b/plugin/comment-box.lua index ab12a4b..1d3339b 100644 --- a/plugin/comment-box.lua +++ b/plugin/comment-box.lua @@ -84,8 +84,8 @@ end, { range = 2, desc = "Print a left aligned adapted box", }) --- ────────────────────────────────────────────────────────────────────── +-- ── Deprecated ──────────────────────────────────────────────────────── vim.api.nvim_create_user_command("CBlabox", function(opts) require("comment-box").albox(opts.args, opts.line1, opts.line2) end, { @@ -94,6 +94,14 @@ end, { desc = "Print a left aligned adapted box", }) +vim.api.nvim_create_user_command("CBlabox", function(opts) + require("comment-box").labox(opts.args, opts.line1, opts.line2) +end, { + nargs = "?", + range = 2, + desc = "Print a left aligned adapted box", +}) + -- ── Deprecated ──────────────────────────────────────────────────────── vim.api.nvim_create_user_command("CBcabox", function(opts) require("comment-box").acbox(opts.args, opts.line1, opts.line2) @@ -102,8 +110,8 @@ end, { range = 2, desc = "Print a centered adapted box", }) --- ────────────────────────────────────────────────────────────────────── +-- ── Deprecated ──────────────────────────────────────────────────────── vim.api.nvim_create_user_command("CBacbox", function(opts) require("comment-box").acbox(opts.args, opts.line1, opts.line2) end, { @@ -112,6 +120,14 @@ end, { desc = "Print a centered adapted box", }) +vim.api.nvim_create_user_command("CBacbox", function(opts) + require("comment-box").cabox(opts.args, opts.line1, opts.line2) +end, { + nargs = "?", + range = 2, + desc = "Print a centered adapted box", +}) + -- ── Deprecated ──────────────────────────────────────────────────────── vim.api.nvim_create_user_command("CBrabox", function(opts) require("comment-box").arbox(opts.args, opts.line1, opts.line2) @@ -120,8 +136,8 @@ end, { range = 2, desc = "Print a right aligned adapted box", }) --- ────────────────────────────────────────────────────────────────────── +-- ── Deprecated ──────────────────────────────────────────────────────── vim.api.nvim_create_user_command("CBrabox", function(opts) require("comment-box").arbox(opts.args, opts.line1, opts.line2) end, { @@ -130,6 +146,14 @@ end, { desc = "Print a right aligned adapted box", }) +vim.api.nvim_create_user_command("CBrabox", function(opts) + require("comment-box").rabox(opts.args, opts.line1, opts.line2) +end, { + nargs = "?", + range = 2, + desc = "Print a right aligned adapted box", +}) + -- ── Utils ───────────────────────────────────────────────────────────── vim.api.nvim_create_user_command("CBd", function(opts)