Skip to content

Commit

Permalink
fix(extra): make list picker have correct column for "change" scope
Browse files Browse the repository at this point in the history
  • Loading branch information
echasnovski committed Dec 27, 2024
1 parent 823efb9 commit 9624407
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions lua/mini/extra.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1940,6 +1940,7 @@ H.list_get = {
local cur_buf = vim.api.nvim_get_current_buf()
local res = vim.fn.getchangelist(cur_buf)[1]
for _, x in ipairs(res) do
x.col = x.col + 1
x.bufnr = cur_buf
end
return res
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
05|}
06|~
07|┌> ▏────────────────────────────────────────┐
08|│ tests/dir-extra/real-files/a.lua│1│10
09|│ tests/dir-extra/real-files/a.lua│3│12
08|│ tests/dir-extra/real-files/a.lua│1│11
09|│ tests/dir-extra/real-files/a.lua│3│13
10|│ │
11|│ │
12|│ │
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
04| y = math.min(a, 2),
05|}
06|~
07|┌tests/dir-extra/real-files/a.lua│1│10──────┐
07|┌tests/dir-extra/real-files/a.lua│1│11──────┐
08|│l Change 1 ocal a = 1 │
09|│local t = { │
10|│ x Change 2 = math.max(a, 2), │
Expand All @@ -28,7 +28,7 @@
05|3000000000000000000000000000000000000000000000000000000000000000000000
06|7777777777777777777777777777777777777777777777777777777777777777777777
07|8999999999999999999999999999999999999988888887777777777777777777777777
08|8:::::::::;::::::::::<::::::::::::::::::::::87777777777777777777777777
08|8:::::::::;<:::::::::;::::::::::::::::::::::87777777777777777777777777
09|8=====>>>>>?>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>87777777777777777777777777
10|8>>@>>>>>>>>A>>>>????BCCCB>B>ABB>>>>>>>>>>>>87777777777777777777777777
11|8>>@>>>????BCCCB>B>ABB>>>>>>>>>>>>>>>>>>>>>>87777777777777777777777777
Expand Down
4 changes: 2 additions & 2 deletions tests/test_extra.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2454,12 +2454,12 @@ T['pickers']['list()']['works for `change`'] = function()

-- Should properly choose by moving to position
type_keys('<CR>')
eq(get_cursor(), { 1, 9 })
eq(get_cursor(), { 1, 10 })

-- Should return chosen value
validate_partial_equal_arr(
{ child.lua_get('_G.return_item') },
{ { bufnr = 1, col = 10, coladd = 0, lnum = 1, text = path .. '│1│10' } }
{ { bufnr = 1, col = 11, coladd = 0, lnum = 1, text = path .. '│1│11' } }
)
end

Expand Down

0 comments on commit 9624407

Please sign in to comment.