mirror of
https://github.com/lotabout/skim.git
synced 2026-09-10 23:36:23 -04:00
feat!: do not check for expect before printing the argument of accept… (#625)
* feat!: do not check for expect before printing the argument of accept(...) * fix tests --------- Co-authored-by: LoricAndre <loric.andre@pm.me>
This commit is contained in:
parent
4144879f00
commit
bcee1f4c02
|
|
@ -129,16 +129,8 @@ fn sk_main() -> Result<i32, SkMainError> {
|
|||
print!("{}{}", result.cmd, bin_options.output_ending);
|
||||
}
|
||||
|
||||
if !opts.expect.is_empty() {
|
||||
match result.final_event {
|
||||
Event::EvActAccept(Some(accept_key)) => {
|
||||
print!("{}{}", accept_key, bin_options.output_ending);
|
||||
}
|
||||
Event::EvActAccept(None) => {
|
||||
print!("{}", bin_options.output_ending);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if let Event::EvActAccept(Some(accept_key)) = result.final_event {
|
||||
print!("{}{}", accept_key, bin_options.output_ending);
|
||||
}
|
||||
|
||||
for item in result.selected_items.iter() {
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ pub struct SkimOptions {
|
|||
///
|
||||
/// ACTION: DEFAULT BINDINGS (NOTES):
|
||||
/// abort ctrl-c ctrl-q esc
|
||||
/// accept enter
|
||||
/// accept(...) enter (the argument will be printed when the binding is triggered)
|
||||
/// append-and-select
|
||||
/// backward-char ctrl-b left
|
||||
/// backward-delete-char ctrl-h bspace
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ set -euo pipefail
|
|||
|
||||
TEST_CLASS=test_skim.TestSkim
|
||||
|
||||
cd $(dirname "$0")
|
||||
tests=$(sed -n 's/^\s\+def \(test_\w\+\)(self.*):\s*$/\1/p' test_skim.py | \
|
||||
sk --multi)
|
||||
|
||||
|
|
|
|||
|
|
@ -1375,6 +1375,17 @@ class TestSkim(TestBase):
|
|||
self.tmux.until(lambda l: l.ready_with_matches(2))
|
||||
self.tmux.until(lambda l: l[-3] == '> a b')
|
||||
|
||||
def test_624_accept_no_expect(self):
|
||||
input_cmd = "echo -e 'a b c\\nd e f'"
|
||||
args = '--bind ctrl-a:accept:hello'
|
||||
self.tmux.send_keys(f"{input_cmd} | {self.sk(args)}", Key('Enter'))
|
||||
self.tmux.until(lambda l: l.ready_with_matches(2))
|
||||
self.tmux.send_keys(Ctrl('a'))
|
||||
out = self.readonce().split('\n')
|
||||
self.assertEqual(out[-1], '')
|
||||
self.assertEqual(out[-2], 'a b c')
|
||||
self.assertEqual(out[-3], 'hello')
|
||||
|
||||
def find_prompt(lines, interactive=False, reverse=False):
|
||||
linen = -1
|
||||
prompt = ">"
|
||||
|
|
|
|||
Loading…
Reference in a new issue