Skip to content

Commit 7208ff2

Browse files
timholyKristofferC
authored andcommitted
Revert "Add vim bindings to TerminalMenus (#37940)"
This reverts commit 4a19b75. Closes #41799. (cherry picked from commit 702cf55)
1 parent 1b3fb60 commit 7208ff2

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

stdlib/REPL/src/TerminalMenus/AbstractMenu.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ function request(term::REPL.Terminals.TTYTerminal, m::AbstractMenu; cursor::Unio
203203
lastoption = numoptions(m)
204204
c = readkey(term.in_stream)
205205

206-
if c == Int(ARROW_UP) || c == Int('k')
206+
if c == Int(ARROW_UP)
207207
cursor[] = move_up!(m, cursor[], lastoption)
208-
elseif c == Int(ARROW_DOWN) || c == Int('j')
208+
elseif c == Int(ARROW_DOWN)
209209
cursor[] = move_down!(m, cursor[], lastoption)
210210
elseif c == Int(PAGE_UP)
211211
cursor[] = page_up!(m, cursor[], lastoption)
@@ -217,7 +217,7 @@ function request(term::REPL.Terminals.TTYTerminal, m::AbstractMenu; cursor::Unio
217217
elseif c == Int(END_KEY)
218218
cursor[] = lastoption
219219
m.pageoffset = lastoption - m.pagesize
220-
elseif c == 13 || c == Int(' ') # <enter> or <space>
220+
elseif c == 13 # <enter>
221221
# will break if pick returns true
222222
pick(m, cursor[]) && break
223223
elseif c == UInt32('q')

stdlib/REPL/test/TerminalMenus/runtests.jl

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,10 @@ using Test
66

77
function simulate_input(expected, menu::TerminalMenus.AbstractMenu, keys...;
88
kwargs...)
9-
keydict = Dict(:up => "\e[A",
10-
:down => "\e[B",
11-
:enter => "\r")
12-
vimdict = Dict(:up => "k",
13-
:down => "j",
14-
:enter => " ")
15-
errs = []
16-
got = _simulate_input(keydict, deepcopy(menu), keys...; kwargs...)
17-
got == expected || push!(errs, :arrows => got)
18-
got = _simulate_input(vimdict, menu, keys...; kwargs...)
19-
got == expected || push!(errs, :vim => got)
20-
isempty(errs) || return errs
21-
end
9+
keydict = Dict(:up => "\e[A",
10+
:down => "\e[B",
11+
:enter => "\r")
2212

23-
function _simulate_input(keydict, menu::TerminalMenus.AbstractMenu, keys...;
24-
kwargs...)
2513
for key in keys
2614
if isa(key, Symbol)
2715
write(stdin.buffer, keydict[key])
@@ -30,7 +18,7 @@ function _simulate_input(keydict, menu::TerminalMenus.AbstractMenu, keys...;
3018
end
3119
end
3220

33-
request(menu; suppress_output=true, kwargs...)
21+
request(menu; suppress_output=true, kwargs...) == expected
3422
end
3523

3624
include("radio_menu.jl")

0 commit comments

Comments
 (0)