Skip to content

Commit 855ef4d

Browse files
committed
vendor: update deps
1 parent db5c3d9 commit 855ef4d

6 files changed

Lines changed: 62 additions & 60 deletions

File tree

lua/_vendor/mini/ai.lua

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ MiniAi.select_textobject = function(ai_type, id, opts)
11251125
vim.cmd('normal! zv')
11261126
vim.cmd('normal! ' .. vis_mode)
11271127
set_cursor(tobj.to)
1128-
if vim.o.selection == 'exclusive' then vim.cmd('set whichwrap=l | normal! l') end
1128+
if vim.o.selection == 'exclusive' and not tobj_is_empty then vim.cmd('set whichwrap=l | normal! l') end
11291129
vim.cmd('normal! zv')
11301130

11311131
-- Restore horizontal view which was possibly affected by moving cursor
@@ -2005,26 +2005,17 @@ H.user_textobject_id = function(ai_type)
20052005
end
20062006

20072007
H.user_input = function(prompt, text)
2008-
-- Register temporary keystroke listener to distinguish between cancel with
2009-
-- `<Esc>` and immediate `<CR>`.
2010-
local on_key = vim.on_key or vim.register_keystroke_callback
2008+
-- Use `on_key` to distinguish cancel with `<Esc>` and immediate `<CR>`
20112009
local was_cancelled = false
2012-
on_key(function(key)
2013-
if key == '27' then was_cancelled = true end
2014-
end, H.ns_id.input)
2010+
vim.on_key(function(key) was_cancelled = was_cancelled or key == '\27' end, H.ns_id.input)
20152011

2016-
-- Ask for input
2017-
local opts = { prompt = '(mini.ai) ' .. prompt .. ': ', default = text or '' }
2012+
-- Ask for input. Use `pcall` to allow `<C-c>` to cancel user input
20182013
vim.cmd('echohl Question')
2019-
-- Use `pcall` to allow `<C-c>` to cancel user input
2020-
local ok, res = pcall(vim.fn.input, opts)
2021-
vim.cmd([[echohl None | echo '' | redraw]])
2014+
local ok, res = pcall(vim.fn.input, { prompt = '(mini.ai) ' .. prompt .. ': ', default = text or '' })
2015+
vim.cmd('echohl None | echo "" | redraw')
20222016

2023-
-- Stop key listening
2024-
on_key(nil, H.ns_id.input)
2025-
2026-
if not ok or was_cancelled then return end
2027-
return res
2017+
vim.on_key(nil, H.ns_id.input)
2018+
return (ok and not was_cancelled) and res or nil
20282019
end
20292020

20302021
-- Work with Visual mode ------------------------------------------------------

lua/_vendor/mini/basics.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ H.apply_mappings = function(config)
577577
map( 'x', 'gp', '"+P', { desc = 'Paste from system clipboard' })
578578

579579
-- Reselect latest changed, put, or yanked text
580-
map('n', 'gV', '"`[" . strpart(getregtype(), 0, 1) . "`]"', { expr = true, replace_keycodes = false, desc = 'Visually select changed text' })
580+
map('n', 'gV', '"g`[" . strpart(getregtype(), 0, 1) . "g`]"', { expr = true, replace_keycodes = false, desc = 'Visually select changed text' })
581581

582582
-- Search inside visually highlighted text. Use `silent = false` for it to
583583
-- make effect immediately.

lua/_vendor/mini/completion.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,9 @@ H.fit_to_width = function(text, width)
19171917
return t_width <= width and text or ('' .. vim.fn.strcharpart(text, t_width - width + 1, width - 1))
19181918
end
19191919

1920+
H.str_byteindex = function(s, i) return vim.str_byteindex(s, 'utf-32', i) end
1921+
if vim.fn.has('nvim-0.11') == 0 then H.str_byteindex = function(s, i) return vim.str_byteindex(s, i) end end
1922+
19201923
-- Simulate splitting single line `l` like how it would look inside window with
19211924
-- `wrap` and `linebreak` set to `true`
19221925
H.wrap_line = function(l, width)
@@ -1928,7 +1931,7 @@ H.wrap_line = function(l, width)
19281931
-- Simulate wrap by looking at breaking character from end of current break
19291932
-- Use `pcall()` to handle complicated multibyte characters (like Chinese)
19301933
-- for which even `strdisplaywidth()` seems to return incorrect values.
1931-
success, width_id = pcall(vim.str_byteindex, l, width)
1934+
success, width_id = pcall(H.str_byteindex, l, width)
19321935

