Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gbprod committed Nov 13, 2023
1 parent 22fa938 commit 36cbd16
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion lua/substitute.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ function substitute.operator_callback(vmode)
end
end

local wrapper = substitute.state.wrappers or doSubstitution
local wrapper = substitute.state.wrappers and require("substitute.wrappers").build(substitute.state.wrappers)
or doSubstitution

wrapper(substitute.state, doSubstitution)

Expand Down
2 changes: 1 addition & 1 deletion lua/substitute/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function utils.text(bufnr, start, finish, vmode)
local current_row_len = vim.fn.getline(row):len()

local end_col = current_row_len > finish.col and utils.get_next_char_bytecol(finish.row, finish.col)
or current_row_len
or current_row_len
if start.col > end_col then
end_col = start.col
end
Expand Down
4 changes: 2 additions & 2 deletions spec/substitute/wrappers/linewise_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ describe("Substitute linewise", function()

vim.keymap.set({ "n", "x" }, "]s", function()
require("substitute").operator({
wrappers = require("substitute.wrappers").build({ "linewise" }),
wrappers = { "linewise" },
})
end, { noremap = true })

vim.keymap.set({ "n", "x" }, "]ss", function()
require("substitute").line({
wrappers = require("substitute.wrappers").build({ "linewise" }),
wrappers = { "linewise" },
})
end, { noremap = true })

Expand Down
8 changes: 4 additions & 4 deletions spec/substitute/wrappers/reindent_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ describe("Substitute reindent", function()

vim.keymap.set({ "n", "x" }, "=s", function()
require("substitute").operator({
wrappers = require("substitute.wrappers").build({ "reindent" }),
wrappers = { "reindent" },
})
end, { noremap = true, buffer = buf })

vim.keymap.set({ "n", "x" }, "=ss", function()
require("substitute").line({
wrappers = require("substitute.wrappers").build({ "reindent" }),
wrappers = { "reindent" },
})
end, { noremap = true, buffer = buf })

Expand Down Expand Up @@ -83,13 +83,13 @@ describe("Substitute linewise and reindent", function()

vim.keymap.set({ "n", "x" }, "=s", function()
require("substitute").operator({
wrappers = require("substitute.wrappers").build({ "linewise", "reindent" }),
wrappers = { "linewise", "reindent" },
})
end, { noremap = true, buffer = buf })

vim.keymap.set({ "n", "x" }, "=ss", function()
require("substitute").line({
wrappers = require("substitute.wrappers").build({ "linewise", "reindent" }),
wrappers = { "linewise", "reindent" },
})
end, { noremap = true, buffer = buf })

Expand Down

0 comments on commit 36cbd16

Please sign in to comment.