Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lua/mini/extra.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,8 @@ MiniExtra.pickers.marks = function(local_opts, opts)
if path == nil then buf_id = info.pos[1] end

local line, col = info.pos[2], math.abs(info.pos[3])
local text = string.format('%s │ %s%s│%s', info.mark:sub(2), path == nil and '' or (path .. '│'), line, col)
local line_text = buf_id ~= nil and vim.api.nvim_buf_get_lines(buf_id, line - 1, line, false)[1] or ''
local text = string.format('%s │ %5s:%-3s │ %s %s', info.mark:sub(2), line, col, path or '', line_text)
table.insert(items, { text = text, bufnr = buf_id, path = path, lnum = line, col = col })
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
03|Line 1-3
04|~
05|┌> ▏─────────────────────┐
06|│A │ tests/dir-extra/rea…│
06|│A │ 1:6 │ tests/d…│
07|│ │
08|│ │
09|│ │
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
03|Line 1-3
04|~
05|┌> ▏─────────────────────┐
06|│a │ 1│4 │
07|│b │ 3│6 │
08|│' │ 1│1 │
09|│" │ 1│1 │
10|│. │ 1│1 │
06|│a │ 1:4 │ Line 1…│
07|│b │ 3:6 │ Line 1…│
08|│' │ 1:1 │ Line 1…│
09|│" │ 1:1 │ Line 1…│
10|│. │ 1:1 │ Line 1…│
11|│ │
12|│ │
13|│ │
Expand All @@ -21,13 +21,13 @@
03|0000000000000000000000000000000000000000
04|1111111111111111111111111111111111111111
05|2334222222222222222222222211111111111111
06|2555555555555555555555555211111111111111
07|2666666666666666666666666211111111111111
08|2666666666666666666666666211111111111111
09|2666666666666666666666666211111111111111
10|2666666666666666666666666211111111111111
11|2777777777777777777777777211111111111111
12|2777777777777777777777777211111111111111
13|2777777777777777777777777211111111111111
14|2888888888888822228888888211111111111111
06|2555555555555555555555556211111111111111
07|2777777777777777777777776211111111111111
08|2777777777777777777777776211111111111111
09|2777777777777777777777776211111111111111
10|2777777777777777777777776211111111111111
11|2888888888888888888888888211111111111111
12|2888888888888888888888888211111111111111
13|2888888888888888888888888211111111111111
14|2999999999999922229999999211111111111111
15|0000000000000000000000000000000000000000
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
03|line 2-3
04|~
05|┌> ▏─────────────────────┐
06|│a │ 2│3 │
07|│' │ 1│1 │
08|│" │ 1│1 │
09|│. │ 1│1 │
06|│a │ 2:3 │ Line 2…│
07|│' │ 1:1 │ Line 2…│
08|│" │ 1:1 │ Line 2…│
09|│. │ 1:1 │ Line 2…│
10|│ │
11|│ │
12|│ │
Expand All @@ -21,13 +21,13 @@
03|0000000000000000000000000000000000000000
04|1111111111111111111111111111111111111111
05|2334222222222222222222222211111111111111
06|2555555555555555555555555211111111111111
07|2666666666666666666666666211111111111111
08|2666666666666666666666666211111111111111
09|2666666666666666666666666211111111111111
10|2777777777777777777777777211111111111111
11|2777777777777777777777777211111111111111
12|2777777777777777777777777211111111111111
13|2777777777777777777777777211111111111111
14|2888888888888822228888888211111111111111
06|2555555555555555555555556211111111111111
07|2777777777777777777777776211111111111111
08|2777777777777777777777776211111111111111
09|2777777777777777777777776211111111111111
10|2888888888888888888888888211111111111111
11|2888888888888888888888888211111111111111
12|2888888888888888888888888211111111111111
13|2888888888888888888888888211111111111111
14|2999999999999922229999999211111111111111
15|0000000000000000000000000000000000000000
26 changes: 13 additions & 13 deletions tests/screenshots/tests-test_extra.lua---pickers---marks()---works
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
05|~
06|~
07|┌> ▏────────────────────────────────────────┐
08|│a │ 1│4 │
09|│b │ 3│6 │
10|│' │ 1│1 │
11|│" │ 1│1 │
12|│. │ 1│1 │
13|│A │ tests/dir-extra/real-files/a.lua│1│6 │
08|│a │ 1:4 │ Line 1-1 │
09|│b │ 3:6 │ Line 1-3 │
10|│' │ 1:1 │ Line 1-1 │
11|│" │ 1:1 │ Line 1-1 │
12|│. │ 1:1 │ Line 1-1 │
13|│A │ 1:6 │ tests/dir-extra/real-files…│
14|│ │
15|│ │
16|│ │
Expand All @@ -33,11 +33,11 @@
10|2666666666666666666666666666666666666666666621111111111111111111111111
11|2666666666666666666666666666666666666666666621111111111111111111111111
12|2666666666666666666666666666666666666666666621111111111111111111111111
13|2666666666666666666666666666666666666666666621111111111111111111111111
14|2777777777777777777777777777777777777777777721111111111111111111111111
15|2777777777777777777777777777777777777777777721111111111111111111111111
16|2777777777777777777777777777777777777777777721111111111111111111111111
17|2777777777777777777777777777777777777777777721111111111111111111111111
18|2777777777777777777777777777777777777777777721111111111111111111111111
19|2888888888888822222222222222222222222888888821111111111111111111111111
13|2666666666666666666666666666666666666666666721111111111111111111111111
14|2888888888888888888888888888888888888888888821111111111111111111111111
15|2888888888888888888888888888888888888888888821111111111111111111111111
16|2888888888888888888888888888888888888888888821111111111111111111111111
17|2888888888888888888888888888888888888888888821111111111111111111111111
18|2888888888888888888888888888888888888888888821111111111111111111111111
19|2999999999999922222222222222222222222999999921111111111111111111111111
20|0000000000000000000000000000000000000000000000000000000000000000000000
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
04|~
05|~
06|~
07|┌ a │ 1│4 ──────────────────────────────────┐
07|┌ a │ 1:4 │ Line 1-1 ────────────────┐
08|│Line 1-1 │
09|│Line 1-2 │
10|│Line 1-3 │
Expand All @@ -27,7 +27,7 @@
04|1111111111111111111111111111111111111111111111111111111111111111111111
05|1111111111111111111111111111111111111111111111111111111111111111111111
06|1111111111111111111111111111111111111111111111111111111111111111111111
07|2333333333222222222222222222222222222222222221111111111111111111111111
07|2333333333333333333333333333222222222222222221111111111111111111111111
08|2444544444444444444444444444444444444444444421111111111111111111111111
09|2666666666666666666666666666666666666666666621111111111111111111111111
10|2666666666666666666666666666666666666666666621111111111111111111111111
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
04|~
05|~
06|~
07|┌ b │ 3│6 ──────────────────────────────────┐
07|┌ b │ 3:6 │ Line 1-3 ────────────────┐
08|│Line 1-3 │
09|│ │
10|│ │
Expand All @@ -27,7 +27,7 @@
04|1111111111111111111111111111111111111111111111111111111111111111111111
05|1111111111111111111111111111111111111111111111111111111111111111111111
06|1111111111111111111111111111111111111111111111111111111111111111111111
07|2333333333222222222222222222222222222222222221111111111111111111111111
07|2333333333333333333333333333222222222222222221111111111111111111111111
08|2444445444444444444444444444444444444444444421111111111111111111111111
09|2666666666666666666666666666666666666666666621111111111111111111111111
10|2666666666666666666666666666666666666666666621111111111111111111111111
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
04|~
05|~
06|~
07|┌ A │ tests/dir-extra/real-files/a.lua│1│6 ─┐
07|┌…1:6 │ tests/dir-extra/real-files/a.lua ┐
08|│local a = 1 │
09|│local t = { │
10|│ x = math.max(a, 2), │
Expand All @@ -27,7 +27,7 @@
04|1111111111111111111111111111111111111111111111111111111111111111111111
05|1111111111111111111111111111111111111111111111111111111111111111111111
06|1111111111111111111111111111111111111111111111111111111111111111111111
07|2333333333333333333333333333333333333333333221111111111111111111111111
07|2333333333333333333333333333333333333333333321111111111111111111111111
08|2444445666676666666666666666666666666666666621111111111111111111111111
09|28888899999:9999999999999999999999999999999921111111111111111111111111
10|299;999::::<===<9<9><<999999999999999999999921111111111111111111111111
Expand Down
26 changes: 25 additions & 1 deletion tests/test_extra.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3409,7 +3409,7 @@ T['pickers']['marks()']['works'] = function()

-- Should return chosen value
local path_slash = path:gsub('\\', '/')
local ref_item = { col = 6, lnum = 1, path = path_slash, text = 'A │ ' .. path_slash .. '│1│6' }
local ref_item = { col = 6, lnum = 1, path = path_slash, text = 'A │ 1:6 │ ' .. path_slash .. ' ' }
eq(child.lua_get('_G.return_item'), ref_item)

-- Should work without set up 'mini.pick'
Expand Down Expand Up @@ -3438,6 +3438,30 @@ T['pickers']['marks()']['respects `local_opts.scope`'] = function()
stop_picker()
end

T['pickers']['marks()']['shows text of marked line'] = function()
setup_marks()

pick_marks({ scope = 'buf' })
eq(
vim.tbl_map(function(x) return x.text end, get_picker_items()),
{
'a │ 1:4 │ Line 1-1',
'b │ 3:6 │ Line 1-3',
"' │ 1:1 │ Line 1-1", '" │ 1:1 │ Line 1-1', '. │ 1:1 │ Line 1-1'
}
)
stop_picker()

mock_slash_path_sep()
pick_marks({ scope = 'global' })
eq(
vim.tbl_map(function(x) return x.text end, get_picker_items()),
{ 'A │ 1:6 │ tests/dir-extra/real-files/a.lua ' }
)
stop_picker()
unmock_slash_path_sep()
end

T['pickers']['marks()']['respects `opts`'] = function()
pick_marks({}, { source = { name = 'My name' } })
validate_picker_name('My name')
Expand Down