19331936
if success then
19341937
local break_match = vim.fn.match(l:sub(1, width_id):reverse(), '[- \t.,;:!?]')

lua/_vendor/mini/pairs.lua

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,21 @@ MiniPairs.config = {
143143
-- - <action> - one of "open", "close", "closeopen".
144144
-- - <pair> - two character string for pair to be used.
145145
-- By default pair is not inserted after `\`, quotes are not recognized by
146-
-- <CR>, `'` does not insert pair after a letter.
146+
-- <CR>, `'` does not insert the pair after a letter.
147147
-- Only parts of tables can be tweaked (others will use these defaults).
148148
-- Supply `false` instead of table to not map particular key.
149149
mappings = {
150-
['('] = { action = 'open', pair = '()', neigh_pattern = '[^\\].' },
151-
['['] = { action = 'open', pair = '[]', neigh_pattern = '[^\\].' },
152-
['{'] = { action = 'open', pair = '{}', neigh_pattern = '[^\\].' },
150+
['('] = { action = 'open', pair = '()', neigh_pattern = '^[^\\]' },
151+
['['] = { action = 'open', pair = '[]', neigh_pattern = '^[^\\]' },
152+
['{'] = { action = 'open', pair = '{}', neigh_pattern = '^[^\\]' },
153153

154-
[')'] = { action = 'close', pair = '()', neigh_pattern = '[^\\].' },
155-
[']'] = { action = 'close', pair = '[]', neigh_pattern = '[^\\].' },
156-
['}'] = { action = 'close', pair = '{}', neigh_pattern = '[^\\].' },
154+
[')'] = { action = 'close', pair = '()', neigh_pattern = '^[^\\]' },
155+
[']'] = { action = 'close', pair = '[]', neigh_pattern = '^[^\\]' },
156+
['}'] = { action = 'close', pair = '{}', neigh_pattern = '^[^\\]' },
157157

158-
['"'] = { action = 'closeopen', pair = '""', neigh_pattern = '[^\\].', register = { cr = false } },
159-
["'"] = { action = 'closeopen', pair = "''", neigh_pattern = '[^%a\\].', register = { cr = false } },
160-
['`'] = { action = 'closeopen', pair = '``', neigh_pattern = '[^\\].', register = { cr = false } },
158+
['"'] = { action = 'closeopen', pair = '""', neigh_pattern = '^[^\\]', register = { cr = false } },
159+
["'"] = { action = 'closeopen', pair = "''", neigh_pattern = '^[^%a\\]', register = { cr = false } },
160+
['`'] = { action = 'closeopen', pair = '``', neigh_pattern = '^[^\\]', register = { cr = false } },
161161
},
162162
}
163163
--minidoc_afterlines_end
@@ -177,11 +177,11 @@ MiniPairs.config = {
177177
---@param pair_info table Table with pair information. Fields:
178178
--- - <action> - one of "open" for |MiniPairs.open()|,
179179
--- "close" for |MiniPairs.close()|, or "closeopen" for |MiniPairs.closeopen()|.
180-
--- - <pair> - two character string to be used as argument for action function.
180+
--- - <pair> - two character string to be passed to an action function.
181181
--- Can contain multibyte characters.
182-
--- - <neigh_pattern> - optional 'two character' neighborhood pattern to be
183-
--- used as argument for action function. Note: neighborhood might contain
184-
--- multiple characters.
182+
--- - <neigh_pattern> - optional neighborhood pattern to be passed to an action
183+
--- function. Will be matched against two character neighborhood (might
184+
--- contain multibyte characters).
185185
--- Default: `'..'` (no restriction from neighborhood).
186186
--- - <register> - optional table with information about whether this pair will
187187
--- be recognized by <BS> (in |MiniPairs.bs()|) and/or <CR> (in |MiniPairs.cr()|).
@@ -289,6 +289,8 @@ MiniPairs.open = function(pair, neigh_pattern)
289289
-- This can happen in a big file with tree-sitter highlighting enabled.
290290
H.with_temp_option('lazyredraw', true)
291291

292+
-- NOTE: Do not ensure no wildmenu because by the time arrow is executed
293+
-- wildmenu should already (usually) be hidden due to inserting `pair`
292294
return pair .. H.get_arrow_key('left')
293295
end
294296

@@ -309,7 +311,7 @@ end
309311
MiniPairs.close = function(pair, neigh_pattern)
310312
local close = H.get_close_char(pair)
311313
local move_right = not H.is_disabled() and H.neigh_match(neigh_pattern) and H.get_neigh('right') == close
312-
return move_right and H.get_arrow_key('right') or close
314+
return move_right and H.get_arrow_key('right', true) or close
313315
end
314316

315317
--- Process "closeopen" symbols
@@ -327,7 +329,7 @@ end
327329
---@return string Keys performing "closeopen" action.
328330
MiniPairs.closeopen = function(pair, neigh_pattern)
329331
local move_right = not H.is_disabled() and H.get_neigh('right') == H.get_close_char(pair)
330-
return move_right and H.get_arrow_key('right') or MiniPairs.open(pair, neigh_pattern)
332+
return move_right and H.get_arrow_key('right', true) or MiniPairs.open(pair, neigh_pattern)
331333
end
332334

333335
--- Process |<BS>|
@@ -416,7 +418,7 @@ H.keys = {
416418
bs = escape('<BS>'),
417419
cr = escape('<CR>'),
418420
del = escape('<Del>'),
419-
keep_undo = escape('<C-g>U'),
421+
ctrl_y = escape('<C-y>'),
420422
-- Using left/right keys in insert mode breaks undo sequence and, more
421423
-- importantly, dot-repeat. To avoid this, use 'i_CTRL-G_U' mapping.
422424
-- Use `H.get_arrow_key()` for keys instead of direct from this table.
@@ -611,9 +613,17 @@ H.neigh_match = function(pattern) return H.get_neigh('whole'):find(pattern or ''
611613
H.get_open_char = function(x) return vim.fn.strcharpart(x, 0, 1) end
612614
H.get_close_char = function(x) return vim.fn.strcharpart(x, 1, 1) end
613615

614-
H.get_arrow_key = function(key)
615-
return vim.fn.mode() == 'i' and (key == 'right' and H.keys.right_undo or H.keys.left_undo)
616-
or (key == 'right' and H.keys.right or H.keys.left)
616+
H.get_arrow_key = function(key, ensure_no_wildmenu)
617+
if vim.fn.mode() == 'i' then
618+
-- Take into account that `virtualedit=all` can go into inline virtual text
619+
H.with_temp_option('virtualedit', 'none')
620+
return key == 'right' and H.keys.right_undo or H.keys.left_undo
621+
end
622+
local prefix = ''
623+
-- In Command-line mode <Left> / <Right> act like <C-p> / <C-n> if wildmenu
624+
-- is shown. Make sure that arrow key moves cursor.
625+
if vim.fn.mode() == 'c' and ensure_no_wildmenu then prefix = vim.fn.wildmenumode() == 1 and H.keys.ctrl_y or '' end
626+
return prefix .. (key == 'right' and H.keys.right or H.keys.left)
617627
end
618628

619629
H.map = function(mode, lhs, rhs, opts)

lua/_vendor/mini/surround.lua

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -916,13 +916,10 @@ MiniSurround.user_input = function(prompt, text)
916916
-- using that string. Although doable with very obscure string, this is not
917917
-- very clean.
918918
-- Overcome this by adding temporary keystroke listener.
919-
local on_key = vim.on_key or vim.register_keystroke_callback
920919
local was_cancelled = false
921-
on_key(function(key)
922-
if key == vim.api.nvim_replace_termcodes('<Esc>', true, true, true) then was_cancelled = true end
923-
end, H.ns_id.input)
920+
vim.on_key(function(key) was_cancelled = was_cancelled or key == '\27' end, H.ns_id.input)
924921

925-
-- Ask for input
922+
-- Ask for input. Use `pcall` to allow `<C-c>` to cancel user input
926923
-- NOTE: it would be GREAT to make this work with `vim.ui.input()` but I
927924
-- didn't find a way to make it work without major refactor of whole module.
928925
-- The main issue is that `vim.ui.input()` is designed to perform action in
@@ -933,17 +930,12 @@ MiniSurround.user_input = function(prompt, text)
933930
-- immediately and proceed in main event loop. Couldn't find a relatively
934931
-- simple way to stop execution of this current function until `ui.input()`'s
935932
-- callback finished execution.
936-
local opts = { prompt = '(mini.surround) ' .. prompt .. ': ', default = text or '' }
937933
vim.cmd('echohl Question')
938-
-- Use `pcall` to allow `<C-c>` to cancel user input
939-
local ok, res = pcall(vim.fn.input, opts)
940-
vim.cmd([[echohl None | echo '' | redraw]])
934+
local ok, res = pcall(vim.fn.input, { prompt = '(mini.surround) ' .. prompt .. ': ', default = text or '' })
935+
vim.cmd('echohl None | echo "" | redraw')
941936

942-
-- Stop key listening
943-
on_key(nil, H.ns_id.input)
944-
945-
if not ok or was_cancelled then return end
946-
return res
937+
vim.on_key(nil, H.ns_id.input)
938+
return (ok and not was_cancelled) and res or nil
947939
end
948940

949941
--- Generate common surrounding specifications
@@ -1877,6 +1869,12 @@ H.is_point_inside_spans = function(point, spans)
18771869
return false
18781870
end
18791871

1872+
H.str_utfindex = function(s, i) return vim.str_utfindex(s, 'utf-32', i) end
1873+
if vim.fn.has('nvim-0.11') == 0 then H.str_utfindex = function(s, i) return (vim.str_utfindex(s, i)) end end
1874+
1875+
H.str_byteindex = function(s, i) return vim.str_byteindex(s, 'utf-32', i) end
1876+
if vim.fn.has('nvim-0.11') == 0 then H.str_byteindex = function(s, i) return vim.str_byteindex(s, i) end end
1877+
18801878
-- Work with operator marks ---------------------------------------------------
18811879
H.get_marks_pos = function(mode)
18821880
-- Region is inclusive on both ends
@@ -1922,10 +1920,10 @@ H.get_marks_pos = function(mode)
19221920
-- Use `math.min()` because it might lead to 'index out of range' error
19231921
-- when mark is positioned at the end of line (that extra space which is
19241922
-- selected when selecting with `v$`)
1925-
local utf_index = vim.str_utfindex(line2, math.min(#line2, pos2[2]))
1923+
local utf_index = H.str_utfindex(line2, math.min(#line2, pos2[2]))
19261924
-- This returns the last byte inside character because `vim.str_byteindex()`
19271925
-- 'rounds upwards to the end of that sequence'.
1928-
pos2[2] = vim.str_byteindex(line2, utf_index)
1926+
pos2[2] = H.str_byteindex(line2, utf_index)
19291927
end
19301928

19311929
return {

peru.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ git module deps:
1515

1616
git module basics:
1717
url: https://github.com/echasnovski/mini.basics
18-
rev: 862b940b1ea67993893c6fd39ca1000beed1af46
18+
rev: 9f80f04cf4732939514b304e7c9146b9dc8e54c3
1919

2020
git module completion:
2121
url: https://github.com/echasnovski/mini.completion
22-
rev: 7c5edfc0e479dd4edd898cc9ddd1920d8c1ce420
22+
rev: 4d451f82f193f6751719935a63d16ccb79a76e0b
2323

2424
git module ai:
2525
url: https://github.com/echasnovski/mini.ai
26-
rev: 0d3c9cf22e37b86b7a0dfbe7ef129ee7a5f4f93c
26+
rev: 9eae720f2b20f6ad28cbfa0ddc524e10dc2c3201
2727

2828
git module comment:
2929
url: https://github.com/echasnovski/mini.comment
@@ -39,11 +39,11 @@ git module jump:
3939

4040
git module pairs:
4141
url: https://github.com/echasnovski/mini.pairs
42-
rev: b316e68f2d242d5bd010deaab645daa27ed86297
42+
rev: 4089aa6ea6423e02e1a8326a7a7a00159f6f5e04
4343

4444
git module surround:
4545
url: https://github.com/echasnovski/mini.surround
46-
rev: 88c52297ed3e69ecf9f8652837888ecc727a28ee
46+
rev: f9358544ed06bc10197e698b7fc8dc5963be3f4b
4747

4848
rule mini:
4949
export: lua/mini/

0 commit comments

Comments
 (0)