summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2014-12-23 12:22:19 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2014-12-23 12:22:19 +0900
commit00190677d421b4833488befd7d96b22d2014f32d (patch)
tree1bdb11a4f81e9b414f8d24c99e2c94a28a03da4f /test
parentd38f7a5eb5348859786ff96b96a35eade0e2b0e5 (diff)
Add support for ALT-D and ALT-BS key bindings
https://github.com/junegunn/fzf/issues/111#issuecomment-67832143
Diffstat (limited to 'test')
-rw-r--r--test/test_fzf.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_fzf.rb b/test/test_fzf.rb
index 2bb7dce9..f8a06cf9 100644
--- a/test/test_fzf.rb
+++ b/test/test_fzf.rb
@@ -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