-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for ZSH_AUTOSUGGEST_BUFFER_MIN_SIZE to disable suggest…
…ions on small buffers
- Loading branch information
Showing
5 changed files
with
47 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
describe 'a suggestion' do | ||
let(:term_opts) { { width: 200 } } | ||
let(:command) { "echo foobar" } | ||
|
||
around do |example| | ||
with_history(command) { example.run } | ||
end | ||
|
||
it 'is provided for any buffer length' do | ||
session.send_string(command[0...-1]) | ||
wait_for { session.content }.to eq(command) | ||
end | ||
|
||
context 'when ZSH_AUTOSUGGEST_BUFFER_MIN_SIZE is specified' do | ||
let(:buffer_min_size) { 5 } | ||
let(:options) { ["ZSH_AUTOSUGGEST_BUFFER_MIN_SIZE=#{buffer_min_size}"] } | ||
|
||
it 'is provided when the buffer is longer than the specified length' do | ||
session.send_string(command[0...(buffer_min_size + 1)]) | ||
wait_for { session.content }.to eq(command) | ||
end | ||
|
||
it 'is provided when the buffer is equal to the specified length' do | ||
session.send_string(command[0...(buffer_min_size)]) | ||
wait_for { session.content }.to eq(command) | ||
end | ||
|
||
it 'is not provided when the buffer is shorter than the specified length' do | ||
session.send_string(command[0...(buffer_min_size - 1)]) | ||
wait_for { session.content }.to eq(command[0...(buffer_min_size - 1)]) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters