Skip to content

Commit

Permalink
fixed(code): new nomenclature for adapted box was not working when us…
Browse files Browse the repository at this point in the history
…ing the function instead of the command
  • Loading branch information
LudoPinelli committed Jan 13, 2024
1 parent 10e28f3 commit 48b9451
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 7 additions & 4 deletions lua/comment-box/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ end
-- │ CORE │
-- ╰──────────────────────────────────────────────────────────╯

-- Return the selected text formated
-- Return the selected text formatted
---@param lstart number
---@param lend number
---@return string[]
Expand Down Expand Up @@ -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,
Expand Down
30 changes: 27 additions & 3 deletions plugin/comment-box.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand All @@ -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)
Expand All @@ -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, {
Expand All @@ -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)
Expand All @@ -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, {
Expand All @@ -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)
Expand Down

0 comments on commit 48b9451

Please sign in to comment.