Skip to content

Commit

Permalink
Format with stylua
Browse files Browse the repository at this point in the history
  • Loading branch information
L3MON4D3 authored and github-actions[bot] committed Nov 10, 2023
1 parent 13cdd50 commit 9e0a57b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
15 changes: 2 additions & 13 deletions lua/luasnip/util/select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,8 @@ function M.pre_cut()
-- store registers so we don't change any of them.
-- "" is affected since we perform a cut (s), 1-9 also (although :h
-- quote_number seems to state otherwise for cuts to specific registers..?).
saved_registers = store_registers(
"",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"z"
)
saved_registers =
store_registers("", "1", "2", "3", "4", "5", "6", "7", "8", "9", "z")

-- store data needed for de-indenting lines.
start_line = vim.fn.line("'<") - 1
Expand Down
49 changes: 32 additions & 17 deletions tests/integration/select_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,78 +29,93 @@ describe("Selection", function()

feed("iasdf qwer<Esc>v^<Tab>")
exec_lua([[ls.lsp_expand(".$LS_SELECT_RAW.")]])
screen:expect{grid=[[
screen:expect({
grid = [[
.asdf qwer.^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{2:-- INSERT --} |]]}
{2:-- INSERT --} |]],
})

assert.is_true(exec_lua("return vim.deep_equal(vim.api.nvim_get_context({}).regs, regs_pre)"))
assert.is_true(
exec_lua(
"return vim.deep_equal(vim.api.nvim_get_context({}).regs, regs_pre)"
)
)
end)

it("works via manual keybinding.", function()
exec_lua[[
exec_lua([[
vim.keymap.set({"x"}, "p", ls.select_keys, {silent = true})
]]
]])
feed("iasdf qwer<Esc>v^p")
exec_lua([[ls.lsp_expand(".$LS_SELECT_RAW.")]])
screen:expect{grid=[[
screen:expect({
grid = [[
.asdf qwer.^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{2:-- INSERT --} |]]}
{2:-- INSERT --} |]],
})
end)

it("works for multibyte characters.", function()
feed("i 𝔼f-𝔼abc<Esc>vbb")
screen:expect{grid=[[
screen:expect({
grid = [[
𝔼f^-{3:𝔼abc} |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{2:-- VISUAL --} |]]}
{2:-- VISUAL --} |]],
})
feed("<Tab>")
exec_lua([[ls.lsp_expand(".$LS_SELECT_RAW.")]])
screen:expect{grid=[[
screen:expect({
grid = [[
𝔼f.-𝔼abc.^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{2:-- INSERT --} |]]}
{2:-- INSERT --} |]],
})
end)

it("works for combined characters.", function()
feed("i ‖͚asdf‖͚qwer<Esc>vbbh")
screen:expect{grid=[[
screen:expect({
grid = [[
‖͚asd^f{3:‖͚qwer} |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{2:-- VISUAL --} |]]}
{2:-- VISUAL --} |]],
})
feed("<Tab>")
exec_lua([[ls.lsp_expand(".$LS_SELECT_RAW.")]])
screen:expect{grid=[[
screen:expect({
grid = [[
‖͚asd.f‖͚qwer.^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{2:-- INSERT --} |]]}
{2:-- INSERT --} |]],
})
end)

it("does not destroy any registers.", function()
end)
it("does not destroy any registers.", function() end)
end)

0 comments on commit 9e0a57b

Please sign in to comment.