view .zfun/zsh-autosuggestions/spec/integrations/zle_input_stack_spec.rb @ 472:79110d94a0c2

hg: filter out display of remotenames that start with "/" I may want to filter out anything that contains a "/" since that'd be a URL instead of a path shortcut, but I'll do that later if it becomes obviously the right choice.
author Augie Fackler <raf@durin42.com>
date Fri, 01 Feb 2019 14:08:50 -0500
parents e1ce8897030d
children
line wrap: on
line source

describe 'using `zle -U`' do
  let(:before_sourcing) do
    -> do
      session.
        run_command('_zsh_autosuggest_strategy_test() { sleep 1; _zsh_autosuggest_strategy_history "$1" }').
        run_command('foo() { zle -U - "echo hello" }; zle -N foo; bindkey ^B foo')
    end
  end

  let(:options) { ['unset ZSH_AUTOSUGGEST_USE_ASYNC', 'ZSH_AUTOSUGGEST_STRATEGY=test'] }

  # TODO: This is only possible with the $KEYS_QUEUED_COUNT widget parameter, coming soon...
  xit 'does not fetch a suggestion for every inserted character' do
    session.send_keys('C-b')
    wait_for { session.content }.to eq('echo hello')
  end

  it 'shows a suggestion when the widget completes' do
    with_history('echo hello world') do
      session.send_keys('C-b')
      wait_for { session.content(esc_seqs: true) }.to match(/\Aecho hello\e\[[0-9]+m world/)
    end
  end
end