選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

70 行
1.9 KiB

  1. context 'with asynchronous suggestions enabled' do
  2. let(:options) { ["ZSH_AUTOSUGGEST_USE_ASYNC="] }
  3. describe '`up-line-or-beginning-search`' do
  4. let(:before_sourcing) do
  5. -> do
  6. session.
  7. run_command('autoload -U up-line-or-beginning-search').
  8. run_command('zle -N up-line-or-beginning-search').
  9. send_string('bindkey "').
  10. send_keys('C-v').send_keys('up').
  11. send_string('" up-line-or-beginning-search').
  12. send_keys('enter')
  13. end
  14. end
  15. it 'should show previous history entries' do
  16. with_history(
  17. 'echo foo',
  18. 'echo bar',
  19. 'echo baz'
  20. ) do
  21. session.clear_screen
  22. 3.times { session.send_keys('up') }
  23. wait_for { session.content }.to eq("echo foo")
  24. end
  25. end
  26. end
  27. describe '`copy-earlier-word`' do
  28. let(:before_sourcing) do
  29. -> do
  30. session.
  31. run_command('autoload -Uz copy-earlier-word').
  32. run_command('zle -N copy-earlier-word').
  33. run_command('bindkey "^N" copy-earlier-word')
  34. end
  35. end
  36. it 'should cycle through previous words in the buffer' do
  37. session.clear_screen
  38. session.send_string('foo bar baz')
  39. sleep 0.5
  40. session.send_keys('C-n')
  41. wait_for { session.content }.to eq('foo bar bazbaz')
  42. session.send_keys('C-n')
  43. wait_for { session.content }.to eq('foo bar bazbar')
  44. session.send_keys('C-n')
  45. wait_for { session.content }.to eq('foo bar bazfoo')
  46. end
  47. end
  48. describe 'pressing ^C after fetching a suggestion' do
  49. before do
  50. skip 'Workaround does not work below v5.0.8' if session.zsh_version < Gem::Version.new('5.0.8')
  51. end
  52. it 'terminates the prompt and begins a new one' do
  53. session.send_keys('e')
  54. sleep 0.5
  55. session.send_keys('C-c')
  56. sleep 0.5
  57. session.send_keys('echo')
  58. wait_for { session.content }.to eq("e\necho")
  59. end
  60. end
  61. end