summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-01-24 13:26:33 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-01-24 13:26:33 +0900
commit448132c46c172169af22583403993f4505727ba5 (patch)
treebf18469a03309161067c5117a99ae821da0e2d1e
parent1476fc7f3bff575ab6adda3d53b7e03e282d3119 (diff)
Fix error when --query contains wide-length characters
-rw-r--r--src/terminal.go2
-rw-r--r--test/test_go.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/terminal.go b/src/terminal.go
index e9de6868..cfed1a0e 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -86,7 +86,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
prompt: opts.Prompt,
tac: opts.Sort == 0,
reverse: opts.Reverse,
- cx: displayWidth(input),
+ cx: len(input),
cy: 0,
offset: 0,
yanked: []rune{},
diff --git a/test/test_go.rb b/test/test_go.rb
index 0f055e2a..99c69627 100644
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -273,5 +273,13 @@ class TestGoFZF < MiniTest::Unit::TestCase
tmux.until { |lines| lines[-1].include?('FIN') }
assert_equal ['555555'], readonce.split($/)
end
+
+ def test_query_unicode
+ tmux.send_keys "(echo abc; echo 가나다) | fzf --query 가다 > #{TEMPNAME}", :Enter
+ tmux.until { |lines| lines.last.start_with? '>' }
+ tmux.send_keys :Enter
+ tmux.until { |lines| lines[-1].include?('FIN') }
+ assert_equal ['가나다'], readonce.split($/)
+ end
end