m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-17 15:53:39 -05:00

Add support for ALT-D and ALT-BS key bindings

https://github.com/junegunn/fzf/issues/111#issuecomment-67832143
This commit is contained in:
Junegunn Choi
2014-12-23 12:22:19 +09:00
parent d38f7a5eb5
commit 00190677d4
2 changed files with 48 additions and 6 deletions

View File

@@ -50,6 +50,7 @@ class MockTTY
@buffer << str
@condv.broadcast
end
self
end
end
@@ -805,6 +806,30 @@ class TestFZF < MiniTest::Unit::TestCase
tty << "\e[Z\e[Z"
tty << "\r"
end
# ALT-D
assert_fzf_output %w[--print-query], "", "hello baby = world" do |tty|
tty << "hello world baby"
tty << alt(:b) << alt(:b) << alt(:d)
tty << ctrl(:e) << " = " << ctrl(:y)
tty << "\r"
end
# ALT-BACKSPACE
assert_fzf_output %w[--print-query], "", "hello baby = world " do |tty|
tty << "hello world baby"
tty << alt(:b) << alt(127.chr)
tty << ctrl(:e) << " = " << ctrl(:y)
tty << "\r"
end
end
def alt chr
"\e#{chr}"
end
def ctrl char
char.to_s.ord - 'a'.ord + 1
end
end