Skip to content

Commit 1bb80e5

Browse files
committed
fix(clue): ensure even better key readability
1 parent 009435c commit 1bb80e5

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
lines changed

lua/mini/clue.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1914,7 +1914,10 @@ H.replace_termcodes = function(x)
19141914
return vim.api.nvim_replace_termcodes(H.keytrans(x), true, true, true)
19151915
end
19161916

1917-
H.keytrans = function(x) return (vim.fn.keytrans(x):gsub('<lt>', '<'):gsub('<[Nn][Ll]>', '<C-J>')) end
1917+
H.keytrans = function(x)
1918+
local res = vim.fn.keytrans(x):gsub('<NL>', '<C-J>'):gsub('<S%-NL>', '<C-S-J>'):gsub('<M%-NL>', '<C-M-J>')
1919+
return (res:gsub('<lt>', '<'))
1920+
end
19181921

19191922
H.get_forced_submode = function()
19201923
local mode = vim.fn.mode(1)

tests/screenshots/tests-test_clue.lua---Clues---uses-human-readable-names-for-special-keys

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22
01|
33
02|~ ┌ <Space> ─────────────────────┐
44
03|~ │ <C-J> │ │
5-
04|~ │ <C-Right> │ │
6-
05|~ │ <C-X> │ │
7-
06|~ │ <End> │ │
8-
07|~ │ <F1> │ │
9-
08|~ │ <kRight> │ │
10-
09|~ │ <PageUp> │ │
11-
10|~ │ <Right> │ │
12-
11|~ │ <S-F1> │ │
13-
12|~ │ <S-Right> │ │
14-
13|~ │ <Space> │ │
15-
14|~ │ <Tab> │ │
16-
15|~ │ < │ │
17-
16|~ └──────────────────────────────┘
18-
17|[No Name] 0,0-1
19-
18|
5+
04|~ │ <C-M-J> │ │
6+
05|~ │ <C-Right> │ │
7+
06|~ │ <C-S-J> │ │
8+
07|~ │ <C-X> │ │
9+
08|~ │ <End> │ │
10+
09|~ │ <F1> │ │
11+
10|~ │ <kRight> │ │
12+
11|~ │ <PageUp> │ │
13+
12|~ │ <Right> │ │
14+
13|~ │ <S-F1> │ │
15+
14|~ │ <S-Right> │ │
16+
15|~ │ <Space> │ │
17+
16|~ │ <Tab> │ │
18+
17|~ │ < │ │
19+
18|~ └──────────────────────────────┘
20+
19|[No Name] 0,0-1
21+
20|
2022

2123
--|---------|---------|---------|---------|
2224
01|0000000000000000000000000000000000000000
@@ -34,6 +36,8 @@
3436
13|1111111124444444444456666666666666666662
3537
14|1111111124444444444456666666666666666662
3638
15|1111111124444444444456666666666666666662
37-
16|1111111122222222222222222222222222222222
38-
17|7777777777777777777777777777777777777777
39-
18|8888888888888888888888888888888888888888
39+
16|1111111124444444444456666666666666666662
40+
17|1111111124444444444456666666666666666662
41+
18|1111111122222222222222222222222222222222
42+
19|7777777777777777777777777777777777777777
43+
20|8888888888888888888888888888888888888888

tests/test_clue.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1660,13 +1660,15 @@ T['Clues']['can be configured after load'] = function()
16601660
end
16611661

16621662
T['Clues']['uses human-readable names for special keys'] = function()
1663-
child.set_size(18, 40)
1663+
child.set_size(20, 40)
16641664
child.cmd('nmap <Space><Space> :echo 1<CR>')
16651665
child.cmd('nmap <Space><Tab> :echo 2<CR>')
16661666
child.cmd('nmap <Space><End> :echo 3<CR>')
16671667
child.cmd('nmap <Space><PageUp> :echo 4<CR>')
16681668
child.cmd('nmap <Space><C-x> :echo 5<CR>')
16691669
child.cmd('nmap <Space><C-j> :echo 6<CR>')
1670+
child.cmd('nmap <Space><C-S-j> :echo 6.1<CR>')
1671+
child.cmd('nmap <Space><C-M-j> :echo 6.2<CR>')
16701672
child.cmd('nmap <Space><Right> :echo 7<CR>')
16711673
child.cmd('nmap <Space><C-Right> :echo 8<CR>')
16721674
child.cmd('nmap <Space><S-Right> :echo 9<CR>')

0 commit comments

Comments
 (0)