2021-01-07 22:52:20 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
from pexpect_helper import SpawnedProc
|
|
|
|
|
|
|
|
sp = SpawnedProc()
|
|
|
|
send, sendline, sleep, expect_prompt, expect_re, expect_str = (
|
|
|
|
sp.send,
|
|
|
|
sp.sendline,
|
|
|
|
sp.sleep,
|
|
|
|
sp.expect_prompt,
|
|
|
|
sp.expect_re,
|
|
|
|
sp.expect_str,
|
|
|
|
)
|
|
|
|
expect_prompt()
|
|
|
|
|
2024-04-13 06:00:13 +00:00
|
|
|
sendline("set -g fish_autosuggestion_enabled 0")
|
|
|
|
sendline("bind U,n,d,o undo; bind R,e,d,o redo")
|
2021-01-07 22:52:20 +00:00
|
|
|
expect_prompt()
|
|
|
|
|
|
|
|
send("echo word")
|
|
|
|
expect_str("echo word")
|
2024-04-13 06:00:13 +00:00
|
|
|
expect_str("echo word")
|
|
|
|
expect_str("echo word")
|
2021-01-07 22:52:20 +00:00
|
|
|
|
|
|
|
send("Undo")
|
2024-03-02 06:58:01 +00:00
|
|
|
expect_str("echo")
|
2021-01-07 22:52:20 +00:00
|
|
|
|
2024-04-13 06:12:21 +00:00
|
|
|
send("Redo\r")
|
2021-01-07 22:52:20 +00:00
|
|
|
expect_str("echo word")
|
2024-04-13 06:12:21 +00:00
|
|
|
|
|
|
|
sendline("bind x begin-undo-group 'commandline -i \"+ \"' 'commandline -i 3' end-undo-group")
|
|
|
|
send("math 2 x\r")
|
|
|
|
expect_prompt("5")
|
|
|
|
|
|
|
|
send("math 4x")
|
|
|
|
send("Undo1\r")
|
|
|
|
expect_prompt("41")
|
|
|
|
|
|
|
|
send("math 5 x")
|
|
|
|
send("\x02") # c-b, moving before the 3
|
|
|
|
send("Undo")
|
|
|
|
send("Redo")
|
|
|
|
send("9\r") # 5 + 93
|
|
|
|
expect_prompt("98")
|